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.

51 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.account import *
from huobi.utils import *
'''
https://huobiapi.github.io/docs/spot/v1/cn/#555911a809
账户信息
API Key 权限:读取
限频值NEW100次/2s
响应数据
{
"data": [
{
"id": 100001, account-id
"type": "spot", 账户类型 spot现货账户, margin逐仓杠杆账户, otcOTC 账户, point点卡账户, super-margin全仓杠杆账户, investment: C2C杠杆借出账户, borrow: C2C杠杆借入账户矿池账户: minepool, ETF账户: etf, 抵押借贷账户: crypto-loans
"subtype": "", 子账户类型(仅对逐仓杠杆账户有效) 逐仓杠杆交易标的例如btcusdt
"state": "working" 账户状态 working正常, lock账户被锁定
}
{
"id": 100002,
"type": "margin",
"subtype": "btcusdt",
"state": "working"
},
{
"id": 100003,
"type": "otc",
"subtype": "",
"state": "working"
}
]
}
逐仓/全仓/C2C杠杆账户margin/super-margin/borrow会在第一次划转资产时创建如果未划转过资产则不会有杠杆账户。
'''
class GetAccountsService:
def __init__(self, params):
self.params = params
def request(self, **kwargs):
channel = "/v1/account/accounts"
def parse(dict_data):
data_list = dict_data.get("data", [])
return default_parse_list_dict(data_list, Account, [])
return RestApiSyncClient(**kwargs).request_process(HttpMethod.GET_SIGN, channel, self.params, parse)