https://github.com/pedrosfaria2/flask_binance
A web app to collect and analyse market data
https://github.com/pedrosfaria2/flask_binance
css docker flask html html5 javascript market-data pytest python python3 rabbitmq rest-api sql websocket websocket-api
Last synced: about 23 hours ago
JSON representation
A web app to collect and analyse market data
- Host: GitHub
- URL: https://github.com/pedrosfaria2/flask_binance
- Owner: pedrosfaria2
- Created: 2024-07-24T02:17:00.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-27T01:41:27.000Z (over 1 year ago)
- Last Synced: 2025-02-23T23:28:22.460Z (about 1 year ago)
- Topics: css, docker, flask, html, html5, javascript, market-data, pytest, python, python3, rabbitmq, rest-api, sql, websocket, websocket-api
- Language: Python
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Binance WebSocket Market Data
This project is a web application that uses WebSockets to receive real-time market data from Binance and detects price anomalies. The application is built with Flask on the backend and uses Socket.IO for real-time communication with the frontend.
## Features
- Connects to Binance WebSocket API to receive real-time market data.
- Detects price anomalies using a Z-Score algorithm.
- Publishes price anomaly alerts to a RabbitMQ queue.
- Web interface to view market data and alerts in real-time.
## Installation
### Prerequisites
- Python 3.8 or higher
- RabbitMQ
- Docker
### Steps to Install
1. Clone the repository:
```bash
git clone https://github.com/pedrosfaria2/flask_binance.git
cd flask_binance
```
2. Create a virtual environment and activate it:
```bash
python -m venv .venv
source .venv/bin/activate # For Linux/MacOS
.\.venv\Scripts\activate # For Windows
```
3. Install the dependencies:
```bash
pip install -r requirements.txt
```
## Usage
1. Start RabbitMQ using Docker:
```bash
docker-compose up --build
```
2. Start the backend server:
```bash
python run.py
```
3. Open your web browser and go to [http://localhost:5000](http://localhost:5000).
4. Click "Start WebSocket".
5. Subscribe to any symbols you are interested in.
6. Start the price anomaly worker:
```bash
python -m price_anomaly_worker.run_worker
```
Note: The anomaly detection algorithm is configured with a 1-second interval so that alerts can be seen more frequently to experiment with the app. Feel free to adjust it as needed.
7. Enjoy the real-time market data and alerts!
## Tests
- The project includes a comprehensive suite of unit tests.
- To run the tests, simply execute:
```bash
pytest
```