def kline(self, period='', size=150): #period:1min, 5min, 15min, 30min, 60min, 1day, 1mon, 1week, 1year PATH = "/market/history/kline" url = self.__host + PATH params = {'size': size} params['symbol'] = self.__symbol if period: params['period'] = period return httpGET(url, params)
def _httpGET_key(self, params, path): ts = datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S') params.update({ 'AccessKeyId': self.__accesskey, 'SignatureMethod': 'HmacSHA256', 'SignatureVersion': '2', 'Timestamp': ts }) hostName = urlparse.urlparse(self.__host).hostname params['Signature'] = sign(params, 'GET', hostName, path, self.__secretkey) url = self.__host + path return httpGET(url, params)
def last24h(self): PATH = '/market/detail' url = self.__host + PATH params = {'symbol': self.__symbol} return httpGET(url, params)
def historyDetail(self, size=5): PATH = '/market/history/trade' url = self.__host + PATH params = {'size': size} params['symbol'] = self.__symbol return httpGET(url, params)
def latestDetail(self): PATH = '/market/trade' url = self.__host + PATH params = {'symbol': self.__symbol} return httpGET(url, params)
def merged(self): PATH = '/market/detail/merged' url = self.__host + PATH params = {'symbol': self.__symbol} return httpGET(url, params)
def depth(self, _type='step1'): PATH = '/market/depth' url = self.__host + PATH params = {'type': _type} params['symbol'] = self.__symbol return httpGET(url, params)