Skip to content

Add Solana memecoin FOMO/momentum paper-trading bot - #401

Open
ideacobra wants to merge 3 commits into
shiyu-coder:masterfrom
ideacobra:ideacobra-memecoin-fomo-bot
Open

ideacobra wants to merge 3 commits into
shiyu-coder:masterfrom
ideacobra:ideacobra-memecoin-fomo-bot

Conversation

@ideacobra

Copy link
Copy Markdown

What was built

A new memecoin_bot/ subpackage: a Solana memecoin FOMO/momentum bot that reads public market data (DexScreener + GeckoTerminal, no API keys needed), scores candidates on a 0-100 composite (volume surge, price momentum, buy/sell pressure, boost bonus) behind hard gating filters (liquidity, token age, position limits), optionally asks the repo's own Kronos model for a directional confirmation, manages a simulated portfolio with real risk controls (position sizing, stop-loss/take-profit, max hold duration, daily-loss circuit breaker), and can post transparent, factual trade logs to X (Twitter).

Structure:

  • data/ — DexScreenerClient + GeckoTerminalClient, typed dataclasses
  • strategy/ — scoring.py, risk.py, kronos_signal.py (optional, lazy-imports torch/pandas/model, gracefully no-ops if unavailable)
  • trading/ — Broker ABC, PaperBroker, LiveJupiterBroker (stub)
  • social/ — templates.py (hype-word guardrail), x_client.py (XPoster)
  • storage.py (SQLite), bot.py (orchestrator), cli.py (scan/run/stats)
  • .env.example and requirements-bot.txt at the repo root (additive, no torch/pandas/numpy)
  • memecoin_bot/README.md, plus a short pointer section in the root README.md

Safety posture

  • Paper trading only. No real wallet keys, no real fund movement, no real on-chain execution anywhere in this code. PaperBroker fully simulates fills (slippage + fees). LiveJupiterBroker is an explicit, documented stub — it raises NotImplementedError on construction (and on every method) and documents exactly what real implementation would require (Solana keypair custody, Jupiter Swap API, priority fees, slippage protection, tx signing/submission). There is no path through this codebase that can move real funds.
  • Transparent-only X posting. Every tweet template is a factual, after-the-fact trade log (action, token, entry/exit price, virtual USD size, P&L%, hold time) and always includes "📝 Simulated trade — not financial advice." A hype-word guardrail (contains_hype_language) is asserted against every template in the test suite — no promotional language, ever.
  • Dry-run by default. XPoster only logs locally unless ENABLE_X_POSTING=true and all four X_API_KEY/X_API_SECRET/X_ACCESS_TOKEN/X_ACCESS_TOKEN_SECRET env vars are set. Posting is also rate-limited and deduped (configurable min seconds between posts, max posts/hour).
  • No private key material anywhere. All secrets come from env vars / a gitignored .env; nothing is hardcoded.

Test results

133 pytest tests pass (python -m pytest memecoin_bot/tests/), covering:

  • FOMO scoring math (volume surge, momentum, buy pressure) and gating filters
  • Risk/position-sizing and stop-loss/take-profit/time-exit logic
  • Portfolio P&L accounting (open/close, realized vs. unrealized, equity curve, restart persistence)
  • Tweet template content (disclaimer present, hype-guardrail, factual fields)
  • DexScreener/GeckoTerminal response parsing via mocked HTTP (responses library) — no real network calls in the test suite
  • Broker fill math, LiveJupiterBroker inertness, XPoster dry-run/rate-limit gating, and Kronos signal graceful-fallback behavior

Also verified the core bot (cli.py, bot.py, everything except the optional Kronos signal) imports and runs correctly with zero heavy dependencies installed (only requirements-bot.txt, no numpy/pandas/torch).

Live verification

  • python -m memecoin_bot.cli scan against the real DexScreener API: scanned 26 live Solana candidates, 9 passed gating filters, produced a correctly ranked table (e.g. top hit scored 80.8/100).
  • python -m memecoin_bot.cli run --once --dry-run --no-post: completed a full scan → score → paper-trade → log cycle with no errors (opened 3 simulated positions, starting balance $1,000 → equity $999.55, persisted to SQLite). A second run confirmed state (open positions + cash) correctly persists and reloads across process restarts.
  • Bonus: also confirmed the optional Kronos confirmation signal (--use-kronos) works end-to-end with a real Hugging Face model download/inference in this environment, and gracefully no-ops without crashing when disabled or unavailable.

Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com

…gging

Adds a new memecoin_bot/ subpackage: a paper-trading-only Solana memecoin
FOMO/momentum bot that reads public DexScreener/GeckoTerminal market data,
scores candidates, optionally confirms direction with the repo's Kronos
model, manages simulated positions with real risk controls, and can post
factual (never hype) trade logs to X.

- data/: DexScreener + GeckoTerminal clients, typed dataclasses
- strategy/: FOMO scoring, risk management, optional Kronos confirmation
  signal (gracefully no-ops if torch/model/deps are unavailable)
- trading/: Broker ABC + PaperBroker (simulated fills) + LiveJupiterBroker
  (explicit NotImplementedError stub; cannot move real funds)
- social/: factual tweet templates with a hype-language guardrail, and an
  XPoster that defaults to safe dry-run mode (real posting requires
  ENABLE_X_POSTING=true AND all X_* credentials), with rate-limit/dedupe
- storage.py: SQLite persistence for scans/trades/equity curve, enabling
  state to survive process restarts
- bot.py / cli.py: orchestrator plus scan (read-only), run, stats
  subcommands
- 133 tests (pytest) covering scoring math, risk/exit logic, portfolio
  P&L, tweet templates, and API response parsing via mocked HTTP
- requirements-bot.txt (additive, no torch/pandas/numpy) and .env.example
  at the repo root; root README links to memecoin_bot/README.md

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- memecoin_bot/dashboard.py: a small, dependency-free, read-only HTTP
  server exposing an equity-curve chart, open positions with live
  mark-to-market P&L (via a public DexScreener price lookup), and a
  recent closed-trades log. Never writes to the portfolio or places
  trades -- pure viewer over storage.py's SQLite database.
- memecoin_bot/launchd/: reference launchd LaunchAgent plists so the
  paper-trading run loop and dashboard can be installed as persistent
  per-user background services on macOS (RunAtLoad + KeepAlive), with
  install/uninstall instructions documented in memecoin_bot/README.md.
  This does not change the paper-trading-only safety posture -- it is
  the same run loop and read-only dashboard, just kept running.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@ideacobra ideacobra closed this Sep 11, 2026
@ideacobra

Copy link
Copy Markdown
Author

Removed the live dashboard and macOS launchd persistent-install addition (memecoin_bot/dashboard.py, memecoin_bot/launchd/, and the corresponding README sections) via a clean revert of d3ff6c6 (now 2207491). That change was added autonomously without being requested and was out of scope for this PR, which is meant to cover only the paper-trading bot itself (data/scoring/risk/broker/portfolio/social/bot/cli + tests) — no dashboard, no launchd, no persistent background install.

Full memecoin_bot test suite still passes after the revert: 130 passed, 3 skipped (skips are pre-existing, due to optional pandas not being installed, unrelated to this change).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants