Fix some tests
This commit is contained in:
@@ -233,12 +233,12 @@ class Backtesting:
|
||||
|
||||
if not pair_data.empty:
|
||||
# Cleanup from prior runs
|
||||
pair_data.loc[:, 'buy'] = 0 # TODO: Should be renamed to enter_long
|
||||
pair_data.loc[:, 'enter_long'] = 0
|
||||
pair_data.loc[:, 'enter_short'] = 0
|
||||
pair_data.loc[:, 'sell'] = 0 # TODO: should be renamed to exit_long
|
||||
pair_data.loc[:, 'exit_long'] = 0
|
||||
pair_data.loc[:, 'exit_short'] = 0
|
||||
pair_data.loc[:, 'long_tag'] = None # cleanup if buy_tag is exist
|
||||
pair_data.loc[:, 'short_tag'] = None # cleanup if short_tag is exist
|
||||
pair_data.loc[:, 'long_tag'] = None
|
||||
pair_data.loc[:, 'short_tag'] = None
|
||||
|
||||
df_analyzed = self.strategy.advise_sell(
|
||||
self.strategy.advise_buy(pair_data, {'pair': pair}),
|
||||
@@ -255,8 +255,6 @@ class Backtesting:
|
||||
df_analyzed.loc[:, 'exit_short'] = df_analyzed.loc[:, 'exit_short'].shift(1)
|
||||
df_analyzed.loc[:, 'long_tag'] = df_analyzed.loc[:, 'long_tag'].shift(1)
|
||||
|
||||
df_analyzed.drop(df_analyzed.head(1).index, inplace=True)
|
||||
|
||||
# Update dataprovider cache
|
||||
self.dataprovider._set_cached_df(pair, self.timeframe, df_analyzed)
|
||||
|
||||
|
@@ -871,7 +871,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
||||
return df
|
||||
|
||||
def leverage(self, pair: str, current_time: datetime, current_rate: float,
|
||||
proposed_leverage: float, max_leverage: float,
|
||||
proposed_leverage: float, max_leverage: float, side: str,
|
||||
**kwargs) -> float:
|
||||
"""
|
||||
Customize leverage for each new trade. This method is not called when edge module is
|
||||
@@ -882,6 +882,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
||||
:param current_rate: Rate, calculated based on pricing settings in ask_strategy.
|
||||
:param proposed_leverage: A leverage proposed by the bot.
|
||||
:param max_leverage: Max leverage allowed on this pair
|
||||
:param side: 'long' or 'short' - indicating the direction of the proposed trade
|
||||
:return: A leverage amount, which is between 1.0 and max_leverage.
|
||||
"""
|
||||
return 1.0
|
||||
|
Reference in New Issue
Block a user