first commit
This commit is contained in:
30
systemd/crypto-trader.service
Normal file
30
systemd/crypto-trader.service
Normal file
@@ -0,0 +1,30 @@
|
||||
[Unit]
|
||||
Description=Kraken Crypto Trader Bot
|
||||
# Wait for network before running
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
|
||||
# ── Change this path to wherever you cloned the repo ──────────────────────
|
||||
WorkingDirectory=/opt/crypto-trader
|
||||
ExecStart=/opt/crypto-trader/venv/bin/python bot.py
|
||||
# ──────────────────────────────────────────────────────────────────────────
|
||||
|
||||
# Run as a dedicated low-privilege user (created by install.sh)
|
||||
User=crypto-trader
|
||||
Group=crypto-trader
|
||||
|
||||
# Harden the service: read-only filesystem except the working directory
|
||||
ProtectSystem=full
|
||||
ReadWritePaths=/opt/crypto-trader
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
|
||||
# Logs go to journald; view with: journalctl -u crypto-trader.service
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
21
systemd/crypto-trader.timer
Normal file
21
systemd/crypto-trader.timer
Normal file
@@ -0,0 +1,21 @@
|
||||
[Unit]
|
||||
Description=Run Kraken Crypto Trader Bot on schedule
|
||||
Requires=crypto-trader.service
|
||||
|
||||
[Timer]
|
||||
# Runs at 09:00, 13:00, and 17:00 UTC every day.
|
||||
# Adjust times to suit your strategy — the bot is quick (~10s) so running
|
||||
# 2–4 times a day is a reasonable frequency for a daily momentum strategy.
|
||||
OnCalendar=*-*-* 09:00:00 UTC
|
||||
OnCalendar=*-*-* 13:00:00 UTC
|
||||
OnCalendar=*-*-* 17:00:00 UTC
|
||||
|
||||
# If the system was off at a scheduled time, run once when it comes back up
|
||||
Persistent=true
|
||||
|
||||
# Randomise start time by up to 60 seconds to avoid thundering-herd issues
|
||||
# if you run multiple bots (safe to remove if you only have one)
|
||||
RandomizedDelaySec=60
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
Reference in New Issue
Block a user