Loading...

[PLUS] How to Use FTX API with Python: Full Working Code

FTX Exchange is quite popular and we have received many requests for Python code examples. In this article, we are going to walk through the code to pull any specific historical time period and for any symbol chosen. Also, we build in the flexibility to choose the time period granularity (minute, hour, or daily) and then write our results to a CSV file. All of our code is extensively documented line by line so you know exactly what is going on! The code leverages a variety of Python data structures and libraries to make our job as simple as possible. The Python code is ready to run right away on Python versions 3.4+

Some of the functions and steps involved include:
(1) Converting timestamps to Unix timestamps
(2) Using the requests library to access the API endpoint
(3) Loading the FTX API's JSON response to a Pandas Dataframe
(4) Looping over a given timeperiod repeating steps 2 & 3 for user given date range
(5) Save the resulting file to a CSV file

This is a premium post. Create Plus+ Account to view the live, working codebase for this article.




Notice: Information contained herein is not and should not be construed as an offer, solicitation, or recommendation to buy or sell securities. The information has been obtained from sources we believe to be reliable; however no guarantee is made or implied with respect to its accuracy, timeliness, or completeness. Author does not own the any crypto currency discussed. The information and content are subject to change without notice. CryptoDataDownload and its affiliates do not provide investment, tax, legal or accounting advice.

This material has been prepared for informational purposes only and is the opinion of the author, and is not intended to provide, and should not be relied on for, investment, tax, legal, accounting advice. You should consult your own investment, tax, legal and accounting advisors before engaging in any transaction. All content published by CryptoDataDownload is not an endorsement whatsoever. CryptoDataDownload was not compensated to submit this article. Please also visit our Privacy policy; disclaimer; and terms and conditions page for further information.