-3

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

Umemmut
  • 3
  • 1

1 Answers1

0
client = Client(api_key,api_secret, testnet=True)
ChrisGPT was on strike
  • 127,765
  • 105
  • 273
  • 257