What AlphaGPT Does
AlphaGPT is an open-source Python project (Python 3.11, PyTorch) located at C:/GitHub/AlphaGPT. It is not a price-prediction model — it is an automated factor-formula generator for Solana meme-coin quant trading.
The core idea: a looped Transformer autoregressively emits a token sequence where each token is either a feature or an operator. A stack-based virtual machine executes those tokens into an interpretable formula such as MUL(RET, DECAY(VOL_CHG)). The formula is decoded back into readable code, debugged, and explained. Backtest net PnL becomes the RL reward signal via REINFORCE, pushing the probability of high-return formula paths upward.
Tech Stack
- Deep learning: PyTorch · Looped Transformer with QKNorm / RMSNorm / SwiGLU / MTPHead
- Regularization: Newton-Schulz LoRD (Muon-style low-rank decay); a
lord/module runs LoRD vs L2 grokking experiments - Data sources: Birdeye API (primary) / DexScreener (fallback)
- Storage: PostgreSQL + TimescaleDB hypertable
- Execution: Solana RPC + Jupiter v6 aggregator
- Dashboard: Streamlit + Plotly
- A-share experiment: Tushare-fed
times.pymigrates the same paradigm to511260.SHusing Sortino-based rewards - Entry threshold: sigmoid > 0.85
- Stop-loss: -5% · Take-profit: +10% (half closed, moonbag retained)
- Exit signal: score < 0.45 · trailing take-profit
- Honeypot guard: liquidity > $5,000 and sell side reliably quotable
- The repo does not ship a trained
best_meme_strategy.json— you must train first - No
.envtemplate; assemble manually: Birdeye key, QuickNode RPC, Solana private key - External services required: Postgres, Birdeye, Jupiter, QuickNode — missing any one breaks the run
- Private keys in
.envmean real on-chain capital at risk — losses are not refundable - The README is mostly a safety disclaimer; the technical docs live in
CATREADME.md model_core/alphagpt.py— modelmodel_core/vm.py— stack VMmodel_core/engine.py— training loopstrategy_manager/runner.py— live trading entryexecution/trader.py— on-chain order routertimes.py— A-share experimental port
Data Flow
1. Birdeye API → on-chain OHLCV
2. data_pipeline → filters by liquidity / FDV
3. Postgres + Timescale → time-series storage
4. AlphaGPT (Transformer) → generates formula tokens
5. StackVM → executes tokens into factor signals
6. MemeBacktest → scores net PnL
7. REINFORCE feedback loop retrains the Transformer
8. strategy_manager (sigmoid > 0.85) → triggers execution → Jupiter on-chain swap
The closed RL loop: ① sample formula tokens → ② execute on StackVM → ③ backtest score (fitness) → ④ reinforce good paths.
Module Quick Reference
| Module | Role |
|---|---|
| data_pipeline | Fetch Birdeye market data; filter low-liquidity junk |
| model_core | Factor-mining engine: Transformer + VM + backtest training |
| strategy_manager | 15-min loop; loads formula, scores, places orders with stop-loss/take-profit |
| execution | Jupiter quotes + Solana RPC signing |
| dashboard | Streamlit positions/PnL/log viewer with emergency stop |
| lord | LoRD vs L2 regularization grokking experiments |
| times.py | A-share variant on 511260.SH (Sortino reward) |
Run It in 5 Steps
1. Create the crypto_quant database and configure .env
2. python -m data_pipeline.run_pipeline
3. python -m model_core.engine — emits best_meme_strategy.json
4. python -m strategy_manager.runner — leave running for live trading
5. streamlit run dashboard/app.py — dashboard + kill switch
Factors and Operators (12 + 12)
6 base features: ret log return · liq_score liquidity health · pressure buy/sell pressure · fomo volume acceleration · dev mean deviation · log_vol log volume.
6 extended features: volatility clustering, momentum reversal, RSI, amplitude, close position, volume trend.
Operators: ADD SUB MUL DIV NEG ABS SIGN plus GATE (gating), JUMP (jump detection), DECAY (decay-accumulate), DELAY1 (lag), MAX3 (three-value max).