Hi,
I am trying to connect to the Futures servers on Binance (and access the contents in the Futures Wallet)
I had created the API key several times on Binance.
I have followed the suggestions listed here and created a NEW API Key - several times:
…binance.vision/t/why-do-i-see-this-error-invalid-api-key-ip-or-permissions-for-action/93
…binance.zendesk.com/hc/en-us/articles/360043210712-Updates-to-the-Binance-Futures-API
When attempting to connect, I get:
MESSAGE : ERR-52D073683{“code”:-2015,“msg”:“Invalid API-key, IP, or permissions for action, request ip: 144.282.227.147”}
So, I CHANGED the WORKING API KEY so that it would process FUTUREs request too. I REMOVED the NEW key
I still got the same error:
When attempting to connect, I get:
MESSAGE : ERR-52D073683{“code”:-2015,“msg”:“Invalid API-key, IP, or permissions for action, request ip: 145.292.27.147”}
I used to have a white-listed IP Address but I have removed that option (in an effort to figrue out what is going wrong).
I was not sure if it had something to do with the API servers being used.
What other things can I try to figure out what the problem is. Why is it taking place?
Any help, hints or advice would be greatly appreciated.
Regards.
I have the following code below :
---------------------------------------------
– initialize the connection
---------------------------------------------
def initialize_connection( in_futures = False):
try : if ( in_futures == False ): LD_API_KEY = os.getenv("BINANCE_APIKEY") LD_API_SECRET = os.getenv("BINANCE_API_SECRET") conn_exchange = ccxt.binance({ 'apiKey' : LD_API_KEY, 'secret' : LD_API_SECRET, 'enableRateLimit': True, }) elif ( in_futures == True ): LD_API_KEY = os.getenv("BINANCE_APIKEY_MARGIN") LD_API_SECRET = os.getenv("BINANCE_API_SECRET_MARGIN") conn_exchange = ccxt.binance({ 'apiKey': LD_API_KEY, 'secret': LD_API_SECRET, 'timeout': 30000, 'enableRateLimit': True, 'options': { 'defaultType': 'future', }, }) else: raise CustomProgramError('11408', 'invalid choice made ' + str( in_futures) ) return( conn_exchange )
---------------------------------------------
– getting the balances:
---------------------------------------------
def get_bank_balances(in_futures = False, in_symbol = ‘’, print_info = False):
try :[ … snip …]
exchange = initialize_connection( in_futures )
[ … snip …]
# reference: https://unpkg.com/ccxt@1.10.633/doc/manual.rst wallets = exchange.fetch_balance()
[ … snip …]
– error message
2020-07-13 14:17:43 - ERROR - 26699 - test - ERROR
MESSAGE : ERR-9E25D696D{“code”:-2015,“msg”:“Invalid API-key, IP, or permissions for action, request ip: 112.242.29.197”}2020-07-13 14:17:43 - ERROR - 26699 - test - ERROR
MESSAGE : ERR-9E25D696D - Traceback (most recent call last):
File “/usr/local/lib/python3.7/dist-packages/ccxt/base/exchange.py”, line 568, in fetch
response.raise_for_status()
File “/usr/lib/python3/dist-packages/requests/models.py”, line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://fapi.binance.com/fapi/v1/account?timestamp=1594649863166&recvWindow=5000&signature=39503a217abc23o2o4075fc3d03af19c2c2b56372b018d3940693fk422c2782
– what I have tried doing
I have looked at the following old messages below:
#Ref: New Binance Futures API Endpoint With 10x Performance