Giter VIP home page Giter VIP logo

binance_future_prices's Introduction

Binance Futures Prices

This tool retrieves historical price data for multiple symbols from Binance using their API and saves them into separate CSV files.

Requirements

The following libraries are imported:

Binance's API

pandas

requests

Installation

1-Clone the repository

2-Install the required libraries mentioned in requirements.txt

3-Create a config.json file containing your Binance API key and secret key as follows:

{ "API_KEY": "your_api_key_here", "SECRET_KEY": "your_secret_key_here" }

4-Modify the symbols.csv file to include the symbols you want to retrieve historical data for

Usage

The code imports the necessary libraries, including Binance's API, pandas, and requests. It then creates an instance of the Binance API client using the API key and secret key provided by the user in a config.json doc for making it secret and keep it private.

Next, the code retrieves the symbols from Binance using the client's exchangeInfo method and filtering the pairs of coins in trading status and the USDT currencies, which returns a list of dictionaries containing information about each symbol. The code then extracts the symbol names from the dictionaries and saves them into a CSV file using pandas' to_csv() method.

After the CSV file is created, the code reads it using pandas read_csv() method and loops through each symbol name. For each symbol, the code retrieves the historical price data using Binance's klines API endpoint, which returns a JSON object containing the open, high, low, and close prices, as well as other information, for each candlestick in the requested time period.

Then converts the JSON object into a pandas DataFrame and cleans it up by dropping unnecessary columns.

Finally, the DataFrame is saved into a CSV file using pandas' to_csv() method, with the filename being the symbol name appended with the date range of the historical data and the number os rows of the file.

Output Data

After the analysis, an Excel file will be generated for each pair in the analyzed list, formatted accordingly.

image

binance_future_prices's People

Contributors

arkanoeth avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.