To set up the project locally, follow these steps:
-
Install Poetry
This project uses Poetry for dependency management. If you don't have Poetry installed, you can install it usingpipx
:pipx install poetry
-
Clone the Repository
Clone this repository to your local machine:git clone https://github.com/Adaverse/stock-index.git cd stock-index
-
Install Dependencies
Use Poetry to install the project dependencies, which can be found inpyproject.toml
file:poetry install
-
Initialize DB
To import data from API of Yahoo Finance and initialize required tables, run below command (num-tickers is optional field which specifies how many tickers data to fetch from API. For quick testing it can be set to small values like 50):poetry run python top_100_stock_index/cli.py init-data --num-tickers 50
-
Initialize INDEX
After successful data import, we can initialize index data along with the required calculation from start till current date for top x stock by market cap with first argument being ticker name for index and second argument being the top_x to pick by market cap:poetry run python top_100_stock_index/cli.py init-or-update-index I25 25
-
Start UI
To start the streamlit UI, run below command:poetry run streamlit run top_100_stock_index/ui/main.py
For any cli related help, run
poetry run python top_100_stock_index/cli.py --help