test fixed
This commit is contained in:
parent
5e1fb11124
commit
92930b2343
@ -112,7 +112,7 @@ CONF_SCHEMA = {
|
|||||||
'stoploss': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
'stoploss': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
||||||
'stoploss_on_exchange': {'type': 'boolean'}
|
'stoploss_on_exchange': {'type': 'boolean'}
|
||||||
},
|
},
|
||||||
'required': ['buy', 'sell', 'stoploss']
|
'required': ['buy', 'sell', 'stoploss', 'stoploss_on_exchange']
|
||||||
},
|
},
|
||||||
'exchange': {'$ref': '#/definitions/exchange'},
|
'exchange': {'$ref': '#/definitions/exchange'},
|
||||||
'edge': {'$ref': '#/definitions/edge'},
|
'edge': {'$ref': '#/definitions/edge'},
|
||||||
|
@ -375,7 +375,7 @@ def test_validate_order_types(default_conf, mocker):
|
|||||||
type(api_mock).has = PropertyMock(return_value={'createMarketOrder': False})
|
type(api_mock).has = PropertyMock(return_value={'createMarketOrder': False})
|
||||||
mocker.patch('freqtrade.exchange.Exchange._init_ccxt', MagicMock(return_value=api_mock))
|
mocker.patch('freqtrade.exchange.Exchange._init_ccxt', MagicMock(return_value=api_mock))
|
||||||
|
|
||||||
default_conf['order_types'] = {'buy': 'limit', 'sell': 'limit', 'stoploss': 'market'}
|
default_conf['order_types'] = {'buy': 'limit', 'sell': 'limit', 'stoploss': 'market', 'stoploss_on_exchange': 'false'}
|
||||||
|
|
||||||
with pytest.raises(OperationalException,
|
with pytest.raises(OperationalException,
|
||||||
match=r'Exchange .* does not support market orders.'):
|
match=r'Exchange .* does not support market orders.'):
|
||||||
|
@ -188,7 +188,8 @@ def test_strategy_override_order_types(caplog):
|
|||||||
order_types = {
|
order_types = {
|
||||||
'buy': 'market',
|
'buy': 'market',
|
||||||
'sell': 'limit',
|
'sell': 'limit',
|
||||||
'stoploss': 'limit'
|
'stoploss': 'limit',
|
||||||
|
'stoploss_on_exchange': True,
|
||||||
}
|
}
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
@ -198,13 +199,13 @@ def test_strategy_override_order_types(caplog):
|
|||||||
resolver = StrategyResolver(config)
|
resolver = StrategyResolver(config)
|
||||||
|
|
||||||
assert resolver.strategy.order_types
|
assert resolver.strategy.order_types
|
||||||
for method in ['buy', 'sell', 'stoploss']:
|
for method in ['buy', 'sell', 'stoploss', 'stoploss_on_exchange']:
|
||||||
assert resolver.strategy.order_types[method] == order_types[method]
|
assert resolver.strategy.order_types[method] == order_types[method]
|
||||||
|
|
||||||
assert ('freqtrade.strategy.resolver',
|
assert ('freqtrade.strategy.resolver',
|
||||||
logging.INFO,
|
logging.INFO,
|
||||||
"Override strategy 'order_types' with value in config file:"
|
"Override strategy 'order_types' with value in config file:"
|
||||||
" {'buy': 'market', 'sell': 'limit', 'stoploss': 'limit'}."
|
" {'buy': 'market', 'sell': 'limit', 'stoploss': 'limit', 'stoploss_on_exchange': True}."
|
||||||
) in caplog.record_tuples
|
) in caplog.record_tuples
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
@ -262,13 +263,13 @@ def test_call_deprecated_function(result, monkeypatch):
|
|||||||
assert resolver.strategy._sell_fun_len == 2
|
assert resolver.strategy._sell_fun_len == 2
|
||||||
|
|
||||||
indicator_df = resolver.strategy.advise_indicators(result, metadata=metadata)
|
indicator_df = resolver.strategy.advise_indicators(result, metadata=metadata)
|
||||||
assert type(indicator_df) is DataFrame
|
assert isinstance(indicator_df, DataFrame)
|
||||||
assert 'adx' in indicator_df.columns
|
assert 'adx' in indicator_df.columns
|
||||||
|
|
||||||
buydf = resolver.strategy.advise_buy(result, metadata=metadata)
|
buydf = resolver.strategy.advise_buy(result, metadata=metadata)
|
||||||
assert type(buydf) is DataFrame
|
assert isinstance(buydf, DataFrame)
|
||||||
assert 'buy' in buydf.columns
|
assert 'buy' in buydf.columns
|
||||||
|
|
||||||
selldf = resolver.strategy.advise_sell(result, metadata=metadata)
|
selldf = resolver.strategy.advise_sell(result, metadata=metadata)
|
||||||
assert type(selldf) is DataFrame
|
assert isinstance(selldf, DataFrame)
|
||||||
assert 'sell' in selldf
|
assert 'sell' in selldf
|
||||||
|
@ -7,7 +7,7 @@ from pandas import DataFrame
|
|||||||
# Add your lib to import here
|
# Add your lib to import here
|
||||||
import talib.abstract as ta
|
import talib.abstract as ta
|
||||||
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
import freqtrade.vendor.qtpylib.indicators as qtpylib
|
||||||
import numpy # noqa
|
import numpy # noqa
|
||||||
|
|
||||||
|
|
||||||
# This class is a sample. Feel free to customize it.
|
# This class is a sample. Feel free to customize it.
|
||||||
@ -52,7 +52,8 @@ class TestStrategy(IStrategy):
|
|||||||
order_types = {
|
order_types = {
|
||||||
'buy': 'limit',
|
'buy': 'limit',
|
||||||
'sell': 'limit',
|
'sell': 'limit',
|
||||||
'stoploss': 'market'
|
'stoploss': 'market',
|
||||||
|
'stoploss_on_exchange': False
|
||||||
}
|
}
|
||||||
|
|
||||||
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
|
||||||
|
Loading…
Reference in New Issue
Block a user