Exemple #1
0
 def GetSummary(self, **kwargs):
     """
     Get a 24-hour summary of this exchange.
     
     Result includes last, highest and lowest prices, volume, and price change information.
     """
     url = urljoin(self.base_url, "summary")
     resp = _get_response(url)
     
     res = Msg.Summary(resp['result'])
     return _include_allowance(res, resp, kwargs)
Exemple #2
0
def GetAllSummaries(split_slug = False, **kwargs):
    """
    Get summaries from all currency pairs on all exchanges.
    
    split_slug: Indicates whether the 'slug' should be split. By default, the result will
    return a dict() with concatenated exchange and currency pair names as the key, joined by
    a colon (e.g.  'coinbase:ethusd'). If this is set true, instead of a dict, the result 
    will be a list of 3-tuples containing the exchange, currency pair and summary (in that order)
    """
    url = urljoin(_get_url(kwargs), "markets/summaries")
    resp = _get_response(url)

    if(split_slug):
        res = []
        for slug in resp['result']:
            summ = Msg.Summary(resp['result'][slug])
            exch,cpair = slug.split(":")
            res.append((exch, cpair, summ))
    else:
        res = {x: Msg.Summary(resp['result'][x]) for x in resp['result']}
        
    return _include_allowance(res, resp, kwargs)