From 45909d8422a1cf36688dfb5f73eb8e3d4dc14ee8 Mon Sep 17 00:00:00 2001 From: Samuel Husso Date: Mon, 19 Feb 2018 20:44:47 +0200 Subject: [PATCH] add market urls --- freqtrade/exchange/__init__.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/freqtrade/exchange/__init__.py b/freqtrade/exchange/__init__.py index f52946b33..f48945377 100644 --- a/freqtrade/exchange/__init__.py +++ b/freqtrade/exchange/__init__.py @@ -41,6 +41,18 @@ def retrier(f): return wrapper +def _get_market_url(exchange): + "get market url for exchange" + # TODO: PR to ccxt + base = exchange.urls.get('www') + market = "" + if 'bittrex' in get_name(): + market = base + '/Market/Index?MarketName={}' + if 'binance' in get_name(): + market = base + '/trade.html?symbol={}' + + return market + def init(config: dict) -> None: """ @@ -198,10 +210,9 @@ def get_order(order_id: str) -> Dict: def get_pair_detail_url(pair: str) -> str: - # base_url = _API.urls.get('www') - # details = base_url + '/Market/Index' - # pair_url = details + '?MarketName={}' - return "PAIR {} URL".format(pair) + return _get_market_url(_API).format( + _API.markets[pair]['id'] + ) def get_markets() -> List[str]: @@ -213,7 +224,7 @@ def get_market_summaries() -> List[Dict]: def get_name() -> str: - return _API.name + return _API.__class__.__name__ def get_fee_maker() -> float: