Architecture · Processes · Trading modes

How Cryptrade works

Parallel processes watch crypto, metals, and tokenized equities every second — while intel loops refresh every 30–300 seconds. Together they answer: Which asset is cheapest on a dip, should we hold or exit for profit, and is the bar strict enough to spend gas?

Trading modes (plans)

Switch modes with one command — each writes a preset to data/active-trading-mode.env without editing your base .env.

ModeCommandWhat it does
Ethereum multi-asset live default npm run mode:ethereum-multi USDC → ETH, BTC, silver (KAG), gold (PAXG), and Backed xStocks (NVDA, TSLA, COIN, MSTR, PLTR, …) on dips. Multi-asset scan, position intel, post-sell rebuy.
Ethereum spot npm run mode:ethereum-spot Focused USDC → ETH/BTC on Ethereum mainnet. Flash arb off. Simpler single-pair style.
SEI spot npm run mode:sei-spot Low-gas USDC/WSEI on Sei via DragonSwap. Auto-fund USDC enabled; min trade ~$25.
Base flash arb npm run mode:base-flash Flash-loan cross-DEX hunt on Base (Aave V3). Separate flash supervisor; spot bot paused.

Ethereum multi-asset plan — current live strategy

Parameters from the active ethereum-multi profile (June 2026).

Entry (BUY)

  • Signal pool: WETH/USDC Uniswap V2 websocket — EMA + drawdown + vol score
  • Min dip: ~0.20% floor; gas-adjusted threshold via MIN_PROFIT_MULTIPLIER (1.25×)
  • Target assets: auto-pick weakest 24h performer among ETH, BTC, SILVER, GOLD, STOCKS
  • Cross-asset boost: assets down ≥2% in 24h get easier entry (+0.12% bonus)
  • Multi-asset scan: independent BUY pass every 60s across every configured asset
  • Trade size: 98% of wallet USDC, min ~$55; native ETH reserved for gas
  • Cooldown: 60s between trades

Exit (SELL) & rotation

  • Take profit: +0.85% on position
  • Stop loss / momentum fade: standard GasAwareStrategy SELL rules
  • Position intel hunt: every 30s — accelerates exit near TP when intel turns bearish, RSI hot, whale sell pressure, or macro risk-off
  • Post-sell rebuy: after full exit, rank next dip candidate and re-enter with 15s cooldown
  • Whale gate: blocks BUY when ≥$80k sell pressure on active pool (websocket, no paid API)

Gates in this mode

  • External signals: Binance RSI 1h/4h, funding, DefiLlama ETH stables (120s refresh)
  • Macro metals: gold/silver vs crypto leadership
  • Free intel composite: Fear/Greed, funding, global mcap (45s refresh)
  • AI buy/sell gates: off in multi mode — quant rules execute; intel tunes thresholds
  • CEX orderbook gate: off; CEX corroboration still available

Alerts & proof

  • SMS (Twilio): optional SMS_ON_SIGNAL on BUY/SELL opportunities + separate text on executed fills
  • Desk feed: signals labeled “not executed”; trades show tx hash
  • Memory: session tape + RAG knowledge for AI when gates are enabled
  • Watchdog: 24/7 auto-restart until npm run bot:stop

The always-on runtime

These four layers keep the bot running without human intervention.

1

Watchdog supervisor

A background daemon (bot-watchdog.ps1) starts the bot at login and restarts it if it crashes. You stop it cleanly with one command — it does not restart until you start it again.

2

TradingBot startup

On start, the bot loads the active trading mode, wires every feed (intel, news, macro, external RSI, US session, memory, knowledge store, AI advisor), syncs open wallet positions, and starts parallel timers.

3

Network selection

The bot scores enabled chains (Ethereum, Base, Polygon, Arbitrum, etc.) by liquidity and swap gas USD. It can switch to a cheaper network when savings exceed ~25%.

4

Websocket pool subscription

The bot subscribes to Uniswap V2 Sync events on the signal pair (default USDC/WETH). Every pool update recalculates price, EMA, drawdown, momentum, and whale flow in real time.

From tick to trade — the decision path

5

Strategy signal

GasAwareStrategy compares fast vs slow EMA, drawdown, and volatility score on the signal pool. BUY when dip ≥ configured % with promising vol. SELL on take-profit (+0.85% in multi mode), stop-loss, or momentum fade.

6

Multi-asset & cross-asset scan

Every 60s the bot evaluates each TRADE_ASSET independently for dip entry and TP/SL exit. Cross-asset ranking eases the bar for the deepest 24h loser. BUY_ASSET_PICK=auto rotates into the weakest name (crypto, metals, or xStock with pool liquidity).

7

Position intel hunt (while holding)

Every 30s, held assets are scanned for profit-exit acceleration: near take-profit + bearish intel, RSI overbought, euphoric funding, whale sell pressure, or metals-led risk-off. Desk publishes hunt summaries and lines up the next BUY candidate.

8

Strategy boost

External signals (RSI oversold, funding rates, stablecoin flows) and active event playbooks (IPO, Fed shock, flash crash, etc.) adjust dip thresholds — or block buys in risk-off conditions.

9

Gate stack

Before spending gas: composite intel score, gold/silver macro, CEX 24h divergence, orderbook imbalance (when enabled), whale flow, optional AI confidence, and gas-profit check. Intel relaxes or tightens gate thresholds — quant rules still decide timing.

10

Position sizing & execution

Trade size = % of wallet USDC (e.g. 98%), capped by MIN_TRADE_USD. The bot approves USDC and calls swapExactTokens on Uniswap V2 into the chosen asset (WETH, WBTC, PAXG, KAG, NVDAX, …) with slippage protection.

11

Record, broadcast & rotate

Success appends session memory, publishes EXECUTED to the live desk with tx hash, sends SMS (executed + earlier signal alert if enabled). After a full sell, post-sell rebuy attempts immediate rotation into the next ranked dip.

Parallel intelligence loops

While the strategy watches price, these collectors run on timers — feeding gates, playbooks, position intel, and AI memory.

LoopRefreshPurpose
Position intel hunt~30 secHeld-asset exit acceleration; rebuy candidate ranking
Multi-asset scan~60 secIndependent BUY/SELL on every TRADE_ASSET
Free intel composite~45 secFear/Greed, funding, global mcap, spot vol
External signals~120 secBinance RSI, multi-venue funding, ETH stables
Cross-asset opportunity~120 sec24h dip ranking; entry threshold bonus
Verified news RSS~5 minTier-1 headlines → playbook keywords
Macro metals~120 secGold/silver vs crypto leadership
US equity session~5 minPre/post market open & close context
Knowledge collect~5 minUpsert intel into RAG store
Hermes digest~1 hourAI writes new knowledge chunks

Deep dive: market intelligence → · RAG learning → · Market desk →

Key design principle

Math and rules decide when to trade and which asset. Intelligence decides how strict the bar is, when to take profit early, and what to buy next after a sell — not random LLM order placement. Signals and executions are always labeled separately on the desk and in SMS.