analyze to use the ccxt OHLCV format

setup: remove bittrex and add requirement to ccxt

freqtradebot: update market summaries to ccxt format
This commit is contained in:
Samuel Husso 2018-03-21 19:57:58 +02:00
parent 40a0689183
commit d20e3f79be
4 changed files with 16 additions and 16 deletions

View File

@ -44,12 +44,13 @@ class Analyze(object):
: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

View File

@ -208,13 +208,12 @@ class FreqtradeBot(object):
:return: List of pairs :return: List of pairs
""" """
summaries = sorted( summaries = sorted(
(s for s in exchange.get_market_summaries() if (v for s, v in exchange.get_market_summaries().items() if v['symbol'].endswith(base_currency)),
s['MarketName'].startswith(base_currency)), key=lambda v: v.get('info').get(key) or 0.0,
key=lambda s: s.get(key) or 0.0,
reverse=True reverse=True
) )
return [s['MarketName'].replace('-', '_') for s in summaries] return [s['symbol'] for s in summaries]
def _refresh_whitelist(self, whitelist: List[str]) -> List[str]: def _refresh_whitelist(self, whitelist: List[str]) -> List[str]:
""" """
@ -227,15 +226,15 @@ class FreqtradeBot(object):
sanitized_whitelist = whitelist sanitized_whitelist = whitelist
health = exchange.get_wallet_health() health = exchange.get_wallet_health()
known_pairs = set() known_pairs = set()
for status in health: for symbol, status in health.items():
pair = '{}_{}'.format(self.config['stake_currency'], status['Currency']) pair = f"{status['base']}/{self.config['stake_currency']}"
# pair is not int the generated dynamic market, or in the blacklist ... ignore it # pair is not int the generated dynamic market, or in the blacklist ... ignore it
if pair not in whitelist or pair in self.config['exchange'].get('pair_blacklist', []): if pair not in whitelist or pair in self.config['exchange'].get('pair_blacklist', []):
continue continue
# else the pair is valid # else the pair is valid
known_pairs.add(pair) known_pairs.add(pair)
# Market is not active # Market is not active
if not status['IsActive']: if not status['active']:
sanitized_whitelist.remove(pair) sanitized_whitelist.remove(pair)
self.logger.info( self.logger.info(
'Ignoring %s from whitelist (reason: %s).', 'Ignoring %s from whitelist (reason: %s).',
@ -328,7 +327,7 @@ class FreqtradeBot(object):
pair=pair, pair=pair,
stake_amount=stake_amount, stake_amount=stake_amount,
amount=amount, amount=amount,
fee=exchange.get_fee(), fee=exchange.get_fee_maker(),
open_rate=buy_limit, open_rate=buy_limit,
open_date=datetime.utcnow(), open_date=datetime.utcnow(),
exchange=exchange.get_name().upper(), exchange=exchange.get_name().upper(),

View File

@ -55,7 +55,7 @@ def plot_analyzed_dataframe(args: Namespace) -> None:
if args.live: if args.live:
logger.info('Downloading pair.') logger.info('Downloading pair.')
# Init Bittrex to use public API # Init Bittrex to use public API
exchange._API = exchange.Bittrex({'key': '', 'secret': ''}) exchange.init({'key': '', 'secret': ''})
tickers[pair] = exchange.get_ticker_history(pair, tick_interval) tickers[pair] = exchange.get_ticker_history(pair, tick_interval)
else: else:
tickers = optimize.load_data( tickers = optimize.load_data(

View File

@ -21,7 +21,7 @@ setup(name='freqtrade',
setup_requires=['pytest-runner'], setup_requires=['pytest-runner'],
tests_require=['pytest', 'pytest-mock', 'pytest-cov'], tests_require=['pytest', 'pytest-mock', 'pytest-cov'],
install_requires=[ install_requires=[
'python-bittrex', 'ccxt',
'SQLAlchemy', 'SQLAlchemy',
'python-telegram-bot', 'python-telegram-bot',
'arrow', 'arrow',