~kris/dots

srice

ref: 9b4572416de8a234ffd5ebaaaa549a930b3e2041 srice/doc/trading/trading.md -rw-r--r-- 37.2 KiB
9b457241 — Kris Yotam wip: emergency backup (power outage risk) 3 months ago

#title: "Systematic Trading: A Foundational Reference" date: 2026-05-20 status: living-document

#Systematic Trading

A reference for building a Jane-Street-style systematic trading operation at retail scale. Focused on programmatic execution of quantitative strategies, not discretionary trading. Written for the operator who already programs and now wants to convert that into a private wealth engine.

#1. Strategy Archetypes Suited to a Mathematician

The honest filter: at retail capital, most "edge" strategies real shops run (latency arb, true HFT market making, capacity-heavy stat arb on the full Russell 3000) are unavailable. The remaining surface is narrower but real. Mathematical strength matters more on the research side (signal discovery, risk modeling) than the execution side.

Strategy Core Math Min Capital Realistic Sharpe (retail) Capacity PDT/Reg Issues
Statistical arbitrage Cointegration (Engle-Granger, Johansen), PCA, OU mean reversion, Kalman filtering $25k+ (equities) or $5k+ (crypto) 0.8-1.5 Medium PDT bites under $25k on margin equities
Market making Avellaneda-Stoikov, inventory control, Poisson order flow models $25k (crypto) / impractical (US equities) 1.0-2.5 in crypto Low at retail None on crypto/futures; impossible on equities without rebates
Mean reversion (single-name / ETF) Z-score, half-life of mean reversion (Ornstein-Uhlenbeck), Hurst exponent $5k+ 0.5-1.2 Medium PDT if margin equities
Momentum / trend following Time-series momentum (Moskowitz et al.), breakout filters, channel models, Kaufman AMA $5k+ (futures preferred) 0.6-1.0 (lumpy) High None on futures; PDT on intraday equities
Options vol arbitrage Black-Scholes greeks, vol surface modeling, variance swaps, GARCH $25k+ (defined risk); $100k+ (undefined) 0.7-1.5 Medium Level 3+ options approval, margin requirements
Pairs trading Same toolkit as stat arb but bivariate; spread half-life, dynamic hedge ratios $10k+ 0.6-1.2 Low PDT same as equities
Factor investing Cross-sectional regression, Fama-French + custom factors, portfolio optimization (mean-variance, risk-parity) $25k+ (50+ names for diversification) 0.4-0.8 Very high None (rebalance monthly, no PDT issue)
Event-driven NLP on filings/news, M&A spread arb, earnings drift $25k+ 0.5-1.0 Medium PDT possible; options approval helpful

Feasibility by capital tier:

  • $5k: Crypto market making on Coinbase/Hyperliquid, micro futures (1 MES contract), or swing factor strategies on equities. Avoid PDT entirely by using cash account or futures.
  • $25k: Margin equities unlocked. Pairs trading, ETF mean reversion, options spreads (Level 3). Still under capacity ceiling for most factor strategies.
  • $100k: Real multi-strategy portfolio. Run 3-5 uncorrelated strategies. Begin meaningful options vol selling (cash-secured puts, defined-risk spreads). Consider LLC.
  • $500k: Approaching prop-shop territory. Trader Tax Status worth filing. Can absorb fixed costs of pro data ($500-2000/mo Databento, dedicated VPS), employ leverage carefully.

The big trap: at retail capital, the strategies with the highest theoretical Sharpe (HFT market making, latency arb) are also the ones you cannot run. The strategies you can run (medium-frequency mean reversion, trend, factors) are the ones the literature has been chewing on for 25 years and where edge is thin. Plan around capacity-tolerant, low-frequency edge with strong risk management, not against high-Sharpe fantasy.

#2. Asset Classes

Asset Min Account Leverage Tax Treatment API Coverage
US Equities $0 (cash) / $2k margin / $25k for PDT-margin 2x intraday, 4x day-trading Short-term cap gains (≤1yr ordinary income); wash sale applies Public, Alpaca, IBKR, Schwab, Tradier
US Options $2k+ (Level 2); $25k+ (Level 3/4) Defined by structure Same as equities; LEAPS get LTCG; complex spreads tricky Tradier (best), TastyTrade, IBKR, Public
Futures (CME) $500-2000 per micro contract 10-50x typical Section 1256: 60% LTCG / 40% STCG regardless of holding period. No wash sale. IBKR, NinjaTrader, Tradovate, AMP
Crypto spot $0 1x (3x on Kraken Pro) Property; FIFO; no wash sale (yet, IRS proposed) Coinbase Advanced, Kraken, Gemini
Crypto perps $0 (offshore) 5-100x Murky; treat as ordinary income for self-custody DEX Hyperliquid, dYdX, Bybit (non-US), Binance.US (limited)
FX $100 (offshore); $25k (Oanda US) 50x retail US Section 988 ordinary by default; can elect 1256 Oanda, IG, IBKR
Treasuries / Bonds Varies None Federal income; state-exempt for Treasuries TreasuryDirect.gov, Public, IBKR

Two regulatory facts to internalize:

  • Section 1256 (futures + broad-based index options + cash-settled options on indices) offers 60/40 tax treatment regardless of holding period. Blended top rate ~26.8% vs. 37% for STCG equities. This alone is a 10 percentage-point edge before any alpha. Futures are also exempt from the PDT rule and the wash sale rule.
  • Wash sale rule (Section 1091) applies to substantially identical securities within 30 days. Algorithmic equity strategies that re-enter the same name constantly will produce a wash sale nightmare unless you elect Section 475(f) mark-to-market (which requires Trader Tax Status).

The PDT change (2026): The SEC approved elimination of the $25k pattern day trader rule effective June 4, 2026, replacing it with a risk-based margin framework: no minimum balance for cash-equivalent traders, $2k or maintenance margin (whichever greater) for leveraged. This materially expands what's runnable under $25k. (Britannica explainer, NerdWallet)

#3. Programmatic Access — Broker APIs

#public.com

Docs | Changelog

  • Assets: Equities, ETFs, options, index options, crypto, corporate bonds, treasuries (bonds added March 2026).
  • Auth: OAuth-style API keys per the Individual API Program Terms.
  • Endpoints: REST; supports PUT to amend orders without cancel/replace (Feb 2026 update).
  • Free, no commissions on stocks/ETFs/options contracts.
  • SDKs: Official Python library.
  • Strengths: Free, bond+treasury support is unusual for retail APIs, modern REST design.
  • Weaknesses: Newer than Alpaca/IBKR — community is small, fewer Stack Overflow answers, paper trading less mature.

#Mercury Bank API

Docs | Treasury endpoint

Mercury is banking, not brokerage. For trading purposes it enables:

  • Programmatic ACH / wire / RTP / check / virtual card.
  • Real-time balance + statement reconciliation across operating accounts and Mercury Treasury (MMF-style sweep).
  • Webhooks for transactions over a threshold, low-balance alerts.
  • Treasury endpoint exposes yield-bearing account data (currently ~4-5% APY on idle cash).

How this composes with trading: keep operating capital in Mercury Treasury (yielding) → programmatically ACH to broker when buying power needed → ACH back to Mercury when flat. The yield differential between idle broker cash and Mercury Treasury on $100k+ is meaningful (typically 100-200 bps).

#Alternatives

Broker Free Tier Assets Latency Python SDK Notes
Alpaca Yes (commission-free) US equities, options, crypto 50-200ms alpaca-py (official) Best paper/live parity. Most popular retail algo broker.
Interactive Brokers $0 commission tier; data add-ons cost Global multi-asset (everything) 10-50ms ib_async (successor to ib_insync after creator's 2024 death) Gold standard. TWS/Gateway must run.
Tradier $10/mo brokerage; sandbox free Equities, options 100-300ms Community Best-priced options API; commission $0.35/contract or flat $10/mo unlimited.
TastyTrade Free with account Equities, options, futures, crypto 100ms+ Community + official Designed by options traders for options traders; great complex order types.
TradeStation Free with account Equities, options, futures, crypto 100ms+ REST/WebSocket Solid for futures + equities mix.
Schwab Free; manual approval 1-3d Equities, options Variable Community (schwab-py) Inherited TD Ameritrade API. Required register as Individual Developer.
Robinhood Unofficial only Equities, options, crypto High robin_stocks TOS forbids automation. Avoid for serious work.

#Crypto

Exchange Free Tier Assets Latency SDK
Coinbase Advanced Trade Yes Spot, some futures ~100ms Official Python
Kraken Yes Spot, futures, margin (3x) 50-150ms krakenex
Binance.US Yes Spot 100ms Official + python-binance
Hyperliquid Yes Perps + spot DEX 20-50ms (custom L1) Official Python + Rust
dYdX v4 Yes Perps DEX 50-100ms Official
Bybit / OKX / BitMEX Yes Perps 50-150ms Official Non-US only

For market making in crypto specifically, Hummingbot ships connectors for most of the above. CCXT (ccxt/ccxt, ~33k stars) is the universal abstraction layer if you need to swap exchanges.

#4. Backtesting Frameworks & Libraries

Ranked, with current state as of mid-2026:

# Framework Repo Lang Last Significant Release License Best For
1 NautilusTrader nautechsystems/nautilus_trader Rust core + Python Active monthly LGPL-3.0 Production-grade event-driven; closest to institutional.
2 VectorBT (PRO) polakowo/vectorbt Python (Numba) OSS less active; PRO active Apache 2.0 (OSS) Vectorized parameter sweeps. Fastest for research grids.
3 QuantConnect LEAN QuantConnect/Lean C# (with Python wrapper) Daily commits Apache 2.0 Cloud or self-host; multi-asset; live integration baked in.
4 Zipline-Reloaded stefan-jansen/zipline-reloaded Python Active maintenance Apache 2.0 Daily-bar equities research; pairs with pyfolio-reloaded and Stefan Jansen's ML for Trading.
5 Backtrader mementum/backtrader Python Original author inactive since ~2019; community PRs GPL-3.0 Most documentation/tutorials online. Easy to learn, slow on big grids.
6 Freqtrade freqtrade/freqtrade Python Very active (25k+ stars) GPL-3.0 Crypto-only. FreqAI for ML strategies.
7 Hummingbot hummingbot/hummingbot Python Very active Apache 2.0 Crypto market making + DEX arb.
8 Jesse jesse-ai/jesse Python Active MIT Crypto; clean API; honest backtests.
9 bt pmorissette/bt Python Maintenance mode MIT Portfolio rebalancing strategies on top of ffn.
10 PyAlgoTrade gbeced/pyalgotrade Python Inactive (~2020 last) Apache 2.0 Historical interest only.
11 QSTrader mhallsmoore/qstrader Python Light maintenance MIT Institutional-flavored from QuantStart blog.
12 vnpy vnpy/vnpy Python + C++ Active (China-focused but international support) MIT Multi-broker live trading platform.

Recommended workflow: VectorBT for parameter sweeps and signal discovery → NautilusTrader for execution-realistic backtest → live deploy on NautilusTrader or broker-specific code. Avoid the temptation to live-trade directly from a vectorized research notebook.

#Data Sources for Backtesting

Source URL Cost Asset Coverage Granularity
Polygon.io $29-$199/mo retail US equities/options/FX/crypto Trade/quote down to 1s; tick on higher tiers
Databento ~$100-500/mo metered US equities, options, futures (60+ venues) Nanosecond tick + L2 from direct exchange feeds
Tiingo Free tier; $30/mo US equities, crypto, FX, news Daily + intraday
Alpha Vantage Free; $50/mo+ Multi-asset Daily, intraday
Norgate Data $30-90/mo US/AU/CA equities + futures continuous contracts Daily; survivorship-bias-free
QuantConnect data Bundled with LEAN cloud Multi-asset Tick/minute/hour/daily
Kibot One-time pay US equities, futures Tick + minute
yfinance GitHub Free (unofficial Yahoo scrape) Global equities, ETFs Daily mostly; intraday unreliable, survivorship-biased, prone to break

yfinance is fine for prototyping and research. It is unfit for production-grade backtests. Use Norgate or Polygon for serious work. Databento if you need L2 / tick.

#5. Similar GitHub Projects Worth Studying

Curated, with stars and current status (May 2026 snapshot):

Repo URL Stars Why It Matters
QuantConnect/Lean https://github.com/QuantConnect/Lean ~10k Institution-quality event-driven engine. Read the algorithm framework.
nautechsystems/nautilus_trader https://github.com/nautechsystems/nautilus_trader ~5k Rust core; modern architecture you'd actually deploy.
stefan-jansen/machine-learning-for-trading https://github.com/stefan-jansen/machine-learning-for-trading ~14k Companion notebooks to the book; best ML-for-trading walkthrough on GH.
hudson-and-thames/mlfinlab https://github.com/hudson-and-thames/mlfinlab ~4k Implementations of de Prado's Advances in FinML. (Note: now partially closed-source; older OSS version still useful.)
OpenBB-finance/OpenBB https://github.com/OpenBB-finance/OpenBB ~37k Free Bloomberg-alternative for research; broad data integrations.
ccxt/ccxt https://github.com/ccxt/ccxt ~33k Universal crypto exchange interface. The standard.
freqtrade/freqtrade https://github.com/freqtrade/freqtrade ~28k Battle-tested crypto bot platform with FreqAI.
hummingbot/hummingbot https://github.com/hummingbot/hummingbot ~8k Production crypto market-making framework.
ranaroussi/quantstats https://github.com/ranaroussi/quantstats ~5k Tearsheet generation. Steal the metric implementations.
robcarver17/pysystemtrade https://github.com/robcarver17/pysystemtrade ~3k Companion to Systematic Trading by Rob Carver. Full futures portfolio system.
polakowo/vectorbt https://github.com/polakowo/vectorbt ~5k Numba-accelerated vectorized backtester.
jesse-ai/jesse https://github.com/jesse-ai/jesse ~6k Clean crypto-focused framework. Good API design study.
ranaroussi/yfinance https://github.com/ranaroussi/yfinance ~14k Useful for prototyping. Know its limits.
microsoft/qlib https://github.com/microsoft/qlib ~16k Microsoft Research's AI-for-quant platform. Strong reinforcement-learning integration.
google/tf-quant-finance https://github.com/google/tf-quant-finance ~5k Derivative pricing in TF. Reference implementations for Heston, SABR, etc.
jpmorganchase/python-training https://github.com/jpmorganchase/python-training ~4k JPM's internal Python training materials. Reveals how a bank does it.
AI4Finance-Foundation/FinRL https://github.com/AI4Finance-Foundation/FinRL ~10k Deep RL for trading. Academic but well-maintained.
wilsonfreitas/awesome-quant https://github.com/wilsonfreitas/awesome-quant ~20k Curated list-of-lists. Use as discovery surface.
wangzhe3224/awesome-systematic-trading https://github.com/wangzhe3224/awesome-systematic-trading ~3k Better filtered than awesome-quant; focused on real systems.
ib-api-reloaded/ib_async https://github.com/ib-api-reloaded/ib_async ~3k The IBKR Python interface. Read the source for asyncio patterns.
crflynn/stochastic https://github.com/crflynn/stochastic ~0.5k Stochastic process simulators (OU, Heston, fBM). Useful for synthetic-data testing.
cvxpy/cvxpy https://github.com/cvxpy/cvxpy ~6k Convex optimization. Backbone of portfolio construction.
lballabio/QuantLib https://github.com/lballabio/QuantLib ~6k C++ derivatives pricing library. Industry standard.
AI4Finance-Foundation/FinRL-Meta https://github.com/AI4Finance-Foundation/FinRL-Meta ~1k Standardized datasets/environments for RL trading research.

#6. Hardware Requirements

Latency-sensitive (HFT): not realistic for retail. Co-located NY4 servers ($2000-10000/mo), kernel-bypass networking, FPGA NICs. Don't bother.

Mid-frequency (sub-second to minute bars): the current i7-265K + 30GB desktop is overkill for execution. The dGPU is irrelevant for non-ML strategies.

Overnight / swing / daily bars: cheapest VPS imaginable suffices. A $5 Hetzner CX11 will run a daily-bar strategy.

Research and backtesting:

Resource Need
Cores More is better. Parameter sweeps embarrassingly parallel. 16+ cores changes life.
RAM 32GB minimum. 64-128GB unlocks full-history L1/L2 tick loaded in memory.
Storage NVMe SSD essential. Tick data for 1 year of US equities = 500GB-2TB depending on schema. Plan for STARGATE's 916GB drive to host.
GPU RX 6800 XT is useful for ML training but not inference. PyTorch ROCm is functional on Arch. For most quant ML (gradient boosting, linear models) GPU is irrelevant; XGBoost/LightGBM on CPU is faster than naive GPU.
Network Wired ethernet, low-jitter. Wifi adds 5-30ms jitter that ruins fill quality on anything sub-minute. Use STARGATE wired for live execution.

Recommended split for this setup:

  • moirai (desktop, i7-265K, 30GB, RX 6800 XT): research + backtest + Jupyter.
  • STARGATE (server, Arch, 916GB): live execution under systemd + Postgres/TimescaleDB for tick storage + Grafana for monitoring.
  • Optional NY4 VPS later if you actually find a latency-sensitive edge.

#7. Cloud VPS / Colocation

Provider URL Datacenters Entry Price Use Case
Beeks Financial Cloud https://www.beeksgroup.com/ NY4, LD4, CME Aurora, TY3, +14 more $39/mo VPS, $315-$3270/mo dedicated Best NY4 proximity, broker peering. Latency 0.8ms to LD4/NY4 hubs.
QuantVPS https://www.quantvps.com/ NY4 (Equinix) $42/mo (Lite) → $129+ NY4 colo at retail prices. Solid for futures via Rithmic/CQG.
Speedy Trading Servers https://www.speedytradingservers.com/ Chicago (CME), NY4, LD4 $35-150/mo Futures-trader-focused.
TradingFXVPS https://www.tradingfxvps.com/ Global (NY, London, Tokyo, Frankfurt) $25-90/mo MetaTrader/FX focus.
ForexVPS.net https://www.forexvps.net/ NY, LD, FR, TY, HK $35/mo FX VPS.
AWS us-east-1 https://aws.amazon.com/ec2/ N. Virginia (close to NY4 but not in it) $4-200+/mo When you want full IaaS; ~3-5ms to NY4 from us-east-1d.
Hetzner https://www.hetzner.com/cloud Falkenstein, Helsinki, Ashburn (US) EUR 4.59/mo Cheapest sane option for non-latency-sensitive overnight strategies. Ashburn for US ~10-15ms to NYSE.
Vultr https://www.vultr.com/ NJ (close to NY4), Chicago $5-40/mo Cheap and ubiquitous.
Linode (Akamai) https://www.linode.com/ Newark (close to NY4) $5+/mo Same tier as Vultr.

Recommendation by stage:

  • Today through $100k AUM: STARGATE on home network is fine. Add Hetzner Ashburn ($5/mo) as failover.
  • $100k-$500k or any sub-second strategy: QuantVPS NY4 Lite ($42-129/mo).
  • $500k+ or genuine HFT: Beeks dedicated in NY4 with broker cross-connect.

#8. Capital Staging Plan

Stage Capital Focus Structure Action
Seed $5k Paper trade everything. Live-trade one small futures or crypto strategy to feel real fill quality. Sole proprietor; personal account. Open public.com + Alpaca paper + Coinbase Advanced.
Live $25k 2-3 uncorrelated strategies, post-PDT-elimination. Begin tracking metrics rigorously. Sole prop; consider TTS election. Add IBKR for futures (better margin on /MES).
Scaling $100k Multi-strategy with formal allocation. Add Trader Tax Status filing. Move execution to STARGATE + Mercury treasury sweep. TTS election; possibly LLC if filing 475(f). Move to NY4 VPS if any sub-minute strategy.
Pro $500k+ Diversified across 5+ strategies and 3+ asset classes. Real options book. Possibly run for outside capital under exemption. LLC; consider S-corp for self-employment tax. Consult quant tax accountant (Green Trader Tax).

Prop firm shortcut: instead of personal capital you can lease buying power from a prop firm. Realistic ones:

Firm Asset Eval Cost Profit Split Notes
FTMO FX, indices, metals $99-$999 80-90% Largest, OANDA-owned (Dec 2025). Strong rep.
Topstep CME futures (ES, NQ, CL, GC, etc.) $49-$149/mo + $149 activation First $10k 100%, then 90% Longest-running (since 2012); paid out >$1.4B.
The5ers FX, indices $39-$1095 50-100% (instant funding tier) Older firm with instant-funding paths.
Apex Trader Funding Futures $25-$300/mo 90% Futures-only; very large account ceiling.
FundedNext FX $59-$999 80-90% Successor space to MFFU (shut down by CFTC). Now dominant in FX.

Prop firms are useful as leverage on a tested edge. They are not useful as a substitute for an edge. Eval rules (max drawdown, daily loss limits, news restrictions) bias toward conservative, low-risk strategies, sometimes punishing real edge.

#9. Risk Management & Infrastructure

#Position Sizing

  • Fixed fractional: bet f of equity per trade. Simple, robust. f = 0.01-0.02 typical.
  • Volatility-targeted: size positions so each contributes equal $-vol. Compute position = target_vol * equity / (px * realized_vol). Rob Carver's bread-and-butter.
  • Kelly fraction: f* = (bp - q) / b. The textbook answer. In practice, use half-Kelly or less because the inputs are estimated and overestimation is fatal.
  • Risk parity / mean-variance: for multi-strategy portfolios. Use cvxpy or riskfolio-lib.

#Stops, Limits, Kill Switches

  • Per-trade stop: hard limit on loss per position.
  • Daily loss limit: pause all strategies after X% drawdown. Mandatory.
  • Strategy kill switch: any individual strategy auto-disables on N consecutive losers or M% drawdown over K days.
  • Position concentration cap: no single position > P% of equity.
  • Correlation cap: total exposure to correlated bucket (e.g. tech beta) capped.

#Monitoring Stack

For STARGATE deployment:

Layer Tool Purpose
Tick storage TimescaleDB (Postgres extension) or DuckDB on Parquet Historical research data.
Live PnL Grafana + Prometheus Real-time dashboard.
Alerts Alertmanager → email (your ~/.local/bin/email script) + ntfy push Drawdown alarms, position breaches.
Logs Loki or just journald + Promtail Strategy decision audit trail.
Order management NautilusTrader's built-in OMS, or roll your own with ib_async + Redis Reconcile broker fills with internal state.
Process supervision systemd Auto-restart on crash.

#Validation

  • Walk-forward optimization (not single-pass in-sample optimization). Lopez de Prado's Combinatorial Purged Cross-Validation is the gold standard.
  • Deflated Sharpe Ratio (DSR) accounts for backtest overfitting by penalizing the number of trials. (Bailey & Lopez de Prado paper)
  • Out-of-sample minimum: hold back 25% of the data span. Don't peek.
  • Synthetic data testing: generate paths under a realistic process (GBM with regime switching, or block-bootstrap), check the strategy's distribution of returns. If edge collapses on random data, edge isn't real.
  • Trade randomization: shuffle trade entry times by ±5 bars. If the strategy is timing-fragile, that's overfit.
  • Capacity test: re-run backtest with realistic slippage (10-50 bps per side depending on size and liquidity). Many "edges" die here.

#10. Learning Path

#Books — Read in This Order

  1. Ernie Chan, Quantitative Trading (2nd ed.). The gentle on-ramp. (Amazon)
  2. Ernie Chan, Algorithmic Trading: Winning Strategies and Their Rationale. Mean reversion, momentum, options. Worked examples in MATLAB but easily ported.
  3. Ernie Chan, Machine Trading. ML-flavored extension.
  4. Rob Carver, Systematic Trading and Leveraged Trading. The best practical books for futures portfolio construction. Companion code: pysystemtrade. (Carver's blog)
  5. Marcos Lopez de Prado, Advances in Financial Machine Learning. (Amazon) Hard. Worth it. Chapters 7 (cross-validation) and 11 (deflated Sharpe) are essential reading even if you skip the rest.
  6. Lopez de Prado, Machine Learning for Asset Managers. Shorter follow-up.
  7. Rishi Narang, Inside the Black Box (2nd ed.). How real quant funds are organized.
  8. David Aronson, Evidence-Based Technical Analysis. The book that kills naïve TA via proper statistical hypothesis testing.
  9. Andrew Pole, Statistical Arbitrage. The pairs/stat-arb bible.
  10. Sheldon Natenberg, Option Volatility and Pricing. Vol surface intuition.
  11. Euan Sinclair, Volatility Trading and Option Trading. Practitioner-grade options.
  12. Stefan Jansen, Machine Learning for Algorithmic Trading (2nd ed.). Use as a reference together with the GitHub repo.

#Papers and Reading Lists

  • arxiv-q-fin — daily preprints, especially q-fin.ST (statistical finance) and q-fin.TR (trading and microstructure).
  • SSRN Financial Economics Network — where the practitioners publish.
  • Moskowitz, Ooi, Pedersen, Time Series Momentum (2012) — foundational trend paper.
  • Avellaneda & Stoikov, High-frequency trading in a limit order book (2008) — market making bedrock.
  • Lopez de Prado, The 7 Reasons Most Machine Learning Funds Fail — read this before you build anything ML.
  • Harvey, Liu, Zhu, ...and the Cross-Section of Expected Returns (2016) — why most published factors are noise.

#Courses

#Forums

Caveat: reference, not advice. At $50k+ engage a quant-specialized CPA — Green Trader Tax is the most-cited.

#Trader Tax Status (TTS)

To qualify, you typically need to demonstrate:

  • Sustained, frequent trading (case law suggests ≥4 days/week, ~720+ trades/year, average holding period <31 days).
  • Hours: significant time spent.
  • Material trading: substantial $ relative to other income.
  • Intent to derive income from trading.

Benefits: deduct trading expenses (data, computers, home office, education) on Schedule C; deduct margin interest as business expense.

#Section 475(f) Mark-to-Market Election

Once TTS-qualified, electing 475(f) on securities:

  • Treats all open positions as sold at year-end at fair value.
  • Converts gains and losses to ordinary income.
  • Exempts you from the wash sale rule — critical for high-frequency equity strategies that constantly re-enter names.
  • Removes the $3k annual capital loss limit; losses fully offset ordinary income.

Trap: electing 475(f) on commodities/futures converts Section 1256 60/40 treatment to ordinary income, usually worse. Elect on securities only.

Deadline: for individuals, attach the 475 election statement to the prior year's tax return or extension by April 15. So for tax year 2026 elections, the statement was due April 15, 2026. After making the election, file Form 3115 with that year's return.

(Green Trader Tax: Section 475 MTM, IRS Topic 429)

#Section 1256 (Futures, Broad-Based Index Options)

  • 60% LTCG / 40% STCG regardless of holding period.
  • Marked to market at year-end automatically.
  • Reported on Form 6781.
  • No wash sale issue.
  • Top blended federal rate ~26.8%.

#LLC vs Sole Proprietor

A single-member LLC defaults to disregarded entity (tax-identical to sole prop), so the gain from an LLC is procedural, not tax-magic:

  • Liability shield (limited — for trading, mostly cosmetic).
  • Easier to add a passive S-corp management entity later to pay yourself a salary (enabling solo 401(k), HSA, employee benefits).
  • Cleaner accounting separation.

At ~$50k+ profits, structure a trading LLC + S-corp management company combo. The S-corp pays you a reasonable salary (enables ~$70k/yr solo 401k contribution, HSA, etc.) and the trading LLC retains the rest as pass-through ordinary. This is the Green Trader Tax "Pro Trader Entity" structure.

#Other

  • State tax: trading from TX, FL, WA, NV, TN, NH, SD, WY avoids state income tax. Trading from NY/CA/IL hits hard.
  • Qualified Opportunity Zones: defer realized cap gains by reinvesting within 180 days. Useful if you have a large equity windfall.
  • Wash sale aggregation: brokers report wash sales per-account, not cross-account. Same security across IBKR + Alpaca won't auto-aggregate; reconcile yourself or via tax software like TraderFyles or TradeLog.

#12. Defensive Diversification

Beyond the algo book, hold a tail in things that don't depend on any single counterparty, market, or political consensus:

Asset Vehicle Counterparty Risk Yield
I-Bonds TreasuryDirect.gov US Treasury only CPI-linked; $10k/yr cap per SSN
T-Bills / Notes TreasuryDirect or Public/IBKR ladder US Treasury Whatever the curve gives
Physical gold / silver Coins (Eagles, Maples); allocated storage (Goldmoney, BullionVault) Self-custody = none None; storage cost
Bitcoin (cold storage) Hardware wallet (Coldcard, Trezor, Ledger); multi-sig (Sparrow, Specter) None at protocol level None; protocol scarcity
Productive land Direct ownership State legitimacy Crop income, timber, lease
Cash USD outside the banking system Physical paper Inflation + theft Negative real
Cash in foreign currencies Swiss or SG accounts in CHF/SGD Foreign banking Variable

Principle: things that survive any one institution failing. Mercury Treasury yields well but is ultimately a sweep into MMFs at partner banks. A small physical-asset tail (~5-10% of net worth) is cheap insurance against the rest of the structure failing for non-market reasons.

TreasuryDirect doesn't have a true public API, but its data feeds and ACH automation let you ladder T-Bills via recurring purchases programmed against your Mercury account.

#13. First 90 Days

#Phase 1 (Weeks 1-2): Substrate

  • [ ] Open accounts: confirm public.com is funded; open Alpaca paper + Coinbase Advanced; open IBKR for futures access (takes ~1 week).
  • [ ] Mercury API: generate token, build small Python script to pull daily balance to a sqlite/Postgres on STARGATE.
  • [ ] Set up ~/dev/trading/ repo. Git. Direnv. uv or poetry for Python isolation.
  • [ ] Install on STARGATE: Postgres + TimescaleDB, Grafana, Prometheus, ntfy.
  • [ ] Subscribe to one paid data source initially: Tiingo ($30/mo) for daily equities, or Polygon Stocks Starter ($29/mo) for intraday.

#Phase 2 (Weeks 3-4): Research Environment

  • [ ] Pull and warehouse 10 years of daily bars for SPY, QQQ, IWM, plus 100 large-cap names. Store as Parquet on STARGATE.
  • [ ] Notebooks on moirai connecting to STARGATE Postgres.
  • [ ] Implement and verify three classics from Chan's books on this data: pairs-trading on KO/PEP, momentum crossover on SPY, mean-reversion on AAPL. Confirm your backtest matches the book's results within ~10%.
  • [ ] Pick framework: install both VectorBT and NautilusTrader; replicate one strategy in each.

#Phase 3 (Weeks 5-8): First Live Strategy

  • [ ] Pick a single, simple, slow strategy. Recommended: time-series momentum on a basket of liquid futures (MES, MNQ, MCL, MGC, MZN), monthly rebalance, vol-targeted sizing. Or: cross-sectional momentum on top-200 US equities, monthly rebalance.
  • [ ] Walk-forward backtest. Out-of-sample test. Deflated Sharpe Ratio.
  • [ ] Deploy to Alpaca paper account for 2-4 weeks. Watch fills.
  • [ ] Build a Grafana dashboard with: live equity curve, drawdown, per-position PnL, alerts on >2% daily drawdown.

#Phase 4 (Weeks 9-12): Real Capital, Real Risk

  • [ ] Deploy real capital (start with 20-30% of intended live size) into the validated strategy on IBKR (futures) or Public/Alpaca (equities).
  • [ ] Run side-by-side with paper for a month. Reconcile fills vs. expected. Quantify slippage.
  • [ ] Add second uncorrelated strategy.
  • [ ] Decide on TTS election for following tax year. If yes, draft 475(f) election statement.
  • [ ] Begin reading Lopez de Prado in earnest — by now you've felt enough real-world pain to appreciate what he's solving.

#Forever (after Day 90)

  • One new strategy in dev at a time.
  • Monthly review: rolling Sharpe per strategy, allocation rebalance, archive any strategy with rolling 6-month Sharpe < 0.
  • Quarterly review: framework upgrades, data source expansion, infra audit.
  • Annual: tax planning with CPA, entity structure review.

#Appendix A: Quick Math Reference

  • Sharpe: (R_p - R_f) / σ_p; annualize multi-period by √(periods_per_year).
  • Sortino: same but only downside σ.
  • Calmar: annualized return / max drawdown.
  • Kelly: f* = p/a - q/b where p = win prob, q = 1-p, b = win size, a = loss size. Use ≤ half.
  • OU half-life: λ = -ln(2) / β where β is the AR(1) coefficient minus 1.
  • Hurst exponent: H < 0.5 mean-reverting, H > 0.5 trending. Compute on log-returns via R/S analysis or DFA.
  • Deflated Sharpe Ratio: penalty term √((1-γ)Φ⁻¹(1-1/N) + γΦ⁻¹(1-1/(Ne))) where N is number of trials, γ Euler-Mascheroni.

#Appendix B: Minimum Viable Tech Stack

Hardware:    moirai (research) + STARGATE (execution)
OS:          Arch Linux (both)
Languages:   Python 3.12 (research/exec), Rust (perf-critical components later)
Frameworks:  VectorBT (sweep) + NautilusTrader (execute)
Storage:     TimescaleDB (live PnL, fills) + Parquet on disk (research data)
Broker:      public.com (equities/options/bonds), IBKR (futures), Coinbase Advanced (crypto)
Banking:     Mercury (operating + treasury sweep)
Monitoring:  Grafana + Prometheus + Loki on STARGATE
Alerts:      ntfy + ~/.local/bin/email
Supervision: systemd units per strategy
Tax:         TraderFyles or TradeLog for wash-sale reconciliation; Green Trader Tax CPA
Backups:     git for code; restic snapshots of TimescaleDB to Hetzner S3