You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.6 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

from huobi.connection.restapi_sync_client import RestApiSyncClient
from huobi.constant.system import HttpMethod
from huobi.model.trade import *
'''
https://huobiapi.github.io/docs/spot/v1/cn/#75a79bcd48
查询当前未成交订单
API Key 权限:读取
限频值NEW50次/2s
查询已提交但是仍未完全成交或未被撤销的订单。
请求参数:
account-id 账户 ID取值参考 GET /v1/account/accounts。现货交易使用spot账户的 account-id逐仓杠杆交易请使用 margin 账户的 account-id全仓杠杆交易请使用 super-margin 账户的 account-idc2c杠杆交易请使用borrow账户的account-id
symbol 交易对,即btcusdt, ethbtc...取值参考GET /v1/common/symbols
side 指定只返回某一个方向的订单,可能的值有: buy, sell. 默认两个方向都返回。
from 查询起始 ID如果是向后查询则赋值为上一次查询结果中得到的最后一条id 如果是向前查询则赋值为上一次查询结果中得到的第一条id
direct 查询方向prev 向前next 向后 如字段'from'已设定,此字段'direct'为必填
size 返回订单的数量最大值500。
'''
class GetOpenOrdersService:
def __init__(self, params):
self.params = params
def request(self, **kwargs):
channel = "/v1/order/openOrders"
def parse(dict_data):
data_list = dict_data.get("data", [])
return Order.json_parse_list(data_list)
return RestApiSyncClient(**kwargs).request_process(HttpMethod.GET_SIGN, channel, self.params, parse)