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
:return: DataFrame
"""
columns = {'C': 'close', 'V': 'volume', 'O': 'open', 'H': 'high', 'L': 'low', 'T': 'date'}
frame = DataFrame(ticker) \
.rename(columns=columns)
if 'BV' in frame:
frame.drop('BV', 1, inplace=True)
frame['date'] = to_datetime(frame['date'], utc=True, infer_datetime_format=True)
cols = ['date', 'open', 'high', 'low', 'close', 'volume']
frame = DataFrame(ticker, columns=cols)
frame['date'] = to_datetime(frame['date'],
unit='ms',
utc=True,
infer_datetime_format=True)
frame.sort_values('date', inplace=True)
return frame

View File

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

View File

@ -55,7 +55,7 @@ def plot_analyzed_dataframe(args: Namespace) -> None:
if args.live:
logger.info('Downloading pair.')
# 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)
else:
tickers = optimize.load_data(

View File

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