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

2024-04-16 20:04:14 发布

您现在位置:Python中文网/ 问答频道 /正文

huobi的加密货币交换api:https://github.com/huobiapi/huobi_Python 要求一个Account type你看到它主要与Accounttype.spot()

我不知道这意味着什么,也不知道在文件或互联网上,你们谁知道可能有线索?我需要它来下订单


Tags: 文件https订单githubcomapitype货币
1条回答
网友
1楼 · 发布于 2024-04-16 20:04:14

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

spot账户是指霍比提供的各种可用的加密货币,而point账户代表霍比自己的点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)

注:在Accountinfo函数中设置global acc,就是把局部变量acc变成全局变量。因此,acc可用于布尔运算。你知道吗

相关问题 更多 >