parse ccxt ticker

This commit is contained in:
Samuel Husso 2018-02-10 10:46:26 +02:00
parent d3038d155b
commit 9477dbbd07

View File

@ -27,12 +27,13 @@ def parse_ticker_dataframe(ticker: list) -> DataFrame:
:param ticker: See exchange.get_ticker_history :param ticker: See exchange.get_ticker_history
:return: DataFrame :return: DataFrame
""" """
columns = {'C': 'close', 'V': 'volume', 'O': 'open', 'H': 'high', 'L': 'low', 'T': 'date'} cols = ['date', 'open', 'high', 'low', 'close', 'volume']
frame = DataFrame(ticker) \ frame = DataFrame(ticker, columns=cols)
.rename(columns=columns)
if 'BV' in frame: frame['date'] = to_datetime(frame['date'],
frame.drop('BV', 1, inplace=True) unit='ms',
frame['date'] = to_datetime(frame['date'], utc=True, infer_datetime_format=True) utc=True,
infer_datetime_format=True)
frame.sort_values('date', inplace=True) frame.sort_values('date', inplace=True)
return frame return frame
@ -82,8 +83,6 @@ def analyze_ticker(ticker_history: List[Dict]) -> DataFrame:
return dataframe return dataframe
# FIX: Maybe return False, if an error has occured,
# Otherwise we might mask an error as an non-signal-scenario
def get_signal(pair: str, interval: int) -> (bool, bool): def get_signal(pair: str, interval: int) -> (bool, bool):
""" """
Calculates current signal based several technical analysis indicators Calculates current signal based several technical analysis indicators