HuobiRDCenter / huobi_Python

Python SDK for Huobi Spot API
https://huobiapi.github.io/docs/spot/v1/en
Apache License 2.0
683 stars 333 forks source link

signature not valid #110

Open xswwhy opened 3 years ago

xswwhy commented 3 years ago

source code

from huobi.client.account import AccountClient
from huobi.client.generic import GenericClient
from huobi.client.market import MarketClient
from huobi.client.trade import TradeClient
from huobi.constant import CandlestickInterval

from huobi import privateconfig

if __name__ == '__main__':
    generic_client = GenericClient()
    ts = generic_client.get_exchange_timestamp()

    market_client = MarketClient()
    list_obj = market_client.get_candlestick("btcusdt", CandlestickInterval.MIN5, 10)

    account_clinet = AccountClient(api_key=privateconfig.p_api_key, secret_key=privateconfig.p_secret_key)
    ls = account_clinet.get_account_balance()
    for l in ls:
        l.print_object()

ls = account_clinet.get_account_balance() my api_key and sercet_key is valid, but this line will raise exception
huobi.exception.huobi_api_exception.HuobiApiException: ('ExecuteError', '[Executing] api-signature-not-valid: Signature not valid: Incorrect IP address [IP地址错误]:104.128.67.45')

PokerChang commented 2 years ago

Same for me. I tried multiple keys and none of them work.

PokerChang commented 2 years ago

@xswwhy actually your error is invalid IP address. Check if you bind any IP address.

My error is different:

(3) ➜ huobi_Python git:(master) ✗ python example/account/get_balance.py Traceback (most recent call last): File "example/account/get_balance.py", line 10, in list_obj = account_client.get_balance(account_id=g_account_id) File "/Users/changluo/Documents/GitHub/huobi_Python/3/lib/python3.6/site-packages/huobi_client-2.0.0-py3.6.egg/huobi/client/account.py", line 41, in get_balance File "/Users/changluo/Documents/GitHub/huobi_Python/3/lib/python3.6/site-packages/huobi_client-2.0.0-py3.6.egg/huobi/service/account/get_balance.py", line 24, in request File "/Users/changluo/Documents/GitHub/huobi_Python/3/lib/python3.6/site-packages/huobi_client-2.0.0-py3.6.egg/huobi/connection/restapi_sync_client.py", line 116, in request_process File "/Users/changluo/Documents/GitHub/huobi_Python/3/lib/python3.6/site-packages/huobi_client-2.0.0-py3.6.egg/huobi/connection/restapi_sync_client.py", line 121, in request_process_product File "/Users/changluo/Documents/GitHub/huobi_Python/3/lib/python3.6/site-packages/huobi_client-2.0.0-py3.6.egg/huobi/connection/impl/restapi_invoker.py", line 67, in call_sync File "/Users/changluo/Documents/GitHub/huobi_Python/3/lib/python3.6/site-packages/huobi_client-2.0.0-py3.6.egg/huobi/connection/impl/restapi_invoker.py", line 30, in check_response huobi.exception.huobi_api_exception.HuobiApiException: ('ExecuteError', '[Executing] api-signature-not-valid: Signature not valid: Incorrect Access key [Access key错误]')