get markets without exchange specific methods
This commit is contained in:
parent
9477dbbd07
commit
5295723532
@ -149,8 +149,13 @@ def get_ticker(pair: str, refresh: Optional[bool] = True) -> dict:
|
|||||||
|
|
||||||
@cached(TTLCache(maxsize=100, ttl=30))
|
@cached(TTLCache(maxsize=100, ttl=30))
|
||||||
def get_ticker_history(pair: str, tick_interval) -> List[Dict]:
|
def get_ticker_history(pair: str, tick_interval) -> List[Dict]:
|
||||||
## implement https://github.com/ccxt/ccxt/blob/master/python/ccxt/bittrex.py#L394-L400
|
# TODO: tickers need to be in format 1m,5m
|
||||||
return _API.get_ticker_history(pair, tick_interval)
|
# fetch_ohlcv returns an [[datetime,o,h,l,c,v]]
|
||||||
|
_API.load_markets()
|
||||||
|
# if not _API.markets.get(pair):
|
||||||
|
# logger.warning('Pair {} doesnt exist in exchange' % pair)
|
||||||
|
# return []
|
||||||
|
return _API.fetch_ohlcv(pair, str(tick_interval)+'m')
|
||||||
|
|
||||||
|
|
||||||
def cancel_order(order_id: str) -> None:
|
def cancel_order(order_id: str) -> None:
|
||||||
@ -180,13 +185,7 @@ def get_markets() -> List[str]:
|
|||||||
|
|
||||||
|
|
||||||
def get_market_summaries() -> List[Dict]:
|
def get_market_summaries() -> List[Dict]:
|
||||||
# TODO: check other exchanges how they implement market summaries
|
return _API.fetch_tickers()
|
||||||
summaries = _API.public_get_marketsummaries()['result']
|
|
||||||
for market in summaries:
|
|
||||||
name = market['MarketName'].split('-')
|
|
||||||
market['MarketName'] = name[-1] + '/' + name[0]
|
|
||||||
return summaries
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_name() -> str:
|
def get_name() -> str:
|
||||||
|
@ -377,7 +377,6 @@ def create_trade(stake_amount: float, interval: int) -> bool:
|
|||||||
)
|
)
|
||||||
|
|
||||||
whitelist = copy.deepcopy(_CONF['exchange']['pair_whitelist'])
|
whitelist = copy.deepcopy(_CONF['exchange']['pair_whitelist'])
|
||||||
print('*******whitelist {}*****'.format(whitelist))
|
|
||||||
|
|
||||||
# Check if stake_amount is fulfilled
|
# Check if stake_amount is fulfilled
|
||||||
if exchange.get_balance(_CONF['stake_currency']) < stake_amount:
|
if exchange.get_balance(_CONF['stake_currency']) < stake_amount:
|
||||||
@ -393,7 +392,6 @@ def create_trade(stake_amount: float, interval: int) -> bool:
|
|||||||
if not whitelist:
|
if not whitelist:
|
||||||
raise DependencyException('No pair in whitelist')
|
raise DependencyException('No pair in whitelist')
|
||||||
|
|
||||||
# Pick pair based on StochRSI buy signals
|
|
||||||
for _pair in whitelist:
|
for _pair in whitelist:
|
||||||
(buy, sell) = get_signal(_pair, interval)
|
(buy, sell) = get_signal(_pair, interval)
|
||||||
if buy and not sell:
|
if buy and not sell:
|
||||||
@ -471,11 +469,11 @@ def gen_pair_whitelist(base_currency: str, key: str = 'BaseVolume') -> List[str]
|
|||||||
:return: List of pairs
|
:return: List of pairs
|
||||||
"""
|
"""
|
||||||
summaries = sorted(
|
summaries = sorted(
|
||||||
(s for s in exchange.get_market_summaries() if s['MarketName'].endswith(base_currency)),
|
(v for s,v in exchange.get_market_summaries().items() if v['symbol'].endswith(base_currency)),
|
||||||
key=lambda s: s.get(key) or 0.0,
|
key=lambda v: v.get('info').get(key) or 0.0,
|
||||||
reverse=True
|
reverse=True
|
||||||
)
|
)
|
||||||
return [s['MarketName'] for s in summaries]
|
return [s['symbol'] for s in summaries]
|
||||||
|
|
||||||
|
|
||||||
def cleanup() -> None:
|
def cleanup() -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user