Cleanup history.py and update documentation
This commit is contained in:
parent
e66fa1cec6
commit
9cedbc1345
@ -184,10 +184,6 @@ optional arguments:
|
|||||||
Specify max_open_trades to use.
|
Specify max_open_trades to use.
|
||||||
--stake_amount STAKE_AMOUNT
|
--stake_amount STAKE_AMOUNT
|
||||||
Specify stake_amount.
|
Specify stake_amount.
|
||||||
-r, --refresh-pairs-cached
|
|
||||||
Refresh the pairs files in tests/testdata with the
|
|
||||||
latest data from the exchange. Use it if you want to
|
|
||||||
run your optimization commands with up-to-date data.
|
|
||||||
--eps, --enable-position-stacking
|
--eps, --enable-position-stacking
|
||||||
Allow buying the same pair multiple times (position
|
Allow buying the same pair multiple times (position
|
||||||
stacking).
|
stacking).
|
||||||
@ -245,10 +241,6 @@ optional arguments:
|
|||||||
Specify max_open_trades to use.
|
Specify max_open_trades to use.
|
||||||
--stake_amount STAKE_AMOUNT
|
--stake_amount STAKE_AMOUNT
|
||||||
Specify stake_amount.
|
Specify stake_amount.
|
||||||
-r, --refresh-pairs-cached
|
|
||||||
Refresh the pairs files in tests/testdata with the
|
|
||||||
latest data from the exchange. Use it if you want to
|
|
||||||
run your optimization commands with up-to-date data.
|
|
||||||
--customhyperopt NAME
|
--customhyperopt NAME
|
||||||
Specify hyperopt class name (default:
|
Specify hyperopt class name (default:
|
||||||
`DefaultHyperOpts`).
|
`DefaultHyperOpts`).
|
||||||
@ -310,10 +302,6 @@ optional arguments:
|
|||||||
Specify max_open_trades to use.
|
Specify max_open_trades to use.
|
||||||
--stake_amount STAKE_AMOUNT
|
--stake_amount STAKE_AMOUNT
|
||||||
Specify stake_amount.
|
Specify stake_amount.
|
||||||
-r, --refresh-pairs-cached
|
|
||||||
Refresh the pairs files in tests/testdata with the
|
|
||||||
latest data from the exchange. Use it if you want to
|
|
||||||
run your optimization commands with up-to-date data.
|
|
||||||
--stoplosses STOPLOSS_RANGE
|
--stoplosses STOPLOSS_RANGE
|
||||||
Defines a range of stoploss against which edge will
|
Defines a range of stoploss against which edge will
|
||||||
assess the strategy the format is "min,max,step"
|
assess the strategy the format is "min,max,step"
|
||||||
|
@ -4,7 +4,7 @@ This page contains description of the command line arguments, configuration para
|
|||||||
and the bot features that were declared as DEPRECATED by the bot development team
|
and the bot features that were declared as DEPRECATED by the bot development team
|
||||||
and are no longer supported. Please avoid their usage in your configuration.
|
and are no longer supported. Please avoid their usage in your configuration.
|
||||||
|
|
||||||
## Deprecated
|
## Removed features
|
||||||
|
|
||||||
### the `--refresh-pairs-cached` command line option
|
### the `--refresh-pairs-cached` command line option
|
||||||
|
|
||||||
@ -12,9 +12,7 @@ and are no longer supported. Please avoid their usage in your configuration.
|
|||||||
Since this leads to much confusion, and slows down backtesting (while not being part of backtesting) this has been singled out
|
Since this leads to much confusion, and slows down backtesting (while not being part of backtesting) this has been singled out
|
||||||
as a seperate freqtrade subcommand `freqtrade download-data`.
|
as a seperate freqtrade subcommand `freqtrade download-data`.
|
||||||
|
|
||||||
This command line option was deprecated in `2019.7-dev` and will be removed after the next release.
|
This command line option was deprecated in `2019.7-dev` and removed in `2019-9`
|
||||||
|
|
||||||
## Removed features
|
|
||||||
|
|
||||||
### The **--dynamic-whitelist** command line option
|
### The **--dynamic-whitelist** command line option
|
||||||
|
|
||||||
|
@ -129,8 +129,7 @@ def load_pair_history(pair: str,
|
|||||||
else:
|
else:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f'No history data for pair: "{pair}", interval: {ticker_interval}. '
|
f'No history data for pair: "{pair}", interval: {ticker_interval}. '
|
||||||
'Use --refresh-pairs-cached option or `freqtrade download-data` '
|
'Use `freqtrade download-data` to download the data'
|
||||||
'script to download the data'
|
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -142,33 +141,21 @@ def load_data(datadir: Path,
|
|||||||
exchange: Optional[Exchange] = None,
|
exchange: Optional[Exchange] = None,
|
||||||
timerange: TimeRange = TimeRange(None, None, 0, 0),
|
timerange: TimeRange = TimeRange(None, None, 0, 0),
|
||||||
fill_up_missing: bool = True,
|
fill_up_missing: bool = True,
|
||||||
live: bool = False
|
|
||||||
) -> Dict[str, DataFrame]:
|
) -> Dict[str, DataFrame]:
|
||||||
"""
|
"""
|
||||||
Loads ticker history data for a list of pairs the given parameters
|
Loads ticker history data for a list of pairs the given parameters
|
||||||
:return: dict(<pair>:<tickerlist>)
|
:return: dict(<pair>:<tickerlist>)
|
||||||
"""
|
"""
|
||||||
result: Dict[str, DataFrame] = {}
|
result: Dict[str, DataFrame] = {}
|
||||||
if live:
|
|
||||||
if exchange:
|
|
||||||
logger.info('Live: Downloading data for all defined pairs ...')
|
|
||||||
exchange.refresh_latest_ohlcv([(pair, ticker_interval) for pair in pairs])
|
|
||||||
result = {key[0]: value for key, value in exchange._klines.items() if value is not None}
|
|
||||||
else:
|
|
||||||
raise OperationalException(
|
|
||||||
"Exchange needs to be initialized when using live data."
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
logger.info('Using local backtesting data ...')
|
|
||||||
|
|
||||||
for pair in pairs:
|
for pair in pairs:
|
||||||
hist = load_pair_history(pair=pair, ticker_interval=ticker_interval,
|
hist = load_pair_history(pair=pair, ticker_interval=ticker_interval,
|
||||||
datadir=datadir, timerange=timerange,
|
datadir=datadir, timerange=timerange,
|
||||||
refresh_pairs=refresh_pairs,
|
refresh_pairs=refresh_pairs,
|
||||||
exchange=exchange,
|
exchange=exchange,
|
||||||
fill_up_missing=fill_up_missing)
|
fill_up_missing=fill_up_missing)
|
||||||
if hist is not None:
|
if hist is not None:
|
||||||
result[pair] = hist
|
result[pair] = hist
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,31 +131,6 @@ def test_load_data_with_new_pair_1min(ticker_history_list, mocker, caplog,
|
|||||||
_clean_test_file(file)
|
_clean_test_file(file)
|
||||||
|
|
||||||
|
|
||||||
def test_load_data_live(default_conf, mocker, caplog, testdatadir) -> None:
|
|
||||||
refresh_mock = MagicMock()
|
|
||||||
mocker.patch("freqtrade.exchange.Exchange.refresh_latest_ohlcv", refresh_mock)
|
|
||||||
exchange = get_patched_exchange(mocker, default_conf)
|
|
||||||
|
|
||||||
history.load_data(datadir=testdatadir, ticker_interval='5m',
|
|
||||||
pairs=['UNITTEST/BTC', 'UNITTEST2/BTC'],
|
|
||||||
live=True,
|
|
||||||
exchange=exchange)
|
|
||||||
assert refresh_mock.call_count == 1
|
|
||||||
assert len(refresh_mock.call_args_list[0][0][0]) == 2
|
|
||||||
assert log_has('Live: Downloading data for all defined pairs ...', caplog)
|
|
||||||
|
|
||||||
|
|
||||||
def test_load_data_live_noexchange(default_conf, mocker, caplog, testdatadir) -> None:
|
|
||||||
|
|
||||||
with pytest.raises(OperationalException,
|
|
||||||
match=r'Exchange needs to be initialized when using live data.'):
|
|
||||||
history.load_data(datadir=testdatadir, ticker_interval='5m',
|
|
||||||
pairs=['UNITTEST/BTC', 'UNITTEST2/BTC'],
|
|
||||||
exchange=None,
|
|
||||||
live=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_testdata_path(testdatadir) -> None:
|
def test_testdata_path(testdatadir) -> None:
|
||||||
assert str(Path('tests') / 'testdata') in str(testdatadir)
|
assert str(Path('tests') / 'testdata') in str(testdatadir)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user