rename --timeperiod to --timerange
This commit is contained in:
parent
f61012097c
commit
71bb348698
@ -52,12 +52,12 @@ python3 ./freqtrade/main.py backtesting --datadir freqtrade/tests/testdata-20180
|
|||||||
```
|
```
|
||||||
|
|
||||||
**Running backtest with smaller testset**
|
**Running backtest with smaller testset**
|
||||||
Use the --timeperiod argument to change how much of the testset
|
Use the --timerange argument to change how much of the testset
|
||||||
you want to use. The last N ticks/timeframes will be used.
|
you want to use. The last N ticks/timeframes will be used.
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 ./freqtrade/main.py backtesting --timeperiod -200
|
python3 ./freqtrade/main.py backtesting --timerange -200
|
||||||
```
|
```
|
||||||
|
|
||||||
**Update testdata directory
|
**Update testdata directory
|
||||||
|
@ -191,11 +191,11 @@ def build_subcommands(parser: argparse.ArgumentParser) -> None:
|
|||||||
dest='refresh_pairs',
|
dest='refresh_pairs',
|
||||||
)
|
)
|
||||||
backtesting_cmd.add_argument(
|
backtesting_cmd.add_argument(
|
||||||
'--timeperiod',
|
'--timerange',
|
||||||
help='Use the last N ticks of data.',
|
help='Use the last N ticks of data.',
|
||||||
default=None,
|
default=None,
|
||||||
type=int,
|
type=int,
|
||||||
dest='timeperiod',
|
dest='timerange',
|
||||||
)
|
)
|
||||||
|
|
||||||
# Add hyperopt subcommand
|
# Add hyperopt subcommand
|
||||||
@ -224,11 +224,11 @@ def build_subcommands(parser: argparse.ArgumentParser) -> None:
|
|||||||
metavar='INT',
|
metavar='INT',
|
||||||
)
|
)
|
||||||
hyperopt_cmd.add_argument(
|
hyperopt_cmd.add_argument(
|
||||||
'-tp', '--timeperiod',
|
'-tp', '--timerange',
|
||||||
help='Use the last N ticks of data.',
|
help='Use the last N ticks of data.',
|
||||||
default=None,
|
default=None,
|
||||||
type=int,
|
type=int,
|
||||||
dest='timeperiod',
|
dest='timerange',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,9 +68,9 @@ def load_data(datadir: str, ticker_interval: int = 5, pairs: Optional[List[str]]
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def tickerdata_to_dataframe(data, timeperiod=None):
|
def tickerdata_to_dataframe(data, timerange=None):
|
||||||
if timeperiod:
|
if timerange:
|
||||||
data = trim_tickerlist(data, timeperiod)
|
data = trim_tickerlist(data, timerange)
|
||||||
preprocessed = preprocess(data)
|
preprocessed = preprocess(data)
|
||||||
return preprocessed
|
return preprocessed
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ def start(args):
|
|||||||
from freqtrade import main
|
from freqtrade import main
|
||||||
main._CONF = config
|
main._CONF = config
|
||||||
|
|
||||||
preprocessed = optimize.tickerdata_to_dataframe(data, timeperiod=args.timeperiod)
|
preprocessed = optimize.tickerdata_to_dataframe(data, timerange=args.timerange)
|
||||||
# Print timeframe
|
# Print timeframe
|
||||||
min_date, max_date = get_timeframe(preprocessed)
|
min_date, max_date = get_timeframe(preprocessed)
|
||||||
logger.info('Measuring data from %s up to %s ...', min_date.isoformat(), max_date.isoformat())
|
logger.info('Measuring data from %s up to %s ...', min_date.isoformat(), max_date.isoformat())
|
||||||
|
@ -260,7 +260,7 @@ def start(args):
|
|||||||
config = load_config(args.config)
|
config = load_config(args.config)
|
||||||
pairs = config['exchange']['pair_whitelist']
|
pairs = config['exchange']['pair_whitelist']
|
||||||
data = optimize.load_data(args.datadir, pairs=pairs, ticker_interval=args.ticker_interval)
|
data = optimize.load_data(args.datadir, pairs=pairs, ticker_interval=args.ticker_interval)
|
||||||
PROCESSED = optimize.tickerdata_to_dataframe(data, timeperiod=args.timeperiod)
|
PROCESSED = optimize.tickerdata_to_dataframe(data, timerange=args.timerange)
|
||||||
|
|
||||||
if args.mongodb:
|
if args.mongodb:
|
||||||
logger.info('Using mongodb ...')
|
logger.info('Using mongodb ...')
|
||||||
|
@ -159,7 +159,7 @@ def test_backtest_start(default_conf, mocker, caplog):
|
|||||||
args.level = 10
|
args.level = 10
|
||||||
args.live = False
|
args.live = False
|
||||||
args.datadir = None
|
args.datadir = None
|
||||||
args.timeperiod = None # needed due to MagicMock malleability
|
args.timerange = None # needed due to MagicMock malleability
|
||||||
backtesting.start(args)
|
backtesting.start(args)
|
||||||
# check the logs, that will contain the backtest result
|
# check the logs, that will contain the backtest result
|
||||||
exists = ['Using max_open_trades: 1 ...',
|
exists = ['Using max_open_trades: 1 ...',
|
||||||
|
@ -179,5 +179,5 @@ def test_load_tickerdata_file():
|
|||||||
def test_tickerdata_to_dataframe():
|
def test_tickerdata_to_dataframe():
|
||||||
tick = load_tickerdata_file(None, 'BTC_UNITEST', 1)
|
tick = load_tickerdata_file(None, 'BTC_UNITEST', 1)
|
||||||
tickerlist = {'BTC_UNITEST': tick}
|
tickerlist = {'BTC_UNITEST': tick}
|
||||||
data = optimize.tickerdata_to_dataframe(tickerlist, timeperiod=-100)
|
data = optimize.tickerdata_to_dataframe(tickerlist, timerange=-100)
|
||||||
assert 100 == len(data['BTC_UNITEST'])
|
assert 100 == len(data['BTC_UNITEST'])
|
||||||
|
Loading…
Reference in New Issue
Block a user