[英]Issue with FTX US API
I have looked through the FTX API documentation found here: https://docs.ftx.us/#overview我查看了此处的FTX API 文档: https://docs.ftx.us/#overview
And I've looked at the example code found in this repo: https://github.com/ftexchange/ftx/tree/master/rest我查看了这个 repo 中的示例代码: https://github.com/ftexchange/ftx/tree/master/rest
I can't get or post anything that requires Authentication.我无法获取或发布任何需要身份验证的内容。 I am using the API key on my account that has 'full trade permissions', and when I look at print(request.headers) the headers look like they are in the right format.
我在具有“完全交易权限”的帐户上使用 API 密钥,当我查看 print(request.headers) 时,标题看起来格式正确。
Let me know if you need any more information, my code returns如果您需要更多信息,请告诉我,我的代码返回
Error Code: 400 Invalid API Key错误代码:400 API 密钥无效
import time
import hmac
from requests import Request
ts = int(time.time() * 1000)
request = Request('GET', 'https://ftx/api/wallet/balances')
prepared = request.prepare()
signature_payload = f'{ts}{prepared.method}{prepared.path_url}'.encode()
signature = hmac.new('API SECRET'.encode(), signature_payload, 'sha256').hexdigest()
request.headers[f'FTXUS-KEY'] = API KEY'
request.headers[f'FTXUS-SIGN'] = signature
request.headers[f'FTXUS-TS'] = str(ts)
res = requests.get('https://ftx/api/wallet/balances', headers=prepared.headers)
r = res.json()
I also got this error and It was a silly mistake.我也遇到了这个错误,这是一个愚蠢的错误。
I think you have FTX.我想你有 FTX。 US API Key and you are hitting on 'https://ftx/api/wallet/balances' .
US API 密钥,您正在点击“https://ftx/api/wallet/balances” 。 U should hit on 'https://ftx.us/api/wallet/balances' to get this working
你应该点击“https://ftx.us/api/wallet/balances”来让它工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.