mmargenot / machine-learning-market-maker Goto Github PK
View Code? Open in Web Editor NEWImplementation of a Bayesian-style market maker in the vein of 'Intelligent Market-Making in Artificial Financial Markets' by Sanmay Das
Implementation of a Bayesian-style market maker in the vein of 'Intelligent Market-Making in Artificial Financial Markets' by Sanmay Das
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.
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
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:
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!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.