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,47 @@
|
||||
# --- Alpaca (Paper) -----------------------------------------------------------
|
||||
ALPACA_API_KEY=PK_your_paper_key_here
|
||||
ALPACA_API_SECRET=your_paper_secret_here
|
||||
# https://paper-api.alpaca.markets for paper, https://api.alpaca.markets for live
|
||||
ALPACA_BASE_URL=https://paper-api.alpaca.markets
|
||||
# Hard guard — must explicitly set to "live" to touch the live endpoint
|
||||
ALPACA_ENV=paper
|
||||
|
||||
# --- Bot runtime --------------------------------------------------------------
|
||||
# dry = log intended orders only. live = actually submit to Alpaca paper.
|
||||
BOT_MODE=dry
|
||||
# Universe for the wheel (comma-separated)
|
||||
WHEEL_UNIVERSE=TSLA
|
||||
# Target DTE window for cash-secured puts (days)
|
||||
WHEEL_PUT_DTE_MIN=14
|
||||
WHEEL_PUT_DTE_MAX=28
|
||||
# Target delta for CSPs (magnitude, e.g. 0.30 => ~30-delta short put)
|
||||
WHEEL_PUT_TARGET_DELTA=0.30
|
||||
# Strike distance for CSPs as fraction of spot (fallback when delta data missing)
|
||||
WHEEL_PUT_OTM_PCT=0.10
|
||||
# Strike distance for covered calls above cost basis (fraction)
|
||||
WHEEL_CALL_OTM_PCT=0.10
|
||||
# Minimum annualised yield (decimal) a candidate contract must offer
|
||||
WHEEL_MIN_ANNUAL_YIELD=0.15
|
||||
# Max concurrent short puts per symbol
|
||||
WHEEL_MAX_SHORT_PUTS_PER_SYMBOL=1
|
||||
|
||||
# Trailing-stop config (equity positions only)
|
||||
TRAILING_STOP_ENABLED=true
|
||||
TRAILING_STOP_PCT=0.08
|
||||
|
||||
# Position sizing — max % of equity to put at risk per symbol
|
||||
MAX_POSITION_PCT=0.25
|
||||
# Minimum cash buffer (as fraction of equity) to keep unencumbered
|
||||
MIN_CASH_BUFFER_PCT=0.05
|
||||
|
||||
# --- Scheduling ---------------------------------------------------------------
|
||||
# Polling interval (seconds) inside market hours when --loop is used
|
||||
TICK_INTERVAL_SECONDS=900
|
||||
|
||||
# --- Reporting ----------------------------------------------------------------
|
||||
# Discord webhook URL (optional). If set, daily report is posted after close.
|
||||
DISCORD_WEBHOOK_URL=
|
||||
|
||||
# --- Storage ------------------------------------------------------------------
|
||||
DATA_DIR=./data
|
||||
LOG_DIR=./logs
|
||||
Reference in New Issue
Block a user