Export guides

How to export backtesting.py trades

Save the backtesting.py trades table as CSV with pandas and upload it to the audit.

The file you get

A .csv with the columns Size, EntryBar, ExitBar, EntryPrice, ExitPrice and PnL.

Steps

  1. Run the backtest: stats = Backtest(...).run()
  2. Save the trades: stats._trades.to_csv('trades.csv')

Where to upload it

In the field 'Your platform report'.

Before you upload

  • Do not rename the columns: that is how the format is recognised.
  • If your version includes the Commission column, the audit uses it as a Measured cost.
  • This file does not say how much capital you started with: type it in 'Starting balance'. Without it the audit assumes 10,000 and says so in the report.
  • The file only holds closed trades: the floating drawdown inside each trade is reported as Not measured.