https://github.com/nfaltir/stock-ticker-api
🍊 A simple python api web application that uses the FastApi Framework. This application allows user to fetch stock tickers from the SP500 index.
https://github.com/nfaltir/stock-ticker-api
api fastapi finance python
Last synced: 2 months ago
JSON representation
🍊 A simple python api web application that uses the FastApi Framework. This application allows user to fetch stock tickers from the SP500 index.
- Host: GitHub
- URL: https://github.com/nfaltir/stock-ticker-api
- Owner: nfaltir
- Created: 2021-10-08T09:02:30.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-12-31T05:16:49.000Z (over 4 years ago)
- Last Synced: 2025-10-07T02:55:27.919Z (9 months ago)
- Topics: api, fastapi, finance, python
- Language: Python
- Homepage:
- Size: 99.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Python FastAPI App
version: 1.2.1.0
Overview
This is a small python application that uses the Fastapi Framework. This app creates api endpoints
that users can use to fetch stock tickers from the SP500, you can filter tickers by sector.
## Install Python Modules setup
pip3 install -r requirements.txt
## Run App locally
uvicorn:api:app --reload
Base URL: localhost:8000/
By default, local server will run on port:8000, if this port is not open, server will run on a different port
check code output for specified port.
API Endpoints
----------------------
Endpoint
Data
{baseurl}/
Index Page
{baseurl}/docs
Fastapi Docs
{baseurl}/get-tickers/sp500
All SP 500 Tickers
{baseurl}/sectors
All sector names in SP500
{baseurl}/get-tickers{sector_id}
ALL stock tickers in target sector
Sector Id(s)
financials
consumer-cyclical
real-estate
utilities
basic-materials
communication-services
healthcare
technology
consumer-defensive
financial-services
industrials
Example: Usage
--------------
objective: After running app locally, Get all stock tickers from Engergy sector in Sp500 index.
localhost:8000/get-tickers/energy
Output Figure

Deploy to Heroku
--------------
1. Create a requirements file that lists all required modules
inside project folder run this command: `pip3 freeze > requirements.txt`
2. Remember to specify which python version you are using by creating a runtime.txt file `touch runtime.txt`
Heroku will need this file.
file is both case and space sensitive, use this format: `python-3.9.7`
3. Create a Procfile
`touch Procfile`
type the following: `web: uvicorn api:app --host=0.0.0.0 --port=${PORT:-5000}`