Add live trading profit and difference between live trading and backtest profits to report
This commit is contained in:
parent
6f8aaa0c74
commit
ebe3c700c9
@ -44,7 +44,14 @@ for _, backtest in backtest_data.iterrows():
|
||||
close_price = round(spread['Close'], 2)
|
||||
backtest_info[(entry_time, spread_type)] = (short_strike, long_strike, open_price, close_price)
|
||||
|
||||
print(f'**Backtest Profit**: {round(backtest_profit(trade_date), 2)}\n')
|
||||
trade_profits = [100 * (info[2] - info[3]) for info in trade_info.values()]
|
||||
profit = sum(trade_profits)
|
||||
print(f'**Profit**: {round(profit, 2)}')
|
||||
|
||||
profit_backtest = backtest_profit(trade_date)
|
||||
print(f'**Backtest Profit**: {round(profit_backtest, 2)}')
|
||||
|
||||
print(f'**Difference**: {round(profit - profit_backtest, 2)}\n')
|
||||
|
||||
open_differences = [backtest_info[key][2] - trade_info[key][2] for key in trade_info]
|
||||
average_open_difference = sum(open_differences) / len(open_differences) if open_differences else 0
|
||||
|
Loading…
Reference in New Issue
Block a user