Fix 2 bugs in ROI calculation

This commit is contained in:
Matthias
2022-03-16 19:50:25 +01:00
parent 298797cbfd
commit a89c1da19f
2 changed files with 2 additions and 2 deletions

View File

@@ -429,7 +429,7 @@ class Backtesting:
# - (Expected abs profit - open_rate - open_fee) / (fee_close -1)
roi_rate = trade.open_rate * roi / leverage
open_fee_rate = side_1 * trade.open_rate * (1 + side_1 * trade.fee_open)
close_rate = -side_1 * (roi_rate + open_fee_rate) / (trade.fee_close - side_1 * 1)
close_rate = -(roi_rate + open_fee_rate) / (trade.fee_close - side_1 * 1)
if is_short:
is_new_roi = sell_row[OPEN_IDX] < close_rate
else: