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
@@ -31,6 +31,7 @@ def trade(events, strategy, portfolio, execution, heartbeat):
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':
@@ -63,7 +64,9 @@ if __name__ == "__main__":
# Create the portfolio object that will be used to
# compare the OANDA positions with the local, to
# ensure backtesting integrity.
portfolio = Portfolio(prices, events, equity=equity)
portfolio = Portfolio(
prices, events, equity=equity, backtest=False
)
# Create the execution handler making sure to
# provide authentication commands