I'm trying to create a simple backtester on python which allows me to assess the performance of a trading strategy. As part of the backtester, I need to record the transactions which occur. E.g.,
Day Stock Action Quantity
1 AAPL BUY 20
2 CSCO SELL 30
2 AMZN SELL 50
During the trading simulation, I'll need to add more transactions.
What's the most efficient way to do this. Should I create a transactions list at the start of the simulation and append lists such as [5, 'AAPL', 'BUY', 20] as I go. Should I instead use a dictionary, or a numpy array? Or just a Pandas DataFrame directly?
Thanks,
Jack
['a', 'b', 'c', 'd'], for instance.