Files
lowkey_backtest/install_cron.sh
Simon Moisy b5550f4ff4 Add daily model training scripts and terminal UI for live trading
- Introduced `train_daily.sh` for automating daily model retraining, including data download and model training steps.
- Added `install_cron.sh` for setting up a cron job to run the daily training script.
- Created `setup_schedule.sh` for configuring Systemd timers for daily training tasks.
- Implemented a terminal UI using Rich for real-time monitoring of trading performance, including metrics display and log handling.
- Updated `pyproject.toml` to include the `rich` dependency for UI functionality.
- Enhanced `.gitignore` to exclude model and log files.
- Added database support for trade persistence and metrics calculation.
- Updated README with installation and usage instructions for the new features.
2026-01-18 11:08:57 +08:00

30 lines
747 B
Bash
Executable File

#!/bin/bash
# Install cron job for daily model training
# Runs daily at 00:30
PROJECT_DIR="/home/tamaya/Documents/Work/TCP/lowkey_backtest_live"
SCRIPT_PATH="$PROJECT_DIR/train_daily.sh"
LOG_PATH="$PROJECT_DIR/logs/training.log"
# Check if script exists
if [ ! -f "$SCRIPT_PATH" ]; then
echo "Error: $SCRIPT_PATH not found!"
exit 1
fi
# Make executable
chmod +x "$SCRIPT_PATH"
# Prepare cron entry
# 30 0 * * * = 00:30 daily
CRON_CMD="30 0 * * * $SCRIPT_PATH >> $LOG_PATH 2>&1"
# Check if job already exists
(crontab -l 2>/dev/null | grep -F "$SCRIPT_PATH") && echo "Cron job already exists." && exit 0
# Add to crontab
(crontab -l 2>/dev/null; echo "$CRON_CMD") | crontab -
echo "Cron job installed successfully:"
echo "$CRON_CMD"