ibkr_trader.py computes the strategy's target for the close the way trader.py's morning phase does, sizes whole-share orders on min(NAV, $10.5k) less a 1% cash buffer against the account's real positions, and sends MOC orders, sells before buys. Guards: the login must manage IBKR_ACCOUNT; a live account needs --live and data/ibkr_live/ARMED; the account may hold only the strategy's universe; MOC whole-share orders only; one submission per session. After the close it records executions and commissions, scores each order against the primary exchange's closing cross (SIP condition 6) and compares NAV with the simulated account, with a preregistered verdict on the first 20 orders. A what-if run on the paper Gateway (no orders) accepted GLD/SHY MOC orders at $1.00 commission and rejected TQQQ/UPRO: the account lacks the Complex or Leveraged ETP permission. The live service is defined but not enabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
953 B
Bash
Executable File
24 lines
953 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# trend_rider_v10 in the IBKR live account (ibkr_trader.py daemon --live).
|
|
# Started by the quant-trading-ibkr-live.service systemd --user unit.
|
|
# Needs: a live IB Gateway on IBKR_PORT (default 4001), IBKR_ACCOUNT in .env,
|
|
# and data/ibkr_live/ARMED; without ARMED the daemon refuses to send orders.
|
|
# Yahoo is refreshed through QUANT_MARKET_PROXY as in start-monitor.sh;
|
|
# Alpaca and the local Gateway are reached directly.
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
PROJECT_ROOT="$( cd "$SCRIPT_DIR/.." && pwd )"
|
|
cd "$PROJECT_ROOT"
|
|
|
|
export PATH="/home/gahow/.local/bin:$PATH"
|
|
if [[ -f .env ]]; then
|
|
set -a; source .env; set +a
|
|
fi
|
|
if [[ -n "${QUANT_MARKET_PROXY:-}" ]]; then
|
|
export http_proxy="$QUANT_MARKET_PROXY" https_proxy="$QUANT_MARKET_PROXY" all_proxy="$QUANT_MARKET_PROXY"
|
|
export no_proxy="127.0.0.1,localhost,.alpaca.markets"
|
|
fi
|
|
|
|
exec uv run python ibkr_trader.py daemon --live
|