47 lines
1.4 KiB
Bash
47 lines
1.4 KiB
Bash
|
|
#!/bin/bash
|
||
|
|
#
|
||
|
|
# Daily Stock Intelligence System Runner
|
||
|
|
# Runs at 12:00 PM every day to:
|
||
|
|
# 1. Re-scrape all stocks with latest data
|
||
|
|
# 2. Generate consolidated reports
|
||
|
|
# 3. Export to CSV
|
||
|
|
#
|
||
|
|
|
||
|
|
# Set working directory
|
||
|
|
cd /Users/macbook/Desktop/Victor
|
||
|
|
|
||
|
|
# Activate virtual environment if it exists
|
||
|
|
if [ -d "venv" ]; then
|
||
|
|
source venv/bin/activate
|
||
|
|
fi
|
||
|
|
|
||
|
|
# Use python3 explicitly
|
||
|
|
PYTHON_CMD="python3"
|
||
|
|
|
||
|
|
# Log file with date
|
||
|
|
LOG_FILE="logs/daily_run_$(date +%Y%m%d_%H%M%S).log"
|
||
|
|
mkdir -p logs
|
||
|
|
|
||
|
|
echo "========================================" | tee -a "$LOG_FILE"
|
||
|
|
echo "Stock Intelligence System - Daily Run" | tee -a "$LOG_FILE"
|
||
|
|
echo "Started: $(date)" | tee -a "$LOG_FILE"
|
||
|
|
echo "========================================" | tee -a "$LOG_FILE"
|
||
|
|
|
||
|
|
# Run the complete scraping and report generation (NASDAQ & TSX only)
|
||
|
|
echo "" | tee -a "$LOG_FILE"
|
||
|
|
echo "Running complete_scraper_with_reports.py..." | tee -a "$LOG_FILE"
|
||
|
|
$PYTHON_CMD complete_scraper_with_reports.py 2>&1 | tee -a "$LOG_FILE"
|
||
|
|
|
||
|
|
# Run CSV export
|
||
|
|
echo "" | tee -a "$LOG_FILE"
|
||
|
|
echo "Exporting to CSV..." | tee -a "$LOG_FILE"
|
||
|
|
$PYTHON_CMD export_csv.py 2>&1 | tee -a "$LOG_FILE"
|
||
|
|
|
||
|
|
echo "" | tee -a "$LOG_FILE"
|
||
|
|
echo "========================================" | tee -a "$LOG_FILE"
|
||
|
|
echo "Daily run completed: $(date)" | tee -a "$LOG_FILE"
|
||
|
|
echo "========================================" | tee -a "$LOG_FILE"
|
||
|
|
|
||
|
|
# Optional: Send notification or email
|
||
|
|
# echo "Daily stock intelligence update completed" | mail -s "Stock System Update" your@email.com
|