This project uses the Polygon.io API to extract stock market data.
- Register at polygon.io and generate your API key.
- Create a
.envfile in the project root and add your key:
POLYGON_API_KEY = 'your_api_key_here'
SNOWFLAKE_ACCOUNT='your_account_here'
SNOWFLAKE_USER='your_user_here'
SNOWFLAKE_PASSWORD='your_password_here'
SNOWFLAKE_WAREHOUSE='your_warehouse_here'
SNOWFLAKE_DATABASE='your_database_here'
SNOWFLAKE_SCHEMA='your_schema_here'
SNOWFLAKE_ROLE='your_role_here'- Create virtual environment (with python or python3 depending on your Python version)
python3 -m venv venv- Activate it
- macOS/Linux (bash):
source venv/bin/activate- Windows (PowerShell):
.\venv\Scripts\activate- Install dependencies
pip install -r requirements.txt- Run the main script Execute script.py using python or python3:
python3 script.py- Run the scheduler Execute scheduler.py to automatically run script.py every 10 minutes:
python3 scheduler.pyNote: The scheduler will wait 10 minutes before the first run. If you want to run the script immediately and then every 10 minutes, you need to modify the scheduler to run script.py once at startup.
.
├── data
│ └── tickers.csv
├── LICENSE
├── pythonvenv
│ ├── bin
│ ├── include
│ ├── lib
│ └── pyvenv.cfg
├── README.md
├── requirements.txt
├── scheduler.py
└── script.py- Make sure your
.envfile is not committed to Git (add it to .gitignore). - After installing new packages, update dependencies with:
pip freeze > requirements.txt