예제 #1
0
파일: coinapult.py 프로젝트: laisee/hokonui
 def get_current_ask(cls, ccy, btc_amount=0.1):
     ''' method for testing current ask price '''
     url = cls.TICKER_URL.format(ccy)
     data = get_response(url, ccy)
     level = cls._pick_level(btc_amount) if btc_amount > 0 else 'small'
     price = str(data[level]['ask'])
     return apply_format(price)
예제 #2
0
파일: coinapult.py 프로젝트: laisee/hokonui
 def _current_ticker_extractor(cls, ccy, data, btc_amount=0):
     ''' method for testing current ticker '''
     url = cls.TICKER_URL.format(ccy)
     data = get_response(url, ccy)
     level = cls._pick_level(btc_amount) if btc_amount > 0 else 'small'
     ask = apply_format(str(data[level]['ask']))
     bid = apply_format(str(data[level]['bid']))
     return Ticker(ccy, bid, ask).toJSON()
예제 #3
0
파일: base.py 프로젝트: laisee/hokonui
 def get_current_orders(cls, ccy=None, params=None, body=None, max_qty=5):
     ''' Method for retrieving current orders '''
     data = get_response(cls.ORDER_BOOK_URL, ccy, params, body)
     return cls._current_orders_extractor(data, max_qty)
예제 #4
0
파일: coinapult.py 프로젝트: laisee/hokonui
 def get_current_price(cls, ccy):
     ''' method for testing last price '''
     url = cls.TICKER_URL.format(ccy)
     data = get_response(url, ccy)
     price = str(data['index'])
     return apply_format(price)
예제 #5
0
파일: base.py 프로젝트: laisee/hokonui
 def get_current_ticker(cls, ccy=None, params=None, body=None):
     ''' Method for retrieving current ticker '''
     data = get_response(cls.TICKER_URL, ccy, params, body)
     return cls._current_ticker_extractor(data)
예제 #6
0
파일: base.py 프로젝트: laisee/hokonui
 def get_current_ask(cls, ccy=None, params=None, body=None):
     ''' Method for retrieving current ask price '''
     data = get_response(cls.TICKER_URL, ccy, params, body)
     return cls._current_ask_extractor(data)
예제 #7
0
파일: base.py 프로젝트: laisee/hokonui
 def get_current_price(cls, ccy=None, params=None, body=None):
     ''' Method for retrieving last price '''
     url = cls.PRICE_URL if hasattr(cls, 'PRICE_URL') and cls.PRICE_URL is not None else cls.TICKER_URL
     data = get_response(url, ccy, params, body)
     return cls._current_price_extractor(data)
예제 #8
0
파일: coindesk.py 프로젝트: laisee/hokonui
 def _get_historical_data(cls, start, end=None):
     """ Method for retrieving historical data """
     if not end:
         end = start
     url = "https://api.coindesk.com/v1/bpi/historical/close.json" "?start={}&end={}".format(start, end)
     return get_response(url, None)
예제 #9
0
파일: coindesk.py 프로젝트: laisee/hokonui
 def get_current_price(cls, ccy=base.CCY_DEFAULT):
     """ Method for retrieving current price """
     url = "https://api.coindesk.com/v1/bpi/currentprice/%s.json"
     data = get_response(url, ccy)
     price = data["bpi"][ccy]["rate"]
     return apply_format(price)