fix mypy and tests
This commit is contained in:
parent
19b9966417
commit
2e6e5029ba
@ -230,7 +230,7 @@ class Backtesting(object):
|
|||||||
pair_data['buy'], pair_data['sell'] = 0, 0 # cleanup from previous run
|
pair_data['buy'], pair_data['sell'] = 0, 0 # cleanup from previous run
|
||||||
|
|
||||||
ticker_data = self.populate_sell_trend(
|
ticker_data = self.populate_sell_trend(
|
||||||
self.populate_buy_trend(pair_data))[headers].copy()
|
self.populate_buy_trend(pair_data, pair), pair)[headers].copy()
|
||||||
|
|
||||||
# to avoid using data from future, we buy/sell with signal from previous candle
|
# to avoid using data from future, we buy/sell with signal from previous candle
|
||||||
ticker_data.loc[:, 'buy'] = ticker_data['buy'].shift(1)
|
ticker_data.loc[:, 'buy'] = ticker_data['buy'].shift(1)
|
||||||
|
@ -146,7 +146,7 @@ def _trend(signals, buy_value, sell_value):
|
|||||||
return signals
|
return signals
|
||||||
|
|
||||||
|
|
||||||
def _trend_alternate(dataframe=None):
|
def _trend_alternate(dataframe=None, pair=None):
|
||||||
signals = dataframe
|
signals = dataframe
|
||||||
low = signals['low']
|
low = signals['low']
|
||||||
n = len(low)
|
n = len(low)
|
||||||
@ -623,7 +623,7 @@ def test_backtest_ticks(default_conf, fee, mocker):
|
|||||||
|
|
||||||
def test_backtest_clash_buy_sell(mocker, default_conf):
|
def test_backtest_clash_buy_sell(mocker, default_conf):
|
||||||
# Override the default buy trend function in our default_strategy
|
# Override the default buy trend function in our default_strategy
|
||||||
def fun(dataframe=None):
|
def fun(dataframe=None, pair=None):
|
||||||
buy_value = 1
|
buy_value = 1
|
||||||
sell_value = 1
|
sell_value = 1
|
||||||
return _trend(dataframe, buy_value, sell_value)
|
return _trend(dataframe, buy_value, sell_value)
|
||||||
@ -638,7 +638,7 @@ def test_backtest_clash_buy_sell(mocker, default_conf):
|
|||||||
|
|
||||||
def test_backtest_only_sell(mocker, default_conf):
|
def test_backtest_only_sell(mocker, default_conf):
|
||||||
# Override the default buy trend function in our default_strategy
|
# Override the default buy trend function in our default_strategy
|
||||||
def fun(dataframe=None):
|
def fun(dataframe=None, pair=None):
|
||||||
buy_value = 0
|
buy_value = 0
|
||||||
sell_value = 1
|
sell_value = 1
|
||||||
return _trend(dataframe, buy_value, sell_value)
|
return _trend(dataframe, buy_value, sell_value)
|
||||||
|
Loading…
Reference in New Issue
Block a user