This project provides a script to fetch, filter, and store financial data from the Financial Modeling Prep (FMP) API. The project includes functionality to save the data into a CSV file and a PostgreSQL database, along with Docker support for setting up PostgreSQL and pgAdmin.
- Fetch data from the Financial Modeling Prep API.
- Filter companies based on Indian exchanges (NSE and BSE).
- Save the filtered data into a CSV file.
- Push the data to a PostgreSQL database.
- Docker Compose setup for PostgreSQL and pgAdmin.
- Secure API key handling using
.env
files.
- Python 3.6 or later
- PostgreSQL (local or via Docker)
- Docker and Docker Compose (for PostgreSQL setup)
- A valid Financial Modeling Prep API Key
- Clone the Repository
git clone https://github.com/your-username/fmp_api.git cd fmp_api
- Set up Virtual Environment
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt
- Set up .env file
API_key=your_fmp_api_key
- Run the script
python fetch_companies.py
- Set up PostgreSQL
docker compose up -d
- Access pgAdmin Open http://localhost:8081 in your browser and configure PostgreSQL.