Add price jump warning

This commit is contained in:
Matthias 2022-10-20 19:36:28 +02:00
parent 7192ed7be6
commit 60cb11a44d
3 changed files with 19 additions and 4 deletions

View File

@ -102,6 +102,12 @@ If this happens for all pairs in the pairlist, this might indicate a recent exch
Irrespectively of the reason, Freqtrade will fill up these candles with "empty" candles, where open, high, low and close are set to the previous candle close - and volume is empty. In a chart, this will look like a `_` - and is aligned with how exchanges usually represent 0 volume candles.
### I'm getting "Price jump between 2 candles detected"
This message is a warning that the candles had a price jump of > 30%.
This might be a sign that the pair stopped trading, and some token exchange took place (e.g. COCOS in 2021 - where price jumped from 0.0000154 to 0.01621).
This message is often accompanied by ["Missing data fillup"](#im-getting-missing-data-fillup-messages-in-the-log) - as trading on such pairs is often stopped for some time.
### I'm getting "Outdated history for pair xxx" in the log
The bot is trying to tell you that it got an outdated last candle (not the last complete candle).

View File

@ -119,6 +119,14 @@ def ohlcv_fill_up_missing_data(dataframe: DataFrame, timeframe: str, pair: str)
else:
# Don't be verbose if only a small amount is missing
logger.debug(message)
candle_price_gap = 0
if not df.empty and 'close' in df.columns:
returns = df['close'].pct_change().dropna()
if len(returns):
candle_price_gap = max(abs(returns))
if candle_price_gap > 0.3:
logger.info(f"Price jump in {pair} between two candles of {candle_price_gap:.2%} detected.")
return df

View File

@ -80,10 +80,10 @@ def test_ohlcv_fill_up_missing_data2(caplog):
ticks = [
[
1511686200000, # 8:50:00
8.794e-05, # open
8.948e-05, # high
8.794e-05, # low
8.88e-05, # close
8.794e-07, # open
8.948e-07, # high
8.794e-07, # low
8.88e-07, # close
2255, # volume (in quote currency)
],
[
@ -118,6 +118,7 @@ def test_ohlcv_fill_up_missing_data2(caplog):
assert len(data) == 3
caplog.set_level(logging.DEBUG)
data2 = ohlcv_fill_up_missing_data(data, timeframe, "UNITTEST/BTC")
assert log_has_re(r"Price jump in .* between two candles .* detected\.", caplog)
assert len(data2) == 4
# 3rd candle has been filled
row = data2.loc[2, :]