Add pair_trades_filename

This commit is contained in:
Matthias 2019-08-14 18:58:27 +02:00
parent 6697b677dc
commit 63e87ef85b
2 changed files with 13 additions and 0 deletions

View File

@ -173,6 +173,12 @@ def pair_data_filename(datadir: Path, pair: str, ticker_interval: str) -> Path:
return filename
def pair_trades_filename(datadir: Path, pair: str) -> Path:
pair_s = pair.replace("/", "_")
filename = datadir.joinpath(f'{pair_s}-trades.json')
return filename
def _load_cached_data_for_updating(datadir: Path, pair: str, ticker_interval: str,
timerange: Optional[TimeRange]) -> Tuple[List[Any],
Optional[int]]:

View File

@ -17,6 +17,7 @@ from freqtrade.data.history import (download_pair_history,
_load_cached_data_for_updating,
refresh_backtest_ohlcv_data,
load_tickerdata_file, pair_data_filename,
pair_trades_filename,
trim_tickerlist)
from freqtrade.exchange import timeframe_to_minutes
from freqtrade.misc import file_dump_json
@ -141,6 +142,12 @@ def test_pair_data_filename():
assert fn == Path('freqtrade/hello/world/ETH_BTC-5m.json')
def test_pair_trades_filename():
fn = pair_trades_filename(Path('freqtrade/hello/world'), 'ETH/BTC', '5m')
assert isinstance(fn, Path)
assert fn == Path('freqtrade/hello/world/ETH_BTC-trades.json')
def test_load_cached_data_for_updating(mocker) -> None:
datadir = Path(__file__).parent.parent.joinpath('testdata')