def get_contract_index(self, symbol): """ :symbol "BTC","ETH"... """ params = {'symbol': symbol} url = self.__url + '/api/v1/contract_index' return http_get_request(url, params)
def get_contract_market_merged(self, symbol): """ :symbol "BTC_CW","BTC_NW", "BTC_CQ" ... """ params = {'symbol': symbol} url = self.__url + '/market/detail/merged' return http_get_request(url, params)
def get_contract_batch_trade(self, symbol, size=1): """ :param symbol: 可选值:{ BTC_CW, BTC_NW, BTC_CQ, etc. }, size: int :return: """ params = {'symbol': symbol, 'size': size} url = self.__url + '/market/history/trade' return http_get_request(url, params)
def get_contract_depth(self, symbol, type): """ :param symbol: BTC_CW, BTC_NW, BTC_CQ , ... :param type: 可选值:{ step0, step1, step2, step3, step4, step5 (合并深度0-5);step0时,不合并深度 } :return: """ params = {'symbol': symbol, 'type': type} url = self.__url + '/market/depth' return http_get_request(url, params)
def get_contract_kline(self, symbol, period, size=150): """ :param symbol BTC_CW, BTC_NW, BTC_CQ , ... :param period: 可选值:{1min, 5min, 15min, 30min, 60min, 4hour, 1day, 1week, 1mon } :param size: [1,2000] :return: """ params = {'symbol': symbol, 'period': period} if size: params['size'] = size url = self.__url + '/market/history/kline' return http_get_request(url, params)
def get_contract_open_interest(self, symbol='', contract_type='', contract_code=''): """ :symbol "BTC","ETH"... :contract_type 合约类型: this_week:当周 next_week:下周 quarter:季度 "contract_code BTC180928 备注:如果contract_code填了值,那就按照contract_code去查询,如果contract_code 没有填值,则按照symbol+contract_type去查询 """ params = { 'symbol': symbol, 'contract_type': contract_type, 'contract_code': contract_code } url = self.__url + '/api/v1/contract_open_interest' return http_get_request(url, params)
def get_contract_info(self, symbol='', contract_type='', contract_code=''): """ 参数名称 参数类型 必填 描述 symbol string false "BTC","ETH"... contract_type string false 合约类型: this_week:当周 next_week:下周 quarter:季度 contract_code string false BTC181228 备注:如果contract_code填了值,那就按照contract_code去查询,如果contract_code 没有填值,则按照symbol+contract_type去查询 """ params = {} if symbol: params['symbol'] = symbol if contract_type: params['contract_type'] = contract_type if contract_code: params['contract_code'] = contract_code url = self.__url + '/api/v1/contract_contract_info' return http_get_request(url, params)
def get_contract_price_limit(self, symbol='', contract_type='', contract_code=''): """ :symbol "BTC","ETH"... :contract_type 合约类型: this_week:当周 next_week:下周 quarter:季度 "contract_code BTC180928 备注:如果contract_code填了值,那就按照contract_code去查询,如果contract_code 没有填值,则按照symbol+contract_type去查询 """ params = {} if symbol: params['symbol'] = symbol if contract_type: params['contract_type'] = contract_type if contract_code: params['contract_code'] = contract_code url = self.__url + '/api/v1/contract_price_limit' return http_get_request(url, params)