英文:
Connection to Binance Spot Testnet API
问题
I'm working on a trading bot that actually works and I would like to try it for a week on the Binance testnet.
Despite all my research, I don't find a way to connect,
I already read all the Binance test net documentation
I'm sure about my API's
And this code is not working
import ccxt
import os
from binance.client import Client
api_key = os.environ.get('KEY')
api_secret = os.environ.get('SECRET')
client = Client(api_key, api_secret)
client.API_URL = 'https://testnet.binance.vision/api'
print(client.get_account())
This is the error that the code gives me
Traceback (most recent call last):
File "c:\Users\hp\Desktop\CODE\BOT CRYPTO\A) le BOT\les bots qui fonctionne\import ccxt.py", line 12, in <module>
print(client.get_account())
File "C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\binance\client.py", line 2052, in get_account
return self._get('account', True, data=params)
File "C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\binance\client.py", line 414, in _get
return self._request_api('get', path, signed, version, **kwargs)
File "C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\binance\client.py" return sig_func(query_string)
File "C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\binance\client.py", line 258, in _hmac_signature assert self.API_SECRET, "API Secret required for private endpoints"
AssertionError: API Secret required for private endpoints
If you have any information or solutions regarding my problem, I will gladly listen.
Thank you so much in advance
英文:
I'm working on a trading bot that actualy work and I would like to try it for a week on the Binance testnet.
Despite all my research, i don't find a way to connect,
I already read all the binance test net documentation
I'm sure about my API's
And this code is not working
import ccxt
import os
from binance.client import Client
api_key = os.environ.get('KEY')
api_secret = os.environ.get('SECRET')
client = Client(api_key, api_secret)
client.API_URL = 'https://testnet.binance.vision/api'
print(client.get_account())
This is the Error that give me the code
Traceback (most recent call last):
File "c:\Users\hp\Desktop\CODE\BOT CRYPTO\A) le BOT\les bots qui fonctionne\import ccxt.py", line 12, in <module>
print(client.get_account())
File "C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\binance\client.py", line 2052, in get_account
return self._get('account', True, data=params)
File "C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\binance\client.py", line 414, in _get
return self._request_api('get', path, signed, version, **kwargs)
File "C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\binance\client.py" return sig_func(query_string)
File "C:\Users\hp\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\binance\client.py", line 258, in _hmac_signature assert self.API_SECRET, "API Secret required for private endpoints"
AssertionError: API Secret required for private endpoints
If you have any information or solutions regarding my problem, I will gladly listen.
Thank you so much in advance
答案1
得分: 0
client = Client(api_key, api_secret, testnet=True)
英文:
client = Client(api_key,api_secret, testnet=True)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论