Skip to content

You07abd/ApexQuant

Repository files navigation

ApexQuant

Quant research pipeline + live paper-trading app for swing strategies on US equities


Python License Paper Only OOS Sharpe Max Drawdown


Research Report · Quickstart · Live Trading · Reproduce Research · Issues


👋 hello

ApexQuant is a complete, honest quant research pipeline and the trading app built from its conclusions.

The research (June 2026) tested intraday, swing, and ML strategies on US equities and crypto with realistic costs, walk-forward validation, and leakage audits.

The verdict in one line: a modest but real long-only swing edge on liquid US ETFs / megacaps (out-of-sample Sharpe ≈ 0.9–1.2, max drawdown −8%); every intraday strategy and both ML models were rejected after costs. Official recommendation: paper trade only.

Metric Value
Strategy Dual-engine long-only swing (trend + mean reversion)
Universe SPY, QQQ, IWM, DIA, GLD, TLT + megacap satellite
OOS Sharpe ≈ 0.9–1.2
Annual return ≈ 4–7% at 0.5% risk/trade
Max drawdown −8%
Trade frequency ~45 trades/year (avg hold ~29 days)
Data needed Free (yfinance + Binance public archives)

⚠️ This is not financial advice. This software's own research report says it is not ready for live money. It ships locked to Alpaca's paper-trading (fake money) endpoint. Trading involves substantial risk of loss. See LICENSE.


🚀 install

git clone https://github.com/You07abd/ApexQuant.git && cd ApexQuant
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt

Requires Python 3.10+. All data is fetched automatically — no paid subscriptions needed.


⚡ quickstart

See today's signals with no broker account at all (dry run):

# download free market data (yfinance + Binance archives; ~minutes)
.venv/bin/python src/data_loader.py

# print today's signals — no API keys, no real money
.venv/bin/python run_live.py nightly --dry-run

Or print a clean signal table anytime:

.venv/bin/python paper_trade.py

📈 what the system trades

Two long-only engines run on SPY, QQQ, IWM, DIA, GLD, TLT (+ megacap satellite on the balanced/aggressive profiles). Decisions are made once per day after the close; fills occur at the next open.

Trend engine — long while the 50-day MA is rising and price is above both the 50d and 200d MAs; exit when that breaks.

Mean-reversion engine — buy RSI(2) < 10 dips above the 200d MA; exit when RSI(2) > 60. Activates only when the trend engine is flat for a given symbol.

Every position carries a 2×ATR(14) hard stop and risk-based sizing (0.25–0.75% of equity per trade). Portfolio-level −2% daily / −4% weekly loss limits and a −15% kill switch protect the account. Full rule table with reasoning: reports/REPORT.md §2.

profiles

Profile Risk/trade Max positions Universe
conservative 0.25% 3 ETFs only
balanced 0.50% 4 ETFs + megacap stocks
aggressive 0.75% 6 ETFs + megacaps + crypto trend satellite

Profiles change risk only — signals are identical across all three.


🤖 live paper trading

Real prices, fake money. Requires a free Alpaca account (use the paper keys).

Setup:

cp .env.example .env
# fill in APCA_API_KEY_ID and APCA_API_SECRET_KEY in .env

Schedule three jobs (times are America/New_York):

CRON_TZ=America/New_York
10 16 * * 1-5  cd /path/to/repo && .venv/bin/python run_live.py nightly --profile balanced >> logs/nightly.log 2>&1
32 9  * * 1-5  cd /path/to/repo && .venv/bin/python run_live.py morning >> logs/morning.log 2>&1
33 9  * * 1-5  cd /path/to/repo && .venv/bin/python run_live.py watch   >> logs/watch.log 2>&1
Job When What it does
nightly 16:10 ET (after close) Refreshes data, computes signals, submits market-on-open orders for target vs. actual positions
morning 09:32 ET (after open) Confirms fills, logs measured slippage vs. modeled, places broker-side GTC protective stops
watch 09:33 ET → close Enforces daily/weekly loss limits and verifies every position keeps its stop; never generates entries (no intraday edge — rule N6)

On a Linux server, the one-shot setup script installs everything as systemd user timers with automatic NY-time daylight-saving support:

bash deploy/setup-server.sh

Useful commands:

.venv/bin/python run_live.py status   # account, positions, stops, halt flags
.venv/bin/python run_live.py halt     # flatten everything immediately
.venv/bin/python run_live.py resume   # re-arm after a kill-switch halt

Fills accumulate in reports/live_fills.csv with measured slippage. Path-to-live criteria (§8 of the report): ≥3 months of logs, realized slippage ≤ modeled, paper Sharpe ≥ 0.5× backtest, zero risk-rule breaches — and only then the conservative profile, with money you can afford to lose entirely.


🔬 reproducing the research

The full pipeline is deterministic (fixed seed). All results land in reports/.

.venv/bin/python run_pipeline.py audit      # data quality + feature behavior stats
.venv/bin/python run_pipeline.py swing      # swing strategy parameter sweep
.venv/bin/python run_pipeline.py ml         # ML vs. rules comparison
.venv/bin/python run_final.py               # final algorithm, all profiles

The intraday sweeps (intraday, intraday5m) are included for completeness — they're the evidence behind the rejections.


🗂️ repository layout

Path Purpose
reports/REPORT.md Full research study — read this first
config.py Every parameter: universe, costs, risk limits, train/val/test splits
final_algo.py The selected algorithm (signals + risk profiles)
run_live.py · live/ Paper-trading app: nightly/morning/watcher, Alpaca REST client, state management
paper_trade.py Manual signal printer — no broker account needed
run_pipeline.py · run_final.py · src/ Research pipeline that produced the report
deploy/setup-server.sh One-shot server setup (systemd user timers)
.env.example Credential template — copy to .env, never commit

🐛 issues & contributions

Bug reports and questions are welcome — open an issue.

Pull requests are not accepted: the published code stays identical to the code that was backtested and audited, so its track record remains verifiable. See CONTRIBUTING.md for details.


📄 license

Source-available, use-only: run it freely, don't republish modified versions. No warranty; nothing here is investment advice. See LICENSE.

About

Quant research pipeline + long-only swing trading app. OOS Sharpe ≈ 0.9–1.2, max drawdown −8%. Paper trade only.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors