Add fees and commissions to trade report
This commit is contained in:
parent
ebe3c700c9
commit
64e632d9a2
@ -3,6 +3,7 @@ from database.procedures import backtest_profit, most_recent_trade_date
|
|||||||
from database.trades import trades
|
from database.trades import trades
|
||||||
|
|
||||||
symbol = 'SPX'
|
symbol = 'SPX'
|
||||||
|
fees_and_commissions = 3.19 # IBKR fees and commissions for a single spread trade.
|
||||||
|
|
||||||
trade_date = most_recent_trade_date()
|
trade_date = most_recent_trade_date()
|
||||||
print(f'# {trade_date.strftime("%B %d, %Y")}\n')
|
print(f'# {trade_date.strftime("%B %d, %Y")}\n')
|
||||||
@ -44,8 +45,9 @@ for _, backtest in backtest_data.iterrows():
|
|||||||
close_price = round(spread['Close'], 2)
|
close_price = round(spread['Close'], 2)
|
||||||
backtest_info[(entry_time, spread_type)] = (short_strike, long_strike, open_price, close_price)
|
backtest_info[(entry_time, spread_type)] = (short_strike, long_strike, open_price, close_price)
|
||||||
|
|
||||||
trade_profits = [100 * (info[2] - info[3]) for info in trade_info.values()]
|
trade_profits = [100 * (info[2] - info[3]) - fees_and_commissions for info in trade_info.values()]
|
||||||
profit = sum(trade_profits)
|
stopped_out_spreads = sum(1 for info in trade_info.values() if info[5] is not None)
|
||||||
|
profit = sum(trade_profits) - (stopped_out_spreads * fees_and_commissions)
|
||||||
print(f'**Profit**: {round(profit, 2)}')
|
print(f'**Profit**: {round(profit, 2)}')
|
||||||
|
|
||||||
profit_backtest = backtest_profit(trade_date)
|
profit_backtest = backtest_profit(trade_date)
|
||||||
|
Loading…
Reference in New Issue
Block a user