Let say that I have access to continuous daily time series for 20+ years of data for E-mini S&P 500 Index Futures. I have a long/short strategy to backtest that places orders either on open or close. The management of the margin has an impact over the performance of the backtest and I am unsure about how to model the margin.
- How to model margin calls? E.g. is it best practice to use the whole capital to buy as many contract as possible, or buy contracts using half capital and to invest the remaining half in treasury bonds to be used as collateral in case of margin calls?
- How to model interest rate on margin? E.g. is it best practice to assume no interest rate on margin or to use the 3 month t-bill rate?
- How to model margin withdrawals? E.g. is it best practice to assume to reinvest the excess on margin in new contracts whenever possible?
A potential solution for points 1 and 3 could be to assume to restore the margin to the initial margin at the end of day and to reinvest the excess liquidity in new contracts or to sell contracts when liquidity is needed to restore the margin.
The answer should target the best practices while not being too much error prone to be implemented in python and fairly representative of the historical performance.