English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

AlphaGPT: A One-Page Cheat Sheet for a Transformer-Based Factor Mining System for Solana Meme Coin Trading

Forum topic · ✨步子哥 · 2026-06-24

Summary

AlphaGPT is a crypto quant trading project that automatically generates factor formulas rather than predicting prices. A Transformer autoregressively emits token sequences of features and operators, which a stack-based virtual machine executes into factor signals. Rewards come from backtest net PnL, training the formula-generating policy via REINFORCE-style reinforcement learning, and high-scoring formulas are then deployed for live on-chain trading on Solana via the Jupiter v6 aggregator. The stack includes PyTorch (Looped Transformer with QKNorm/RMSNorm/SwiGLU), Newton-Schulz LoRD regularization, Birdeye/DexScreener data feeds, PostgreSQL with TimescaleDB hypertables, and a Streamlit dashboard. The project ships 12 base/extended factors and 12 operators, uses a sigmoid>0.85 entry threshold, -5% stop-loss, +10% take-profit, and liquidity-based honeypot filtering. Caveats: no pre-trained strategy file or .env template is included, multiple external services are required, and private keys in .env mean real-money on-chain risk. An experimental A-share variant (times.py) applies the same paradigm with Sortino-ratio rewards.

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 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

  • 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
  • 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

    Trading Risk Controls

  • 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
  • Pitfalls Before You Start

  • The repo does not include a trained best_meme_strategy.json — you must run training first
  • No .env template 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
  • Key Files

  • model_core/alphagpt.py — model
  • model_core/vm.py — stack virtual machine
  • model_core/engine.py — training loop
  • strategy_manager/runner.py — live trading entry point
  • execution/trader.py — on-chain order placement
  • times.py — A-share experimental version

Tags

#alpha#quantitative-trading#solana#transformer#reinforcement-learning#factor-mining#cryptocurrency#meme-coins

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/178208072