Giter Site home page Giter Site logo

lob-modeling's Introduction

This semester/year, the repo will serve to compile a collection of fundamental market making models, as well as explorations of my own. I apologize for the docs and structure of this - I just wanted to make functional & readable model code available for people to use - most of the original papers do not include code and this helps for reproducability/verifying results.

Data to play with can be found in the example data - matlab files of LOB data for AMZN and EBAY or, in the trades directory/folder as csv files - this is just the sample ITCH data from Tick Data (https://www.tickdata.com/).

glosten-milgrom-simple.py This is the simplest version - given some order book at each time, it computes the expected bid and ask. Here we can see the math & intuition blend nicely - spreads begin to converge after n trades as they gain more info on the "true" price ScreenShot

Kyle Model.py This features the single period and multiperiod versions of the discretized Kyle model. It computes params for determining agents order flow at each time period as well as the informed trader expected profit (MM prices fairly). The model is very interesting, but actually implementing the model requires guessing SIGMA_N (future vol at end of trading) and recursively solving for initial vol and the other params. The original paper did not provide a way to get the convergence of SIGMA- True_Sigma at t=0, so here's a I guess toy version as I'm not sure best way to converge ScreenShot

Here is a graph of the order sizes of the participants with V_0=5, SIGMA_T = 0.2, MAX_ITER = 100, SIGMA_noise = 2. We see after several demonstrations that order size of noise and informed are relatively inversely correlated. ScreenShot

optimal_execution.py This features a collection of models deviating from the seminal work of Almgren & Chriss in 2000. For now, it has optimal execution from the very basic version with linear impact costs as well as the one with stochastic optimal control & dynamic programming. Here is a graph of optimal execution from the stochastic approach with the following parameters: ALPHA = 1, ETA = 0.05, GAMMA = 0.5, BETA = 1, LAMBDA = 0.0003, SIGMA = 0.3, EPSILON = 0.0625, N = 50, T = 1, X = 100: ScreenShot

Stochastic-Vol-Optimal-Exec.py This attempts to replicate the results of Criscuolo & Waehlbroek (2014) when uncovering the effects of stochastic volatility (a deviant of the Heston with temporal averaging) on participation rate schedules for institutions. The code is buggy/doesn't work at the moment - the minimization looks atrocious - the paper simplifies results for only n=4 - not enough/realistic as trades can happen much more frequently. Additionally they use some "patented/private" simulated annealing software that supposedly makes this code work - I don't want to point fingers, but the result isn't practical even if it is solvable using some fancy numerical technique because of runtime issues.

dePrado.py Features models, calculations, and data feed for exploring/verifying results of Easley, de Prado, O'Hara (2012). I also wanted to include basic microstructure details, data that is cleaned, graphs, etc. ScreenShot

lob-modeling's People

Contributors

mindful-math avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.