add dataframe empty check
This commit is contained in:
parent
2bd51d8be3
commit
0e5edd08e5
@ -96,6 +96,11 @@ def analyze_ticker(pair: str) -> DataFrame:
|
|||||||
minimum_date = arrow.utcnow().shift(hours=-6)
|
minimum_date = arrow.utcnow().shift(hours=-6)
|
||||||
data = get_ticker(pair, minimum_date)
|
data = get_ticker(pair, minimum_date)
|
||||||
dataframe = parse_ticker_dataframe(data['result'], minimum_date)
|
dataframe = parse_ticker_dataframe(data['result'], minimum_date)
|
||||||
|
|
||||||
|
if dataframe.empty:
|
||||||
|
logger.debug('Empty dataframe for pair %s', pair)
|
||||||
|
return dataframe
|
||||||
|
|
||||||
dataframe = populate_indicators(dataframe)
|
dataframe = populate_indicators(dataframe)
|
||||||
dataframe = populate_buy_trend(dataframe)
|
dataframe = populate_buy_trend(dataframe)
|
||||||
return dataframe
|
return dataframe
|
||||||
@ -107,6 +112,10 @@ def get_buy_signal(pair: str) -> bool:
|
|||||||
:return: True if pair is good for buying, False otherwise
|
:return: True if pair is good for buying, False otherwise
|
||||||
"""
|
"""
|
||||||
dataframe = analyze_ticker(pair)
|
dataframe = analyze_ticker(pair)
|
||||||
|
|
||||||
|
if dataframe.empty:
|
||||||
|
return False
|
||||||
|
|
||||||
latest = dataframe.iloc[-1]
|
latest = dataframe.iloc[-1]
|
||||||
|
|
||||||
# Check if dataframe is out of date
|
# Check if dataframe is out of date
|
||||||
|
Loading…
Reference in New Issue
Block a user