Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Issue with FTX US API

I have looked through the FTX API documentation found here: 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

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Let me know if you need any more information, my code returns

Error Code: 400 Invalid API Key

            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()

>Solution :

I also got this error and It was a silly mistake.

I think you have FTX.US API Key and you are hitting on https://ftx/api/wallet/balances’. U should hit on https://ftx.us/api/wallet/balances’ to get this working

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading