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.

60 lines
1.8 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 import *
from huobi.model.trade import *
from huobi.utils import *
'''
https://huobiapi.github.io/docs/spot/v1/cn/#5f8b337a4c
查询订单详情
API Key 权限:读取
限频值NEW50次/2s
此接口返回指定订单的最新状态和详情。通过API创建的订单撤销超过2小时后无法查询。
请求参数:
order-id 订单ID填在path中
响应数据:
{
"data":
{
"id": 59378, 订单ID
"symbol": "ethusdt", 交易对
"account-id": 100009, 账户 ID
"amount": "10.1000000000", 订单数量
"price": "100.1000000000", 订单价格
"created-at": 1494901162595, 订单创建时间
"type": "buy-limit", 订单类型
"field-amount": "10.1000000000", 已成交数量
"field-cash-amount": "1011.0100000000", 已成交总金额
"field-fees": "0.0202000000", 已成交手续费准确数值请参考matchresults接口
"finished-at": 1494901400468, 订单变为终结态的时间,不是成交时间,包含“已撤单”状态
"user-id": 1000,
"source": "api", 订单来源
"state": "filled", 订单状态
"canceled-at": 0 订单撤销时间
}
}
'''
class GetOrderByIdService:
def __init__(self, params):
self.params = params
def request(self, **kwargs):
order_id = self.params["order_id"]
def get_channel():
path = "/v1/order/orders/{}"
return path.format(order_id)
def parse(dict_data):
data_dict = dict_data.get("data")
return Order.json_parse(data_dict)
return RestApiSyncClient(**kwargs).request_process(HttpMethod.GET_SIGN, get_channel(), self.params, parse)