This is some stuff I wrote for myself to help automate backtesting trading. Feel free to use it as you need.