Files
local-trading-agent/README.md
T

7.5 KiB

Local Trading Agent — five-market paper profile

This update extends the existing app. It does not place real orders or promise income. The original crypto-dip profile remains available via python3 bot.py --loop.

Five markets

Instrument Strategy Completed candle timeframe
SPY — S&P 500 ETF Buy close below SMA(20) minus 2 standard deviations; exit at SMA(20) 15 minutes
QQQ — Nasdaq-100 ETF Same mean-reversion rule 15 minutes
BTC-USD — Bitcoin Buy close above previous 20 highs; exit below previous 10 lows 1 hour
GLD — gold ETF proxy Buy SMA(20) crossing above SMA(50); exit when below 4 hours
USO — oil ETF proxy Same trend-following rule 4 hours

These are explicit implementations of the Reel's vague strategy descriptions, not a reproduction of verified proprietary rules. GLD and USO are ETFs, not spot gold/oil. USO's futures exposure and roll effects can diverge from spot oil.

Run locally (Python 3.10+ on Linux)

No third-party Python packages are needed by the app. Set APCA_API_KEY_ID and APCA_API_SECRET_KEY in the environment to your Alpaca paper-account keys. Do not commit keys or paste them into chat. The keys are used only for read-only market data and the market clock; this app has no order endpoint calls.

python3 five_market.py --config-check
python3 five_market.py --once
python3 five_market.py --loop

Run the dashboard in another terminal:

python3 dashboard.py --profile five --host 127.0.0.1 --port 8765

Open http://127.0.0.1:8765. The worker scans every five minutes. The dashboard can also request a scan and download a current text report. There is no automatic email/Discord delivery or AI self-modification in this release.

Without Alpaca keys, ETF rows report a setup error; BTC can still scan using public Coinbase data. Existing ETF positions with unavailable market status block new entries across the account. When the ETF session is legitimately closed, those positions retain their previous marks and BTC may continue.

Docker / Unraid starting point

Copy .env.example to .env, fill in the two paper-account credentials, then:

docker compose up -d --build

The included Compose file runs a worker and dashboard sharing one persistent trading-data volume. It binds the dashboard to the Docker host's loopback interface only. Use your authenticated reverse proxy for remote access. The app has no built-in authentication; do not expose it directly to the Internet. This package is not an installed Unraid Community Applications template. Docker image build and installation on your host were not tested here.

Account and risk controls

  • Separate $100 ledger in data/five-market/; original data/state.json is untouched.
  • $0.50 maximum planned risk per trade at the initial balance; 1.5% aggregate planned risk.
  • Stop trigger 1% below simulated entry. Current sampled price determines exit fills.
  • Volatility (ATR 14) reduces position allocation; 35% individual and 75% total exposure caps.
  • One position across SPY, QQQ and BTC combined. This is a fixed exposure group, not a statistical rolling-correlation estimate. SPY receives priority when simultaneous signals compete.
  • 2% daily equity-loss pause, latched until the next New York calendar day; 6% drawdown pause.
  • Fees and slippage on both entry and exit, configurable separately for ETFs and crypto.
  • Only completed strategy bars, fresh latest-trade checks, duplicate-entry prevention, and a shared process lock around ledger updates.
  • Unrealized gains/losses are included in portfolio equity; exit costs are charged on sale.

Stops are sampled every scan, not held at a broker. They can be missed between scans, during data failures or when the process stops, and losses can exceed the planned risk. A provider/candle failure prevents action on that market, including exits. ETFs only execute during Alpaca's regular-session clock; overnight gaps remain exposed. Closed ETF marks can make portfolio equity stale.

The IEX feed is not the consolidated stock market. Provider-aggregated 4-hour bars may include activity outside regular trading hours; entries and exits in this profile remain regular-session-only. Fees are configurable estimates, not verified account-specific fees. Fractional paper sizes are not validated against a broker's minimums, precision, cash settlement, account rules or order support. There are no shorts, leverage, backtests or real-money execution in this release.

Verification

python3 -m unittest test_five_market test_risk_controls test_watchlist -v

Offline tests cover all three signal families, timing, portfolio exposure, cash accounting, costs, volatility sizing, duplicate entries, market closures, stale data, daily loss handling and stop gaps. Real authenticated provider calls and deployment still need validation on your host. The original pytest tests remain included; pytest was not available in the build environment.

Provider references:


Original app documentation

Local Crypto Dip Agent

Local-first autonomous paper trading agent for BTC/ETH dip detection.

This is deliberately paper-only by default. Live execution should not be enabled until the paper ledger proves edge after fees/slippage and risk limits are reviewed.

What it does

Every run:

  • fetches recent BTC-USD and ETH-USD candles from public Coinbase Exchange API
  • computes a local fair value from EMA + VWAP
  • detects downside gaps below fair value
  • opens paper long positions only when the gap exceeds configured thresholds
  • scans watch-only candidates without opening new positions
  • sizes positions based on gap strength and recent volatility
  • applies fees/slippage assumptions
  • tracks cash, positions, realized/unrealized P/L, and audit logs

Run once

python3 bot.py --once

Run every 15 minutes

python3 bot.py --loop

Dashboard

python3 dashboard.py --host 127.0.0.1 --port 8765
# open http://127.0.0.1:8765

Files

  • config.json - strategy/risk settings
  • bot.py - scanner + paper execution engine
  • dashboard.py - local dashboard/API
  • data/state.json - paper account state
  • data/trades.jsonl - trade/audit log

Live trading warning

Do not add exchange keys with withdrawal permission. If live mode is ever added, use:

  • trade-only API keys
  • tiny max position size
  • max daily loss
  • max drawdown
  • circuit breaker
  • external alerts
  • paper/live parity report

Research watchlist: XST, WOFI, UOTF

The dashboard includes separate research records containing your supplied notes, explicitly marked unverified. They are not added to either execution engine. Enter and save the exact Solana mint for XST, WOFI and UOTF in the dashboard. The app validates address encoding only; it does not confirm token identity or mint-account ownership on chain. Fomo is a platform and is excluded from the watchlist.

Records persist in data/research-watchlist.json, shared by dashboard profiles. There is no on-chain analytics, price feed, liquidity inspection, rug detection, sellability test, DEX swap integration or token endorsement in this watchlist. Those require exact identities and further provider/execution work. Ticker names alone must never select the asset to trade. Do not substitute these tokens for GLD or USO: oil-themed token branding does not establish commodity ownership rights.