Skip to content

MegAMog/python-snowflake-stock-trading-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

python-stock-trading-app

This project uses the Polygon.io API to extract stock market data.

Step 1. Get a Polygon.io API Key

  • Register at polygon.io and generate your API key.
  • Create a .env file 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'

Step 2. Set Up the Environment

  1. Create virtual environment (with python or python3 depending on your Python version)
python3 -m venv venv
  1. Activate it
  • macOS/Linux (bash):
source venv/bin/activate
  • Windows (PowerShell):
.\venv\Scripts\activate
  1. Install dependencies
pip install -r requirements.txt

Step 3. Run the App

  1. Run the main script Execute script.py using python or python3:
python3 script.py
  1. Run the scheduler Execute scheduler.py to automatically run script.py every 10 minutes:
python3 scheduler.py

Note: 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.

Project Structure

.
├── data
│   └── tickers.csv
├── LICENSE
├── pythonvenv
│   ├── bin
│   ├── include
│   ├── lib
│   └── pyvenv.cfg
├── README.md
├── requirements.txt
├── scheduler.py
└── script.py

Notes

  • Make sure your .env file is not committed to Git (add it to .gitignore).
  • After installing new packages, update dependencies with:
pip freeze > requirements.txt

About

This uses a polygon.io API to extract data about stocks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages