🚀 Professional algorithmic trading platform with automated workflows, real-time monitoring, and comprehensive analytics.
- No manual refreshing needed - Data updates every 60 seconds automatically
- Smart market scanning - Auto-scans during market hours (9:30 AM - 4:00 PM EST)
- Real-time market status - Shows OPEN/CLOSED and time until next event
- 3 background threads - Data, scanning, and dashboard updates
- Complete trade history with P&L tracking
- Filter by symbol and date range
- Win rate calculator and statistics
- CSV export for external analysis
- Press Ctrl+H to open
| Shortcut | Action |
|---|---|
Ctrl + R |
Refresh Data |
Ctrl + H |
Transaction History |
Ctrl + Q |
Quit Application |
F1 |
Show Help |
- Timezone-aware (Eastern Time)
- Pre-market and after-hours support
- Shows time until market open/close
- Auto-pauses scanning when market closed
- ✅ Manual order execution (market, limit, stop)
- ✅ Automated trading with technical analysis
- ✅ Bracket orders with TP/SL
- ✅ Risk management (daily loss limits, position sizing)
- ✅ Real-time market data
- ✅ Encrypted credential storage (Fernet)
- ✅ Input validation on all trades
- ✅ Rate limiting (200 calls/min)
- ✅ Comprehensive audit logging
- ✅ Emergency stop button
- ✅ Smart caching (80% fewer API calls)
- ✅ Retry logic with exponential backoff
- ✅ Connection pooling
- ✅ Optimized data fetching
- ✅ Structured logging system
- ✅ Real-time notifications
- ✅ Complete trade history
- ✅ Portfolio snapshots
- ✅ Performance analytics
cd /home/taj702/Software/StockTrader
# Install dependencies (if needed)
pip install --user pytz pystray
# Run the platform
./run.sh- Launch the application
- Go to Settings tab
- Enter Alpaca API credentials
- Enable Paper Trading (recommended)
- Click Connect to Alpaca
The platform automatically:
- Refreshes account data every 60 seconds
- Scans markets every 60 seconds (during market hours only)
- Updates dashboard every 5 seconds
- Saves portfolio snapshots to database
Market Status Indicators:
- 🟢 OPEN - Market is currently trading
- ⚫ CLOSED - Market is closed
- 🟡 PRE-MARKET - Before market open
- 🟠 AFTER-HOURS - After market close
Access via:
- Press Ctrl+H
- Or add menu item (Tools → Transaction History)
Features:
- View all trades with timestamps
- Filter by symbol or date range
- See win rate and total P&L
- Export to CSV for analysis
- Color-coded profits/losses
- Navigate to Trading tab
- Enter symbol and quantity
- Select order type (Market/Limit)
- Review quote
- Click BUY or SELL
- Navigate to Auto Trading tab
- Configure strategy parameters
- Click "Start Auto Trading"
- Monitor in activity log
- Stop anytime with "Stop Auto Trading"
All trades validated against:
- ✓ Daily loss limits (default: 5%)
- ✓ Position size limits (max: 50%)
- ✓ Symbol concentration (max: 30%)
- ✓ Maximum positions (default: 3)
Customize in config.py:
MAX_DAILY_LOSS = 0.05
MAX_POSITION_SIZE = 0.50
MAX_POSITION_CONCENTRATION = 0.30
DEFAULT_MAX_POSITIONS = 3StockTrader/
├── trading_platform.py # Main GUI application
├── config.py # Configuration settings
├── security.py # Encryption & validation
├── logger.py # Logging system
├── database.py # SQLite trade history
├── risk_manager.py # Risk controls
├── notification_system.py # Alerts
├── market_hours.py # NEW - Market detection
├── transaction_viewer.py # NEW - History viewer
├── data_manager.py # Market data (enhanced)
├── alpaca_trader.py # Broker API (enhanced)
├── strategy_engine.py # Trading strategies
├── requirements.txt # Dependencies
├── run.sh # Launcher script
└── logs/ # Log files
Edit config.py:
# Auto-Refresh
AUTO_REFRESH_ENABLED = True # Enable/disable
AUTO_REFRESH_INTERVAL = 60 # Data refresh (seconds)
AUTO_SCAN_INTERVAL = 60 # Market scanning (seconds)
DASHBOARD_UPDATE_INTERVAL = 5 # Dashboard (seconds)
# Market Hours
MARKET_TIMEZONE = "America/New_York"
MARKET_HOURS_START = "09:30"
MARKET_HOURS_END = "16:00"MAX_DAILY_LOSS = 0.05 # 5% max daily loss
MAX_POSITION_SIZE = 0.50 # 50% max per position
MAX_POSITION_CONCENTRATION = 0.30 # 30% max per symbolDEFAULT_MAX_POSITIONS = 3
DEFAULT_POSITION_SIZE = 0.10 # 10% of portfolio
DEFAULT_STOP_LOSS = 0.08 # 8%
DEFAULT_TAKE_PROFIT = 0.15 # 15%Location: trading_database.db
Tables:
trades- Complete trade historyportfolio_snapshots- Historical portfolio statespositions- Position trackingactivity_log- System eventsstrategy_performance- Strategy metrics
Query Examples:
from database import DatabaseManager
db = DatabaseManager()
trades = db.get_trades(symbol='NVDA', limit=50)
stats = db.get_trading_statistics()Location: logs/ directory
| File | Content |
|---|---|
trading_platform.log |
System events |
trading.log |
Trade executions |
security.log |
Security events |
performance.log |
Performance metrics |
Log Rotation:
- 10MB per file
- 5 backup files kept
- Automatic rotation
- Encrypted with Fernet (symmetric encryption)
- PBKDF2 key derivation (100,000 iterations)
- Salt stored separately
- Never committed to git
- Symbols: 1-5 uppercase letters
- Quantities: 1-10,000 range
- Prices: Positive, reasonable values
- 200 API calls per minute enforced
- Automatic request throttling
- Prevents API abuse
Trading Risk: This software is for educational purposes. Trading involves substantial risk of loss. Always use paper trading before live trading.
Not Financial Advice: This tool does not provide financial advice. You are responsible for your trading decisions.
API Limits: Respect Alpaca's API rate limits and terms of service.
# Check Python version
python3 --version # Need 3.8+
# Reinstall dependencies
pip install --user -r requirements.txt
# Use launcher script
./run.sh- Check
config.py→AUTO_REFRESH_ENABLED = True - Look for errors in
logs/trading_platform.log - Verify API connection in Settings tab
- Ensure trades have been executed
- Check
trading_database.dbexists - Verify database permissions
- Check internet connection
- Verify
pytzis installed - Check logs for timezone errors
- Alpaca API Docs: https://alpaca.markets/docs
- QUICKSTART.md: Launch troubleshooting
- Implementation Plan: See artifacts directory
- Walkthrough: Complete feature documentation
- Start with Paper Trading - Test strategies risk-free
- Monitor Logs - Watch
logs/trading.logfor activity - Set Conservative Limits - Start with low position sizes
- Use Auto-Refresh - Let the platform monitor for you
- Review Transaction History - Learn from past trades
- Backup Database - Export trades regularly
- ⏳ Enhanced candlestick charts
- ⏳ Portfolio equity curve visualization
- ⏳ Stock browser with search
- ⏳ System tray / background mode
- ⏳ Multi-timeframe analysis
- ⏳ Advanced backtesting
For issues or questions:
- Check
logs/for error details - Review
QUICKSTART.md - Verify all dependencies installed
- Ensure API credentials are correct
Version: 2.0.0
Last Updated: 2025-12-02
License: MIT