A professional-grade, modular stock trading and analysis platform with live and historical data, robust risk management, and modern Python packaging.
StockApp is a research and trading platform supporting live and historical data, modular strategies, risk management, and real-time alerts. It is designed for both backtesting and live trading, with a focus on maintainability and extensibility.
- Python 3.10+
- Docker (for TimescaleDB/Postgres)
- (Optional) Poetry for dependency management
- All settings are in
config/settings.yaml(seeconfig/settings.yaml.examplefor template) - Environment variables for secrets (API keys, Slack webhook, etc.)
# 1. Copy and edit config
cp config/settings.yaml.example config/settings.yaml
# 2. Start database
make docker-run
# 3. Install dependencies
pip install -r requirements.txt
# 4. Run Alembic migrations
make alembic-upgrade
# 5. Run the app
python -m stockapp.main+-------------------+
| config/settings |
+-------------------+
|
+-------------------+
| src/stockapp/ |
+-------------------+
| strategies/ |
| risk_manager.py |
| scanner.py |
| ... |
+-------------------+
|
+-------------------+
| data/ |
+-------------------+
| etoro_tickers.txt |
| ... |
+-------------------+
- Modular strategies in
src/stockapp/strategies/ - Risk management in
src/stockapp/risk_manager.py - Logging and Slack alerts in
src/logger.py - Database migrations with Alembic
MIT
The following environment variables are required:
DATABASE_URL: PostgreSQL connection stringALPACA_API_KEY: Your Alpaca API keyALPACA_API_SECRET: Your Alpaca API secretSECRET_KEY: Secret key for JWT tokens (generate with:openssl rand -hex 32)
YFINANCE_BACKFILL_CHUNK: Number of days to fetch in each backfill request (default: 100)POLLING_INTERVAL: Seconds between market data updates (default: 60)LOG_LEVEL: Logging level (default: INFO)SENTRY_DSN: Sentry DSN for error trackingCORS_ORIGINS: Comma-separated list of allowed originsREDIS_URL: Redis connection for task queueTEST_DATABASE_URL: Database URL for testing