AlphaGPT: One-Page Cheat Sheet
Path: C:/GitHub/AlphaGPT · Python 3.11 · PyTorch · live on-chain trading
Core Idea
AlphaGPT does not predict prices. Like GPT writing code, it automatically generates factor formulas. Backtest returns serve as rewards, which are used to train the formula-writing Transformer itself. High-scoring formulas are then connected to an on-chain wallet to place real orders on Solana.
- A Transformer autoregressively emits tokens — each token is either a feature or an operator — and a stack virtual machine executes them into factor signals.
- Formulas are readable:
decode()can reconstruct e.g.MUL(RET, DECAY(VOL_CHG)), making them debuggable and interpretable. - The reward comes from backtesting: formulas with higher net PnL increase the probability of the generation paths that produced them — standard RL (REINFORCE).
- data_pipeline — fetch Birdeye market data into the DB, filter low-liquidity junk coins
- model_core — factor mining engine: Transformer + VM + backtest-driven training
- strategy_manager — 15-minute live loop; loads formulas, scores, places orders with stop-loss/take-profit
- execution — Jupiter quotes + Solana RPC signing
- dashboard — Streamlit positions/PnL/logs, with an emergency-stop button
- lord — grokking experiments comparing LoRD vs L2 regularization
- times.py — same paradigm ported to 511260.SH (A-share), reward is Sortino ratio
- Entry threshold: sigmoid > 0.85
- Stop-loss -5% · take-profit +10% (half position kept as moonbag)
- Exit signal: score < 0.45 · trailing take-profit
- Honeypot protection: liquidity > $5000 and sellable (quotable) on exit
- The repo does not include a trained
best_meme_strategy.json— you must run training first - No
.envtemplate provided; assemble your own: Birdeye key, QuickNode RPC, Solana private key - Many external services required: Postgres, Birdeye, Jupiter, QuickNode — missing any one blocks execution
- Private keys go into .env — this is real on-chain live trading; losses are not recoverable
- The README contains only a safety disclaimer; technical docs are in CATREADME.md
model_core/alphagpt.py— modelmodel_core/vm.py— stack virtual machinemodel_core/engine.py— training loopstrategy_manager/runner.py— live trading entry pointexecution/trader.py— on-chain order placementtimes.py— A-share experimental version
Data Flow
1. Sample — Transformer emits a formula token sequence 2. Execute — StackVM runs tokens into factor signals 3. Score — backtest net PnL as fitness 4. Feedback — REINFORCE raises the probability of good paths
Pipeline: Birdeye API (on-chain OHLCV) → data_pipeline (liquidity/FDV filtering) → Postgres + TimescaleDB → AlphaGPT Transformer → StackVM → MemeBacktest (REINFORCE) → strategy_manager (sigmoid > .85 signal) → execution (Jupiter on-chain swap), with the RL feedback loop closing back to the model.
Tech Stack
| Component | Choice |
|---|---|
| Deep learning | PyTorch, Looped Transformer + QKNorm/RMSNorm/SwiGLU/MTPHead |
| Regularization | Newton-Schulz LoRD (Muon-style low-rank decay) |
| Data sources | Birdeye (primary) / DexScreener (backup) |
| Storage | PostgreSQL + TimescaleDB hypertable |
| Trading | Solana RPC + Jupiter v6 aggregator |
| Dashboard | Streamlit + Plotly |
| A-share experiment | Tushare (times.py) |
Modules
Factors & Operators (12 + 12)
Base factors (6): ret log return · liq_score liquidity health · pressure buy/sell pressure · fomo volume acceleration · dev deviation from mean · log_vol log volume. Extended (6): volatility clustering, momentum reversal, RSI, amplitude, close position, volume trend.
Operators: ADD SUB MUL DIV NEG ABS SIGN + GATE (gating), JUMP (jump detection), DECAY, DELAY1 (lag), MAX3.
Five Steps to Run
1. Create database crypto_quant, configure .env
2. python -m data_pipeline.run_pipeline — fetch data
3. python -m model_core.engine — train, output best_meme_strategy.json
4. python -m strategy_manager.runner — run live trading
5. streamlit run dashboard/app.py — monitor + emergency stop