From 08c75be22ef621bfddbfc26c6a53c79bdc5042d5 Mon Sep 17 00:00:00 2001 From: Joe Schr Date: Tue, 16 Mar 2021 12:45:33 +0100 Subject: [PATCH] fixup(bb88d64): use trade.open_date_utc directly instead of getting tz from DatetimeIndex --- user_data/strategies/fixed_riskreward_loss.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/user_data/strategies/fixed_riskreward_loss.py b/user_data/strategies/fixed_riskreward_loss.py index efd8327..4703247 100644 --- a/user_data/strategies/fixed_riskreward_loss.py +++ b/user_data/strategies/fixed_riskreward_loss.py @@ -50,9 +50,7 @@ class FixedRiskRewardLoss(IStrategy): # using current_time/open_date directly via custom_info_pair[trade.open_daten] # would only work in backtesting/hyperopt. # in live/dry-run, we have to search for nearest row before it - timezone = custom_info_pair.index.tz - open_date = trade.open_date.replace(tzinfo=timezone) - open_date_mask = custom_info_pair.index.unique().get_loc(open_date, method='ffill') + open_date_mask = custom_info_pair.index.unique().get_loc(trade.open_date_utc, method='ffill') open_df = custom_info_pair.iloc[open_date_mask] initial_sl_abs = open_df['stoploss_rate']