initial: alpaclaudia paper-trading bot + dashboard
Python bot (bot/alpaclaudia): alpaca-py client, wheel strategy (CSP + covered calls) plus equity trailing stops, risk gates (cash buffer, cost-basis guard, per-symbol concentration cap), SQLite state log, Typer CLI (tick/loop/status/ report/dump-state), Discord daily report, pytest suite. Next.js 14 dashboard (dashboard/): read-only — reads the bot's SQLite directly and pulls live account/positions/orders from Alpaca. KPIs, equity chart, positions, bot-intents audit table, and orders table. Dark UI with Tailwind. systemd/: user-unit templates for the polling loop and the post-close report timer. docs/STRATEGY.md: wheel mechanics, risk invariants, later candidates. Defaults to BOT_MODE=dry — nothing is submitted to Alpaca until explicitly enabled in .env. ALPACA_ENV=paper by default; flipping to live requires an explicit second guard.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
# alpaclaudia — systemd units
|
||||
|
||||
Install as **user units** (no root needed):
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.config/systemd/user
|
||||
cp ~/finhacks/systemd/alpaclaudia-*.{service,timer} ~/.config/systemd/user/
|
||||
systemctl --user daemon-reload
|
||||
systemctl --user enable --now alpaclaudia-loop.service
|
||||
systemctl --user enable --now alpaclaudia-report.timer
|
||||
loginctl enable-linger $USER # so services keep running after logout
|
||||
```
|
||||
|
||||
Status / logs:
|
||||
|
||||
```bash
|
||||
systemctl --user status alpaclaudia-loop
|
||||
journalctl --user -u alpaclaudia-loop -f
|
||||
systemctl --user list-timers | grep alpaclaudia
|
||||
```
|
||||
|
||||
Switching to live mode:
|
||||
|
||||
```bash
|
||||
# in ~/finhacks/.env set BOT_MODE=live (ALPACA_ENV stays "paper" for paper acct)
|
||||
systemctl --user restart alpaclaudia-loop
|
||||
```
|
||||
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=alpaclaudia — Alpaca paper-trading loop
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/home/otto/finhacks
|
||||
EnvironmentFile=/home/otto/finhacks/.env
|
||||
ExecStart=/home/otto/finhacks/bot/.venv/bin/python -m alpaclaudia loop
|
||||
Restart=on-failure
|
||||
RestartSec=30
|
||||
StandardOutput=append:/home/otto/finhacks/logs/systemd.log
|
||||
StandardError=append:/home/otto/finhacks/logs/systemd.log
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=alpaclaudia — post daily Discord report
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
WorkingDirectory=/home/otto/finhacks
|
||||
EnvironmentFile=/home/otto/finhacks/.env
|
||||
ExecStart=/home/otto/finhacks/bot/.venv/bin/python -m alpaclaudia report
|
||||
StandardOutput=append:/home/otto/finhacks/logs/report.log
|
||||
StandardError=append:/home/otto/finhacks/logs/report.log
|
||||
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=alpaclaudia — daily Discord report after NYSE close
|
||||
|
||||
[Timer]
|
||||
# 22:30 Europe/Berlin ≈ 16:30 ET (30 min after 16:00 ET close); timer is in UTC,
|
||||
# systemd will apply the system timezone. Adjust if you run on a UTC server.
|
||||
OnCalendar=Mon..Fri 22:30
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
Reference in New Issue
Block a user