The Stock Market Analysis API provides a set of endpoints to retrieve and compare financial data for various companies. This API allows users to search for stock names, get detailed stock information, retrieve historical data, get real-time quote data, and compare companies within the same industry.
- Search for stock names by company name.
- Retrieve detailed stock information.
- Get historical stock data.
- Fetch real-time quote data.
- Compare companies within the same industry.
-
Clone the repository:
git clone https://github.com/yourusername/stock-market-analysis-api.git cd stock-market-analysis-api
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the dependencies:
pip install -r requirements.txt
-
Run the Flask application:
python app.py
📚 Usage API Endpoints
-
Search for a Company
- Endpoint: /search
- Method: GET
- Parameters:
- company (required): The name of the company to search for.
- Example:
curl "http://127.0.0.1:5000/search?company=Microsoft"
-
Get Stock Information
- Endpoint: /stock
- Method: GET
- Parameters: symbol (required): The stock symbol of the company.
- Example:
curl "http://127.0.0.1:5000/stock?symbol=MSFT"
-
Get Historical Data
- Endpoint: /historical
- Method: GET
- Parameters:
- symbol (required): The stock symbol of the company.
- start_date (required): The start date for the historical data (format: YYYY-MM-DD).
- end_date (required): The end date for the historical data (format: YYYY-MM-DD).
- interval (optional): The interval for the historical data (default: 1d).
- Example:
curl "http://127.0.0.1:5000/historical?symbol=MSFT&start_date=2023-01-01&end_date=2023-12-31&interval=1d"
-
Get Quote Data
- Endpoint: /quote
- Method: GET
- Parameters:
- symbol (required): The stock symbol of the company.
- Example:
curl "http://127.0.0.1:5000/quote?symbol=MSFT"
-
Compare Companies
- Endpoint: /compare
- Method: GET
- Parameters:
- symbol (required): The stock symbol of the company.
- num_companies (optional): The number of companies to compare (default: 5).
- include_historical (optional): Whether to include historical data (default: false).
- Example:
curl "http://127.0.0.1:5000/compare?symbol=MSFT&num_companies=5&include_historical=true"