Collect 5 hours of SH and SDS data (frequency was 10 seconds, now updated to shorter interval) from Interactive Broker.
Explore the states of cointegration residual and imbalances. (Please change the number of hours in "df_flip.time+=timedelta(hours=5)" based on the data length.)
Construct the transition matrix given residual and imbalance states.
Compute the micro price of SH and SDS.
- 1st simulation: simulate prices given the transition matrix.
- 2nd simulation: simulate expected price movement for each state.
- Plot the difference between Markov adjustment and simulated price movement.
- Plot imbalance vs exp price movement for Markov estimation and simulation, given or averaging the other imbalance state.
A simulated trading based on artificially defined trasition matrices. Can be used as a toy model.
Four execution algos with training and testing results.