I'm coding in python a backtester for trading the Futures markets (equity futures, precious metals, bond futures, etc..). When I open a position long or short, I need to deduct an appropriate amount from the portfolio. I believe this amount should be the margin requirement as calculated by CME's SPAN algorithm.
So in simulated trading, what is best practice to calculate or derive the amount to deduct from the account? (i.e. margin requirement)
Are there any data sources to import this information? (i.e. python modules, SPAN calculators, metadata files, etc..) Quandl provides a metadata file for Futures instruments, but its missing margin requirements.