- Summary: Extracting data from fyers for stocks using websocket(realtime) storing the data into clickhouse (analytics) db, created latest-data and historical-data api endpoints.
- Created two endpoints: Latest data and historical data
- Health Check Endpoint: Provides a health check endpoint for monitoring application status.
- Dockerized Deployment: Easy deployment using Docker.
- Python Version 3.12 or higher.
- FastAPI RestAPI python framework
- Poetry: A tool for dependency management and packaging.
- Clickhouse Database to store stock data
- Docker: For containerization.
.
├── .gitignore
├── README.md
├── clickhouse/
├── docker-compose.yml
├── fastapi_service/
└── ingestion_services/
└── crawlers/
-
Clone the repository:
git clone https://github.com/Narayanprajapat/FastAPI-Clickhouse cd FastAPI-CRUD
-
Create .env for ingestion_services/.env:
CLIENT_ID="" ACCESS_TOKEN="
-
Run Docker Compose:
docker-compose up --build
- URL:
http://localhost:8080/docs
-
Endpoint:
http://localhost:8080/api/v1/health
-
Method:
GET
-
Description: Checks the health status of the application.
-
Example Response:
{ "status_code": 200, "message": "Server is running" }
- Base URL: ``http://localhost:8080/api/v1`
-
Endpoint:
/latest/{symbol}
-
Method:
GET
-
Description: Latest data for stock
-
Example Response:
{ "symbol": "TCS", "close": 3133.39990234375, "open": 3144, "last_updated": "2025-09-13T14:40:56" }
-
Endpoint:
/history/{symbol}
-
Method:
GET
-
Description: Get all history based on symbol.
-
Example Response:
[ { "symbol": "TCS", "close": 3133.39990234375, "open": 3144, "date": "2025-09-13", "high": 3148.699951171875, "low": 3121, "volume": 428361432 } ]
We welcome contributions! To contribute:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Implement your changes.
- Write tests for your changes.
- Submit a pull request.