eliminating partial candles on known exchanges that sends partial ohclv

This commit is contained in:
Nullart 2018-06-26 21:17:17 +08:00
parent 56cc3c6e72
commit 9813c3c039

View File

@ -62,7 +62,7 @@ class Analyze(object):
'close': 'last',
'volume': 'max',
})
frame.drop(frame.tail(1).index, inplace=True) # eliminate partial candle
return frame
def populate_indicators(self, dataframe: DataFrame, pair: str = None) -> DataFrame:
@ -104,8 +104,11 @@ class Analyze(object):
add several TA indicators and buy signal to it
:return DataFrame with ticker data and indicator data
"""
dataframe = self.parse_ticker_dataframe(ticker_history)
# eliminate partials for known exchanges that sends partial candles
if self.config['exchange']['name'] in ['binance']:
logger.info('eliminating partial candle')
dataframe.drop(dataframe.tail(1).index, inplace=True) # eliminate partial candle
dataframe = self.populate_indicators(dataframe, pair)
dataframe = self.populate_buy_trend(dataframe, pair)
dataframe = self.populate_sell_trend(dataframe, pair)
@ -150,6 +153,7 @@ class Analyze(object):
signal_date = arrow.get(latest['date'])
interval_minutes = constants.TICKER_INTERVAL_MINUTES[interval]
if signal_date < (arrow.utcnow() - timedelta(minutes=(interval_minutes + 5))):
logger.debug('signal %s vs arrow now %s', signal_date, arrow.utcnow())
logger.warning(
'Outdated history for pair %s. Last tick is %s minutes old',
pair,