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): 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_orderinfo(self, symbol, contractType, orderId, status, currentPage, pageLength): FUTURE_ORDERINFO = "/api/v1/future_order_info.do?" params = { 'api_key': self.__apikey, 'symbol': symbol, 'contract_type': contractType, 'order_id': orderId, 'status': status, 'current_page': currentPage, 'page_length': pageLength } params['sign'] = buildMySign(params, self.__secretkey) return httpPost(self.__url, FUTURE_ORDERINFO, params)
def addVideo(self, aid): data = httpPost(self.addApi, headers={ "origin": "https://www.bilibili.com", "referer": "https://www.bilibili.com" }, cookies=Config.commonCookies, data={ 'rid': int(aid), 'type': 2, 'add_media_ids': int(self.media_id), 'del_media_ids': "", 'jsonp': 'jsonp' }) return data.json() if data != None else None
def future_trade(self, symbol, contractType, price='', amount='', tradeType='', matchPrice='', leverRate=''): 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_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)