Binance Candlestick Data is a Flask application that allows you to retrieve and save candlestick data from the Binance exchange and display candlestick charts on a web page.
- Retrieve candlestick data for a selected symbol (e.g., BTCUSDT, BNBUSDT, ETHUSDT) and interval (1 day, 4 hours, 1 hour) from the Binance exchange.
The user also has the ability to define the time interval at which the data will be saved in the UI - Save Interval field. By default, the interval will save data every 3600 seconds (1 hour).
I can also suggest adding a distributed task queue method, such as Celery. Additionally, it is possible to add a timer in the UI, which, once configured and activated, will initiate the saving of the specified data.
- Save the retrieved data to a CSV file (crypto_info/data.csv) and a PostgreSQL database.
Sample image of data stored in DB
Sample image of data stored in CSV
- Flask
- PosgreSQL
- Docker
- plotly
To install the application using GitHub, follow these steps:
- Navigate to the folder on your computer where you want to clone the project.
- Execute the following command:
git clone https://github.com/VladyslavCherkashyn/Binance-Data-Collector-and-Visualization.git
- Change into the cloned project directory:
cd Binance-Data-Collector-and-Visualization
- Create a virtual environment for the project:
python -m venv venv
- Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS:
source venv/bin/activate
- Install the dependencies:
pip install -r requirements.txt
- Run the bot:
python app.py
To work with the application, you need to create a .env file in the project's root folder and set the following environment variables:
(Get free API Key at Binance)
- ACTUAL_API_KEY: {Your Binance API key}
- ACTUAL_SECRET_KEY: {Your Binance secret key}
- POSTGRES_HOST: {PostgreSQL database host}
- POSTGRES_DB: {PostgreSQL database name}
- POSTGRES_USER: {PostgreSQL database user}
- POSTGRES_PASSWORD: {PostgreSQL database password}
- make sure you have installed Docker
- Run
docker-compose up --build