How to simulate market data and test strategies?

I am trying to implement my own exchange with simulated data and test some strategies on such data. What would be the best way to go about modelling the data that supports live interaction ( limit/market orders ) executed by my bot?

Simulating data on it's own seems easy, I can simulate bid and ask separetely using real world data, extrapolating prices from that and adding a probability distribution on top of it. But I am not certain how to adjust data given that I will be directly impacting the order books in somewhat realistic way.

• What are you trying to achieve with this setup? – vonjd Aug 4 '19 at 16:56
• Its more of a learning project. Just would like to simulate an exchange and try to implement some strategies for it. – Paul Aug 4 '19 at 17:06
• Ok... so what exactly are you trying to learn then? – vonjd Aug 4 '19 at 17:07
• Smart order routing, reinforcement learning and efficient implementation of order books. Also some common models to simulate market data. I have seen a few papers on those but I am not certain how to implement them and actually trade myself without breaking them – Paul Aug 4 '19 at 17:11
• You are going to have a very hard time trying to solve this. Try to pipe in crypto exhange data, which is much easier to acquire. – jason m Aug 5 '19 at 1:44

I have never used it but I believe Quantopian introduces this kind of concept as a trading drag in its back testing, essentially as an additional cost to transactions. Market impact is often empirically stated as $$k\sqrt{V}$$, i.e. some value (a constant or value dependent upon volatiliy and average volume) multiplied by the root of your volume.
• By $k\sqrt{v}$ are you referring to sigma-root-liquidity model? Are there any papers on back testing I can look into? – Paul Aug 11 '19 at 18:56