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 权限:读取 限频值(NEW):100次/2s 响应数据 { "data": [ { "id": 100001, account-id "type": "spot", 账户类型 spot:现货账户, margin:逐仓杠杆账户, otc:OTC 账户, 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)