Git Product home page Git Product logo

machine-learning-market-maker's Introduction

machine-learning-market-maker

Implementation of a Bayesian-style market maker in the vein of 'Intelligent Market-Making in Artificial Financial Markets' by Sanmay Das

Member Variables:
Symbol: Ticker for security
Distribution: A map of prices with a probability for each price
Pa: Ask price, double
Pb: Bid price, double
Alpha: Percentage of noisy informed traders, double
Noise: Noise magnitude of noisy informed traders, double
Shift: Difference from 0-profit market maker, double
TruePrice: 'True price' traded upon by our model

machine-learning-market-maker's People

Contributors

mmargenot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

machine-learning-market-maker's Issues

Update Spread Calculations

Hey Max,

Thanks for this cool way to follow along with Das's paper!

I was with you right up until updating the bid-ask spread, and I was actually a bit confused with Das's explanation (what does he mean by "cycling down"?):

The fixed point equations 2.10 and 2.11 are approximately solved by using the result from Glosten and Milgrom that Pb ≤ E[V ] ≤ Pa and then, to find the bid price, for example, cycling from E[V] downwards until the difference between the left and right hand sides of the equation stops decreasing. The fixed point real-valued solution must then be closest to the integral value at which the distance between the two sides of the equation is minimized.

Reading eq. 2.10 the first time, I assumed that the Pb on the left hand side of the equation was the posterior whereas the Pb used in the Σ expression was the prior.

Screenshot from 2020-05-15 07-43-03

But after puzzling over his explanation of the solution, I think that Pb is the same on both sides of the equation, and that his proposed approximate solution is to

  1. iterate over potential Pb values,
  2. plug each into the equation, and compute the difference between (1) the value that you plugged in and (2) the result from the equation, and
  3. choose the bid price that minimizes the magnitude of that difference.

So you'd go up and down a few ticks from the last bid price (down if your bid was hit, up if your quote was lifted) until minimizing that difference. I think what your implementation is doing is setting the bid price equal to the mean of how the probability distribution would be updated if the bid were hit again, and vice versa for the ask.

Does that make sense? I guess I'm not completely sure that I'm interpreting that correctly, but it did end up producing more realistic values for me.

A couple other things that I don't totally get:

  • Why use volatility as σ instead of the standard deviation between ticks? This was confusing to work through with some real data because it happened in my case that annualized volatility of returns are in the same ballpark as the standard deviation between ticks! I tried checking for like three different instruments; no heuristic solution to this one for me haha
  • After updateDensity I think the distribution needs to be "re-normalized" by making a second pass and diving the probability for each tick by the new integral for the curve, but it's totally possible that I'm missing something.

Btw his 2005 paper explores the same topic, and even includes whole sections verbatim from the 2003 paper, so for anybody else that may end up reading this, it's worth checking out as well.

Cheers!

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.