https://github.com/tamk-kol/mutual_fund_data_scrapper
This Python script fetches and stores mutual fund data from the MFAPI as CSV files. The script retrieves a list of mutual funds and then downloads their individual data, saving each to a CSV file in a specified folder.
https://github.com/tamk-kol/mutual_fund_data_scrapper
datascraper datascraping mutual-funds pandas pandas-library pandas-python python3 tqdm
Last synced: 8 months ago
JSON representation
This Python script fetches and stores mutual fund data from the MFAPI as CSV files. The script retrieves a list of mutual funds and then downloads their individual data, saving each to a CSV file in a specified folder.
- Host: GitHub
- URL: https://github.com/tamk-kol/mutual_fund_data_scrapper
- Owner: tamK-kol
- Created: 2024-07-15T06:09:26.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-09-21T19:47:09.000Z (about 1 year ago)
- Last Synced: 2025-01-06T09:46:06.801Z (9 months ago)
- Topics: datascraper, datascraping, mutual-funds, pandas, pandas-library, pandas-python, python3, tqdm
- Language: Jupyter Notebook
- Homepage:
- Size: 47.4 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mutual Fund Data Scraper
This Python script fetches and stores mutual fund data from the [MFAPI](https://api.mfapi.in/) as CSV files. The script retrieves a list of mutual funds and then downloads their individual data, saving each to a CSV file in a specified folder.
## Features
- Fetches mutual fund data from the MFAPI.
- Creates a directory (if it doesn't exist) to store the CSV files.
- Saves each mutual fund's data as a separate CSV file, named by its scheme code.## Requirements
- Python 3.x
- Packages: `requests`, `pandas`, `tqdm`## Installation
1. Install Python 3.x if not already installed.
2. Install the required Python packages by running the following command:
```bash
pip install requests pandas tqdm
```## How to Use
1. Clone or download this script to your local machine.
2. Run the script with Python:
```bash
python scrape_mf.py
```
3. The script will:
- Fetch the list of all mutual funds from `https://api.mfapi.in/mf`.
- Save each mutual fund's data as a CSV file in a folder named `mf_data`.## Output
The CSV files will be saved in the `mf_data` folder in the current directory. Each file is named by the mutual fund's scheme code, e.g., `12345.csv`.## Error Handling
- The script checks for errors when fetching data from the API. If an error occurs, it will print the error message and stop the execution.