def get_orders_info(self, orderList): timstamp = int(round(time.time() * 1000)) params = {'apiAccessKey': self._api_key, 'apiTimeStamp': timstamp} params['apiSign'] = HttpsRequest.build_sign(params, self._secret_key) bodys = orderList return self._request.post(BitAssetBase.RESOURCES_URL['orders_info'], params, bodys)
def future_position(self, symbol, contract_type): params = { 'api_key': self.__api_key, 'symbol': symbol, 'contract_type': contract_type } params['sign'] = HttpsRequest.build_sign(params, self.__secret_key) return HttpsRequest.post(OKCoinBase.RESOURCES_URL['position'], params)
def future_withdraw_info(self, symbol, withdraw_id): params = { 'api_key': self._api_key, 'symbol': symbol, 'withdraw_id': withdraw_id } params['sign'] = HttpsRequest.build_sign(params, self._secret_key) return HttpsRequest.post(OKCoinBase.RESOURCES_URL['withdraw_info'], params)
def future_cancel(self, symbol, contract_type, order_id): params = { 'api_key': self._api_key, 'symbol': symbol, 'contract_type': contract_type, 'order_id': order_id } params['sign'] = HttpsRequest.build_sign(params, self._secret_key) return HttpsRequest.post(OKCoinBase.RESOURCES_URL['cancel'], params)
def future_trade_history(self, symbol, date, since): params = { 'api_key': self.__api_key, 'symbol': symbol, 'date': date, 'since': since } params['sign'] = HttpsRequest.build_sign(params, self.__secret_key) return HttpsRequest.post(OKCoinBase.RESOURCES_URL['trades_history'], params)
def future_batch_trade(self, symbol, contract_type, orders_data, lever_rate): params = { 'api_key': self._api_key, 'symbol': symbol, 'contract_type': contract_type, 'orders_data': orders_data, 'lever_rate': lever_rate } params['sign'] = HttpsRequest.build_sign(params, self._secret_key) return HttpsRequest.post(OKCoinBase.RESOURCES_URL['batch_trade'], params)
def future_withdraw(self, symbol, charge_fee, trade_pwd, withdraw_address, withdraw_amount, target): params = { 'api_key': self._api_key, 'symbol': symbol, 'charge_fee': charge_fee, 'trade_pwd': trade_pwd, 'withdraw_address': withdraw_address, 'withdraw_amount': withdraw_amount, 'target': target } params['sign'] = HttpsRequest.build_sign(params, self._secret_key) return HttpsRequest.post(OKCoinBase.RESOURCES_URL['withdraw'], params)
def future_explosive(self, symbol, contract_type, status, current_page, page_number, page_length): params = { 'api_key': self._api_key, 'symbol': symbol, 'contract_type': contract_type, 'status': status, 'current_page': current_page, 'page_number': page_number, 'page_length': page_length } params['sign'] = HttpsRequest.build_sign(params, self._secret_key) return HttpsRequest.post(OKCoinBase.RESOURCES_URL['explosive'], params)
def get_order_info(self, orderId): ''' orderId:委托单id ''' timstamp = int(round(time.time() * 1000)) params = { 'apiAccessKey': self._api_key, 'apiTimeStamp': timstamp, 'orderId': orderId } params['apiSign'] = HttpsRequest.build_sign(params, self._secret_key) return self._request.get(BitAssetBase.RESOURCES_URL['order_info'], params)
def future_order_info(self, symbol, contract_type, order_id, status, current_page, page_length): params = { 'api_key': self._api_key, 'symbol': symbol, 'contract_type': contract_type, 'order_id': order_id, 'status': status, 'current_page': current_page, 'page_length': page_length } params['sign'] = HttpsRequest.build_sign(params, self._secret_key) return HttpsRequest.post(OKCoinBase.RESOURCES_URL['order_info'], params)
def cancel(self, orderId, contractId): ''' contractId:交易对id orderId:委托单id ''' timstamp = int(round(time.time() * 1000)) params = { 'apiAccessKey': self._api_key, 'apiTimeStamp': timstamp, 'orderId': orderId } params['apiSign'] = HttpsRequest.build_sign(params, self._secret_key) bodys = {'contractId': contractId, 'originalOrderId': orderId} return self._request.post(BitAssetBase.RESOURCES_URL['cancel'], params, bodys)
def trade(self, contractId, side, price, quantity, orderType): ''' contractId:交易对id side:buy:1 sell:-1 price:价格 quantity:数量 orderType:1(限价)3(市价) ''' timstamp = int(round(time.time() * 1000)) params = {'apiAccessKey': self._api_key, 'apiTimeStamp': timstamp} params['apiSign'] = HttpsRequest.build_sign(params, self._secret_key) bodys = { 'contractId': contractId, 'side': side, 'price': price, 'quantity': quantity, 'orderType': orderType } return self._request.post(BitAssetBase.RESOURCES_URL['order'], params, bodys)
def future_trade(self, symbol, contract_type, price='', amount='', trade_type='', match_price='', lever_rate=''): params = { 'api_key': self.__api_key, 'symbol': symbol, 'contract_type': contract_type, 'amount': amount, 'type': trade_type, 'match_price': match_price, 'lever_rate': lever_rate } if price: params['price'] = price params['sign'] = HttpsRequest.build_sign(params, self.__secret_key) return HttpsRequest.post(OKCoinBase.RESOURCES_URL['trades'], params)
def future_user_info_4fix(self): params = {'api_key': self._api_key} params['sign'] = HttpsRequest.build_sign(params, self._secret_key) return HttpsRequest.post(self, OKCoinBase.RESOURCES_URL['user_info_4fix'], params)
def accounts_balance(self): timstamp = int(round(time.time() * 1000)) params = {'apiAccessKey': self._api_key, 'apiTimeStamp': timstamp} params['apiSign'] = HttpsRequest.build_sign(params, self._secret_key) return self._request.get(BitAssetBase.RESOURCES_URL['balance'], params)