Python_Huobi API帐户类型,此参数是什么?

时间:2019-04-22 04:38:15

标签: python api github cryptocurrency

火币的加密货币交换api:https://github.com/huobiapi/huobi_Python 询问“帐户类型”,您通常会在Accounttype.spot()中看到它

我不知道这意味着什么,在文档中或互联网上的任何地方都没有您知道的任何线索吗?我需要下订单

2 个答案:

答案 0 :(得分:0)

您可以通过SubscriptionClient获取帐户类型。根据我的试验,有两种主要类型,即spotpoint

spot帐户是指Huobi提供的所有可用加密货币,而point帐户代表Huobi自己的要点-hbpoint,可以兑换成美元,反之亦然。也请在另一篇文章中找到我的答案。 "Account" object has no atribute get Huobi_python API

以下代码的原始来源是

https://github.com/HuobiRDCenter/huobi_Python/blob/master/example/websocket/reqsignaccountlist.py

from huobi import SubscriptionClient
from huobi.constant.test import *
from huobi.model import *

sub_client = SubscriptionClient(api_key="",
                                secret_key="")

def Accountinfo(account_event: 'AccountEvent'):
        global acc
        for account in account_event.account_list:
            if account.balances:  
                account.id
                account.account_type
                account.account_state
                if account.account_type == 'spot':
                        acc = str(account.account_type)
                        print("Account type is: " + str(acc))

sub_client.request_account_balance_event(Accountinfo)

注释:在global acc函数中设置Accountinfo是为了使局部变量-acc成为全局变量。因此,acc可用于布尔运算。

答案 1 :(得分:0)

您可以在此Huobi API官方文档中找到帐户Array - > [[id, name, image,address], [id, name, image,address], [id, name, image,address], [id, name, image,address]] https://huobiapi.github.io/docs/spot/v1/en/#get-all-accounts-of-the-current-user

通过调用API https://api.huobi.pro/v1/account/accounts,您可以获得所有帐户及其类型。

如文档所述,类型值是:typespotmarginotcpoint

请注意,您可能没有上述所有帐户,除非您已激活它们。