cosmetic: rename interval, tick_interval, etc --> ticker_interval
This commit is contained in:
@@ -92,18 +92,18 @@ for pair in PAIRS:
|
||||
pairs_not_available.append(pair)
|
||||
print(f"skipping pair {pair}")
|
||||
continue
|
||||
for tick_interval in timeframes:
|
||||
for ticker_interval in timeframes:
|
||||
pair_print = pair.replace('/', '_')
|
||||
filename = f'{pair_print}-{tick_interval}.json'
|
||||
filename = f'{pair_print}-{ticker_interval}.json'
|
||||
dl_file = dl_path.joinpath(filename)
|
||||
if args.erase and dl_file.exists():
|
||||
print(f'Deleting existing data for pair {pair}, interval {tick_interval}')
|
||||
print(f'Deleting existing data for pair {pair}, interval {ticker_interval}')
|
||||
dl_file.unlink()
|
||||
|
||||
print(f'downloading pair {pair}, interval {tick_interval}')
|
||||
print(f'downloading pair {pair}, interval {ticker_interval}')
|
||||
download_pair_history(datadir=dl_path, exchange=exchange,
|
||||
pair=pair,
|
||||
tick_interval=tick_interval,
|
||||
ticker_interval=ticker_interval,
|
||||
timerange=timerange)
|
||||
|
||||
|
||||
|
@@ -82,7 +82,7 @@ def load_trades(args: Namespace, pair: str, timerange: TimeRange) -> pd.DataFram
|
||||
return trades
|
||||
|
||||
|
||||
def generate_plot_file(fig, pair, tick_interval, is_last) -> None:
|
||||
def generate_plot_file(fig, pair, ticker_interval, is_last) -> None:
|
||||
"""
|
||||
Generate a plot html file from pre populated fig plotly object
|
||||
:return: None
|
||||
@@ -90,7 +90,7 @@ def generate_plot_file(fig, pair, tick_interval, is_last) -> None:
|
||||
logger.info('Generate plot file for %s', pair)
|
||||
|
||||
pair_name = pair.replace("/", "_")
|
||||
file_name = 'freqtrade-plot-' + pair_name + '-' + tick_interval + '.html'
|
||||
file_name = 'freqtrade-plot-' + pair_name + '-' + ticker_interval + '.html'
|
||||
|
||||
Path("user_data/plots").mkdir(parents=True, exist_ok=True)
|
||||
|
||||
@@ -135,20 +135,20 @@ def get_tickers_data(strategy, exchange, pairs: List[str], args):
|
||||
:return: dictinnary of tickers. output format: {'pair': tickersdata}
|
||||
"""
|
||||
|
||||
tick_interval = strategy.ticker_interval
|
||||
ticker_interval = strategy.ticker_interval
|
||||
timerange = Arguments.parse_timerange(args.timerange)
|
||||
|
||||
tickers = {}
|
||||
if args.live:
|
||||
logger.info('Downloading pairs.')
|
||||
exchange.refresh_latest_ohlcv([(pair, tick_interval) for pair in pairs])
|
||||
exchange.refresh_latest_ohlcv([(pair, ticker_interval) for pair in pairs])
|
||||
for pair in pairs:
|
||||
tickers[pair] = exchange.klines((pair, tick_interval))
|
||||
tickers[pair] = exchange.klines((pair, ticker_interval))
|
||||
else:
|
||||
tickers = history.load_data(
|
||||
datadir=Path(str(_CONF.get("datadir"))),
|
||||
pairs=pairs,
|
||||
ticker_interval=tick_interval,
|
||||
ticker_interval=ticker_interval,
|
||||
refresh_pairs=_CONF.get('refresh_pairs', False),
|
||||
timerange=timerange,
|
||||
exchange=Exchange(_CONF)
|
||||
@@ -399,7 +399,7 @@ def analyse_and_plot_pairs(args: Namespace):
|
||||
strategy, exchange, pairs = get_trading_env(args)
|
||||
# Set timerange to use
|
||||
timerange = Arguments.parse_timerange(args.timerange)
|
||||
tick_interval = strategy.ticker_interval
|
||||
ticker_interval = strategy.ticker_interval
|
||||
|
||||
tickers = get_tickers_data(strategy, exchange, pairs, args)
|
||||
pair_counter = 0
|
||||
@@ -422,7 +422,7 @@ def analyse_and_plot_pairs(args: Namespace):
|
||||
)
|
||||
|
||||
is_last = (False, True)[pair_counter == len(tickers)]
|
||||
generate_plot_file(fig, pair, tick_interval, is_last)
|
||||
generate_plot_file(fig, pair, ticker_interval, is_last)
|
||||
|
||||
logger.info('End of ploting process %s plots generated', pair_counter)
|
||||
|
||||
|
@@ -76,7 +76,7 @@ def plot_profit(args: Namespace) -> None:
|
||||
in helping out to find a good algorithm.
|
||||
"""
|
||||
|
||||
# We need to use the same pairs, same tick_interval
|
||||
# We need to use the same pairs, same ticker_interval
|
||||
# and same timeperiod as used in backtesting
|
||||
# to match the tickerdata against the profits-results
|
||||
timerange = Arguments.parse_timerange(args.timerange)
|
||||
@@ -112,7 +112,7 @@ def plot_profit(args: Namespace) -> None:
|
||||
else:
|
||||
filter_pairs = config['exchange']['pair_whitelist']
|
||||
|
||||
tick_interval = strategy.ticker_interval
|
||||
ticker_interval = strategy.ticker_interval
|
||||
pairs = config['exchange']['pair_whitelist']
|
||||
|
||||
if filter_pairs:
|
||||
@@ -122,7 +122,7 @@ def plot_profit(args: Namespace) -> None:
|
||||
tickers = history.load_data(
|
||||
datadir=Path(str(config.get('datadir'))),
|
||||
pairs=pairs,
|
||||
ticker_interval=tick_interval,
|
||||
ticker_interval=ticker_interval,
|
||||
refresh_pairs=False,
|
||||
timerange=timerange
|
||||
)
|
||||
@@ -134,7 +134,7 @@ def plot_profit(args: Namespace) -> None:
|
||||
dates = common_datearray(dataframes)
|
||||
min_date = int(min(dates).timestamp())
|
||||
max_date = int(max(dates).timestamp())
|
||||
num_iterations = define_index(min_date, max_date, tick_interval) + 1
|
||||
num_iterations = define_index(min_date, max_date, ticker_interval) + 1
|
||||
|
||||
# Make an average close price of all the pairs that was involved.
|
||||
# this could be useful to gauge the overall market trend
|
||||
@@ -154,7 +154,7 @@ def plot_profit(args: Namespace) -> None:
|
||||
avgclose /= num
|
||||
|
||||
# make an profits-growth array
|
||||
pg = make_profit_array(data, num_iterations, min_date, tick_interval, filter_pairs)
|
||||
pg = make_profit_array(data, num_iterations, min_date, ticker_interval, filter_pairs)
|
||||
|
||||
#
|
||||
# Plot the pairs average close prices, and total profit growth
|
||||
@@ -178,7 +178,7 @@ def plot_profit(args: Namespace) -> None:
|
||||
fig.append_trace(profit, 2, 1)
|
||||
|
||||
for pair in pairs:
|
||||
pg = make_profit_array(data, num_iterations, min_date, tick_interval, [pair])
|
||||
pg = make_profit_array(data, num_iterations, min_date, ticker_interval, [pair])
|
||||
pair_profit = go.Scattergl(
|
||||
x=dates,
|
||||
y=pg,
|
||||
@@ -189,11 +189,11 @@ def plot_profit(args: Namespace) -> None:
|
||||
plot(fig, filename=str(Path('user_data').joinpath('freqtrade-profit-plot.html')))
|
||||
|
||||
|
||||
def define_index(min_date: int, max_date: int, interval: str) -> int:
|
||||
def define_index(min_date: int, max_date: int, ticker_interval: str) -> int:
|
||||
"""
|
||||
Return the index of a specific date
|
||||
"""
|
||||
interval_seconds = timeframe_to_seconds(interval)
|
||||
interval_seconds = timeframe_to_seconds(ticker_interval)
|
||||
return int((max_date - min_date) / interval_seconds)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user