Added the ability for the backtester to use unrealised PnL from the Position objects to calculate a tick-by-tick equity curve. Added a performance directory that calculates drawdown statistics. Modified the output.py script to use Seaborn and output the equity curve, returns and drawdown curve.

This commit is contained in:
Michael Halls-Moore
2015-05-15 13:50:34 +01:00
parent a03bc7a1fb
commit 4380200de7
8 changed files with 137 additions and 28 deletions
+4 -1
View File
@@ -39,6 +39,7 @@ def backtest(
if event is not None:
if event.type == 'TICK':
strategy.calculate_signals(event)
portfolio.update_portfolio(event)
elif event.type == 'SIGNAL':
portfolio.execute_signal(event)
elif event.type == 'ORDER':
@@ -70,7 +71,9 @@ if __name__ == "__main__":
)
# Create the portfolio object to track trades
portfolio = Portfolio(ticker, events, equity=equity)
portfolio = Portfolio(
ticker, events, equity=equity, backtest=True
)
# Create the simulated execution handler
execution = SimulatedExecution()