def future_position(self,symbol,contractType): FUTURE_POSITION = "/api/v1/future_position.do?" params = { 'api_key':self.__apikey, 'symbol':symbol, 'contract_type':contractType } params['sign'] = buildMySign(params,self.__secretkey) return httpPost(self.__url,FUTURE_POSITION,params)
def future_position_4fix(self,symbol,contractType,type1=1): FUTURE_POSITION_4FIX = "/api/v1/future_position_4fix.do?" params = { 'api_key':self.__apikey, 'symbol':symbol, 'contract_type':contractType, 'type':type1 } params['sign'] = buildMySign(params,self.__secretkey) return httpPost(self.__url,FUTURE_POSITION_4FIX,params)
def future_cancel(self,symbol,contractType,orderId): FUTURE_CANCEL = "/api/v1/future_cancel.do?" params = { 'api_key':self.__apikey, 'symbol':symbol, 'contract_type':contractType, 'order_id':orderId } params['sign'] = buildMySign(params,self.__secretkey) return httpPost(self.__url,FUTURE_CANCEL,params)
def future_batchTrade(self,symbol,contractType,orders_data,leverRate): FUTURE_BATCH_TRADE = "/api/v1/future_batch_trade.do?" params = { 'api_key':self.__apikey, 'symbol':symbol, 'contract_type':contractType, 'orders_data':orders_data, 'lever_rate':leverRate } params['sign'] = buildMySign(params,self.__secretkey) return httpPost(self.__url,FUTURE_BATCH_TRADE,params)
def future_trade(self,symbol,contractType,price='',amount='',tradeType=None,matchPrice='0', #leverRate='10' ): FUTURE_TRADE = "/api/v1/future_trade.do?" params = { 'api_key':self.__apikey, 'symbol':symbol, 'contract_type':contractType, 'amount':amount, 'type':tradeType, 'match_price':matchPrice, #'lever_rate':leverRate } if price: params['price'] = price params['sign'] = buildMySign(params,self.__secretkey) return httpPost(self.__url,FUTURE_TRADE,params)
def future_orderinfo(self,symbol,contractType,orderId,status=None,currentPage=None,pageLength=None): FUTURE_ORDERINFO = "/api/v1/future_order_info.do?" params = { 'api_key':self.__apikey, 'symbol':symbol, 'contract_type':contractType, 'order_id':orderId, } if status: params['status']= status if currentPage: params['current_page']= currentPage if pageLength: params['page_length']= pageLength params['sign'] = buildMySign(params,self.__secretkey) return httpPost(self.__url,FUTURE_ORDERINFO,params)
def future_userinfo(self): FUTURE_USERINFO = "/api/v1/future_userinfo.do?" params ={} params['api_key'] = self.__apikey params['sign'] = buildMySign(params,self.__secretkey) return httpPost(self.__url,FUTURE_USERINFO,params)
def future_userinfo_4fix(self): FUTURE_INFO_4FIX = "/api/v1/future_userinfo_4fix.do?" params = {'api_key':self.__apikey} params['sign'] = buildMySign(params,self.__secretkey) return httpPost(self.__url,FUTURE_INFO_4FIX,params)