I’m using the python client, spot is fine – but I’m having error when using the future API.
For this sample code:
from binance.um_futures import UMFutures
uc_main = UMFutures(key=api_key, secret=api_secret)
uc_main.account()
Here’s the error:
(401, -2015, 'Invalid API-key, IP, or permissions for action', {'Content-Type': 'application/json', 'Content-Length': '69', 'Connection': 'keep-alive', 'Date': 'Sun, 22 Dec 2024 12:16:54 GMT', 'Server': 'Tengine', 'x-mbx-used-weight-1m': '5', 'x-response-time': '1ms', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS', 'X-Cache': 'Error from cloudfront', 'Via': '1.1 bb3b53329b7d6969e73add618e731326.cloudfront.net (CloudFront)', 'X-Amz-Cf-Pop': 'SIN2-P8', 'X-Amz-Cf-Id': 'GJO0R-2_hUu-0VlJGJSRMFss414_mx6scDYBUm06hpsf8lQ7LkMwQA=='})
And herere’s the debug output:
DEBUG:root:url: https://fapi.binance.com/fapi/v3/account
DEBUG:urllib3.connectionpool:Resetting dropped connection: fapi.binance.com
DEBUG:urllib3.connectionpool:https://fapi.binance.com:443 "GET /fapi/v3/account?timestamp=1734869814868&signature=030b8468d136f15b706cc24784e8bfc9a7177de98142fbee2fac0a4ce1456171 HTTP/11" 401 69
DEBUG:root:raw response from server:{"code":-2015,"msg":"Invalid API-key, IP, or permissions for action"}
Here’s my API permission settings:
I’ve already set my IP address as the restricted IP.
Pls let me know if there’re other things that I need to try
Update 1: Here’s the success case for spot:
from binance.spot import Spot
sc = Spot(
api_key=api_key,
api_secret=api_secret,
)
sc.account()
output:
DEBUG:root:url: https://api.binance.com/api/v3/account
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.binance.com:443
DEBUG:urllib3.connectionpool:https://api.binance.com:443 "GET /api/v3/account?timestamp=1734850014833&signature=d7eec948aa7e2984ea7379217c15e9f88d2d6cc3294ceb0436ccd637758aa543 HTTP/11" 200 3273
DEBUG:root:raw response from server: