Merge pull request #2904 from hroff-1902/fix/tests_backtesting_container

Minor: Fix usage of an item from BTContainer in tests
This commit is contained in:
Matthias 2020-02-11 07:02:28 +01:00 committed by GitHub
commit 57fcca9696
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
from typing import Dict, List, NamedTuple from typing import Dict, List, NamedTuple, Optional
import arrow import arrow
from pandas import DataFrame from pandas import DataFrame
@ -30,7 +30,7 @@ class BTContainer(NamedTuple):
profit_perc: float profit_perc: float
trailing_stop: bool = False trailing_stop: bool = False
trailing_only_offset_is_reached: bool = False trailing_only_offset_is_reached: bool = False
trailing_stop_positive: float = None trailing_stop_positive: Optional[float] = None
trailing_stop_positive_offset: float = 0.0 trailing_stop_positive_offset: float = 0.0
use_sell_signal: bool = False use_sell_signal: bool = False

View File

@ -364,7 +364,7 @@ def test_backtest_results(default_conf, fee, mocker, caplog, data) -> None:
default_conf["trailing_stop"] = data.trailing_stop default_conf["trailing_stop"] = data.trailing_stop
default_conf["trailing_only_offset_is_reached"] = data.trailing_only_offset_is_reached default_conf["trailing_only_offset_is_reached"] = data.trailing_only_offset_is_reached
# Only add this to configuration If it's necessary # Only add this to configuration If it's necessary
if data.trailing_stop_positive: if data.trailing_stop_positive is not None:
default_conf["trailing_stop_positive"] = data.trailing_stop_positive default_conf["trailing_stop_positive"] = data.trailing_stop_positive
default_conf["trailing_stop_positive_offset"] = data.trailing_stop_positive_offset default_conf["trailing_stop_positive_offset"] = data.trailing_stop_positive_offset
default_conf["ask_strategy"] = {"use_sell_signal": data.use_sell_signal} default_conf["ask_strategy"] = {"use_sell_signal": data.use_sell_signal}