Lint fixes (#236)
* correct docstring * add type annotation to trade_count_lock * fix indentations * allow globals in hyperopt.py * fix import order * simplify asserts * use proper variable name * simplify condition * fix path operation that fails on windows
This commit is contained in:
committed by
Michael Egger
parent
9959d53f5e
commit
de33d69eed
@@ -58,7 +58,7 @@ def preprocess(tickerdata: Dict[str, List]) -> Dict[str, DataFrame]:
|
||||
|
||||
def testdata_path() -> str:
|
||||
"""Return the path where testdata files are stored"""
|
||||
return os.path.abspath(os.path.dirname(__file__)) + '/../tests/testdata'
|
||||
return os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'tests', 'testdata'))
|
||||
|
||||
|
||||
def download_pairs(pairs: List[str]) -> bool:
|
||||
|
@@ -68,14 +68,14 @@ def backtest(stake_amount: float, processed: Dict[str, DataFrame],
|
||||
max_open_trades: int = 0, realistic: bool = True) -> DataFrame:
|
||||
"""
|
||||
Implements backtesting functionality
|
||||
:param config: config to use
|
||||
:param stake_amount: btc amount to use for each trade
|
||||
:param processed: a processed dictionary with format {pair, data}
|
||||
:param max_open_trades: maximum number of concurrent trades (default: 0, disabled)
|
||||
:param realistic: do we try to simulate realistic trades? (default: True)
|
||||
:return: DataFrame
|
||||
"""
|
||||
trades = []
|
||||
trade_count_lock = {}
|
||||
trade_count_lock: dict = {}
|
||||
exchange._API = Bittrex({'key': '', 'secret': ''})
|
||||
for pair, pair_data in processed.items():
|
||||
pair_data['buy'], pair_data['sell'] = 0, 0
|
||||
@@ -120,7 +120,7 @@ def backtest(stake_amount: float, processed: Dict[str, DataFrame],
|
||||
current_profit_percent,
|
||||
current_profit_BTC,
|
||||
row2.Index - row.Index
|
||||
)
|
||||
)
|
||||
)
|
||||
break
|
||||
labels = ['currency', 'profit_percent', 'profit_BTC', 'duration']
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# pragma pylint: disable=missing-docstring,W0212
|
||||
# pragma pylint: disable=missing-docstring,W0212,W0603
|
||||
|
||||
|
||||
import json
|
||||
@@ -159,7 +159,7 @@ def format_results(results: DataFrame):
|
||||
results.profit_percent.mean() * 100.0,
|
||||
results.profit_BTC.sum(),
|
||||
results.duration.mean() * 5,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def buy_strategy_generator(params):
|
||||
|
Reference in New Issue
Block a user