v3.2.0 · Hermes removed · April 19, 2026

Babingepet
2.0

Real-time multi-market quantitative trading framework. AI swarm intelligence meets microstructure alpha across crypto futures, Indonesian equities, and bandarmology.

3 + 1
Markets
19
AI Agents
13
BTC Signals
60s
BTC Cycle
15
Active Jobs
60+
Endpoints
🔒 Sensitive Data Policy: This document uses placeholders for credentials, domains, and identifying infrastructure. Operational values live only in private runbooks, never in shared docs.
01 — Market Coverage

3 Active Markets + 1 Scanner

All markets run in paper trading mode. Live Binance Futures execution is planned for mid-2026 after readiness checklist clears.

MarketCycleKey FeatureAI AgentsStatus
BTC/USDT Futures 60 seconds 13-signal adaptive decision engine 9-agent swarm Paper Live
Altcoin Futures 4 hours 8-factor composite · 30-coin universe 5-agent swarm Paper Live
IHSG (Indonesia) 2× daily Regime-adaptive · 30 LQ45 stocks 5-agent swarm Paper Live
IHSG Scanner On-demand 5-signal bandarmology · 55 brokers Broker intel DB API Pending
02 — System Map

Architecture Diagram

Complete layer flow from external data through collection, signals, AI, decisions, execution, learning, memory, and delivery.

📡
Layer 01 · Ingestion
External Data Sources
Binance Futures yfinance Google News RSS Broker APIs OpenRouter AI
Layer 02 · Collection
Data Collection Layer
collector.py · 60s altcoin_engine.py · 4h ihsg_engine.py · 2×/day etf_flow
Layer 03 · Signals
Signal Computation
VPIN OFI Avellaneda-Stoikov Edge Estimate Kelly Criterion Regime Detector Hour Seasonality MTF Alignment Entry Grade
🧠
Layer 04 · AI Estimation
AI Swarm Consensus
BTC · 9 agents Altcoin · 5 agents IHSG · 5 agents Blend: 40 gen / 60 swarm
Layer 05 · Decision
Weighted Voting Engine
13 signals Min 4/13 agreement Hour vetos Regime vetos STRONG_BUY → STRONG_SELL
🎯
Layer 06 · Execution
Paper Trading Simulators
Kelly sizing Trailing stops Chandelier ATR Post-loss cooldown Circuit breakers
🧬
Layer 07 · Adaptation
Adaptive Learning Layer
signal_evolution factor_analysis walk_forward learner · attribution reasoning_log
💾
Layer 08 · Memory
Hippocampus Memory
Engram storage BM25 retrieval Chronicle narrative Pattern context
📊
Layer 09 · Delivery
Storage & Dashboards
Supabase · 20+ tables 3 active dashboards Telegram Bot Health Alerts
03 — Engine Deep Dive

BTC/USDT Engine

60-second cycle. 13-signal adaptive decision engine. 9-agent AI swarm (3 generalists + 6 personas). Kelly-sized paper trading from $1,000 base.

Signal Pipeline (60s cycle)
Collect
Binance Futures
Compute
VPIN/OFI/Edge
Regime
TRENDING/RANGE
AI Swarm
9 agents · 20m
Decide
13-signal vote
Execute
Kelly paper
Learn
Evolve weights
13-Source Voting Weights
whale_flow
0.12
vpin
0.11
ai_consensus
0.10
mtf_alignment
0.10
regime
0.09
ofi_contrarian
0.08
vwap
0.07
funding_rate
0.06
etf_flow
0.04
ml_xgboost ⚠
0.03
as_fair_value
0.03
hour_seasonality
0.03
sentiment
0.02
ml_xgboost demoted — retrain accuracy 10.7% (worse than random). Re-elevation gated by walk-forward validation. Base weights are adaptive via signal_evolution.py and factor_analysis.py.
AI Swarm (9 agents)
3 Generalists 40% weight
gemini
google/gemini-2.5-flash · 20× cheaper than 2.5-pro
claude
meta-llama/llama-3.3-70b-instruct
gpt
openai/gpt-4o-mini
6 Swarm Personas 60% weight
momentumcontrarianflow_reader risk_managermacro_sageconservative_filter
Verdicts · Hours · Kelly
Verdict Thresholds
STRONG_BUY≥ 0.28
BUY≥ 0.20
SELL≤ -0.20
STRONG_SELL≤ -0.28
Min agreement4/13
Hour Blocking (UTC)
18230
Hour Boosting (UTC)
789 123
Boost = threshold ×0.85 / STRONG ×0.92
Kelly & Exits
Starting capital$1,000
TP / SL+2.5% / -0.6%
Odds ratio (b)≈ 4.17
Kelly bounds8% — 20%
Trailing (init)+1% / 25%
Trailing (ext)Chandelier ATR
Whale threshold$500K
Ξ
04 — Engine Deep Dive

Altcoin Engine

4-hour cycle. 30-coin universe across 9 sectors. 8-factor composite scoring + 5-agent AI swarm with sector diversification gates.

8-Factor Composite Score
Momentum
0.25
Funding
0.13
BTC Alpha
0.13
Volume
0.12
Volatility
0.10
RSI
0.10
Orderbook
0.07
OI Proxy
0.05
AI Swarm Personas (5)
defi_analyst
Gemini 2.5 Flash
TVL trends · DeFi blue chips · skeptical of memecoins
momentum_hunter
DeepSeek Chat
1h+4h momentum alignment · volume surge · ignores fundamentals
risk_sentinel
Gemini 2.5 Flash
Default LOW · funding extremes flag · memecoins auto-LOW
macro_crypto
Gemini 2.5 Flash
BTC dominance · alt season · regulatory news · token unlocks
quant_scorer
Llama 3.3 70B
Score >0.40 strong · RSI sweet spot · volume 2.0× institutional
30-Coin Universe
ETHSOLBNB ADAAVAXDOT NEARAPTSUI ATOMTIASEI ARBOP AAVEUNI LINKJUP FETRENDER DOGEPEPE SHIBWIF XRPLTC BCHFIL MATICINJ
Capital
$10,000
Max Positions
3 concurrent
Trailing Stop
+5% / 30%
Max Hold
24h forced
🇮🇩
05 — Engine Deep Dive

IHSG Engine

Indonesian Stock Exchange. 30-stock LQ45 universe. Session 1 (momentum) + Session 2 (mean reversion). Regime-adaptive weighting, news validation, 5-agent AI swarm.

Session Schedule
Session 1 (Opening)09:00-12:00 WIB
S1 full analysis cron01:50 UTC
Session 2 (After Lunch)13:30-15:49 WIB
S2 full analysis cron06:20 UTC
Price update interval30 min
Regime-Adaptive Weights
// tanh-smooth transition, not step function momentum_weight = 0.10 + 0.35 × trend_factor mean_reversion = 0.35 − 0.30 × trend_factor f_volume = 0.15 // constant f_alpha = 0.15 // constant vol_penalty = 0.15 // constant anti_falling_knife = ×0.6 if 5D return < −3%
AI Swarm (5 agents)
value_hunter
Gemini 2.5 Flash
Low P/E · P/B <1.5 · banking/telco specialist
momentum_trader
GPT-4o-mini
5d/20d momentum · volume surge · RSI 50-70
risk_analyst
Claude 3 Haiku
High beta flag · RSI >70 overbought · default LOW
macro_strategist
Gemini 2.5 Flash
BI rate cycle · IDR/USD · coal, nickel, CPO
quant_analyst
DeepSeek Chat
Score >0.40 · RSI 35-55 · volume 2.0× institutional
30-Stock LQ45 Universe
Banking (4)
BBCABBRIBMRIBBNI
Consumer/Telco (4)
TLKMASIIUNVRHMSP
Consumer Goods (4)
ICBPINDFKLBFGGRM
Energy/Mining (4)
PGASPTBAADROITMG
Industry (4)
SMGRINKPCPINBRPT
Media (4)
EMTKMNCNEXCLISAT
Property (4)
BSDECTRASMRAPWON
Metals (2)
ANTMINCO
Capital
Rp 100M
Commissions
0.15% / 0.25%
Max Hold
10 days
Lot Size
100 shares
🔍
06 — On-Demand Scanner

IHSG Scanner

On-demand bandarmology analysis for any IDX ticker. 5-signal composite, 55-broker intelligence database, whale-adjusted net ratio, money management calculator.

⚠ Deployment Status: Engine fully implemented (crypto/neobdm/). Dashboard HTML exists (neobdm_dashboard.html). API routes and /neobdm dashboard route are NOT registered in api.py. On-demand access pending wiring.
5-Signal Weights
Accumulation/Dist
0.30
Bandar Cycle
0.20
Foreign Flow
0.18
RRG Rotation
0.17
Frequency (FQ)
0.15
Verdict Thresholds
STRONG_BUY≥ 0.30
BUY≥ 0.18
SELL≤ -0.18
STRONG_SELL≤ -0.30
55-Broker Intelligence
FOREIGN_BIG10 · Whale T1
FOREIGN_MID10 · Whale T2
DOMESTIC_BIG10 · Whale T3
DOMESTIC_MID13 · Mid-tier
RETAIL8 · Retail
Additional4 · Recent
Whale-Adjusted: 30 brokers tagged whale (FOREIGN_BIG + FOREIGN_MID + DOMESTIC_BIG). Whale lots weighted in net ratio. 3+ whale consensus boosts vote.
Bandar Cycle Phases
1. ACCUMULATION
Sideways/down · low volume · smart money accumulating
2. MARK_UP
Rising · volume surge · confirmed breakout
3. DISTRIBUTION
Sideways after markup · mixed volume · not accumulating
4. MARK_DOWN
Declining · high supply · supply flooding
5. EXIT
Declining · very low volume · abandonment
Money Management Calculator
Lots = (Capital × Risk%) / (Buy Price − Stop Loss) // Constraints max_risk_per_trade = 2% of capital // hard cap max_capital_per_trade = 30% of portfolio min_rr_ratio = 2.0 // required before entry default_tp = 6% above entry default_sl = 3% below entry
07 — Intelligence Layer

AI Model Map

All AI via OpenRouter. Cost-optimized April 2026 — generalists dropped from Gemini 2.5 Pro to 20× cheaper Flash tier. 6 distinct models across 5 providers.

ModelCost TierUsed For
google/gemini-2.5-flash Mid BTC generalist + 3 personas · Altcoin (3 agents) · IHSG (2 agents)
meta-llama/llama-3.3-70b Free tier BTC generalist · Altcoin quant_scorer
openai/gpt-4o-mini Budget BTC generalist · IHSG momentum_trader
deepseek/deepseek-chat Budget BTC momentum · Altcoin momentum_hunter · IHSG quant_analyst
google/gemini-2.0-flash-001 Budget BTC contrarian persona
anthropic/claude-3-haiku Budget BTC risk_manager · IHSG risk_analyst
Consensus Formula (BTC): generalist × 0.40 + swarm × 0.60 · Generalist weights driven by historical accuracy (not normalized) · Last 50 predictions injected into next prompts · Agreement metric uses bull/bear count thresholds (p > 0.55 / p < 0.45).
08 — Self-Tuning

Adaptive Learning Layer

Core runtime system not documented in prior versions. Signal weights and thresholds evolve based on outcome feedback. Factor IC/IR analysis runs weekly. Walk-forward validation gates ML re-elevation.

signal_evolution.py
Darwinian · every 20 trades
Boost winners × 1.06
Decay losers × 0.94
Bounded: [base × 0.5, base × 1.5]
Threshold auto-evo: tighten if WR < 40%, loosen if > 65%
factor_analysis.py
Weekly IC/IR · Sunday 00:05 UTC
Information Coefficient per signal
Auto-demotion/promotion overrides
Writes to data/signal_weight_overrides.json
Example: ml_xgboost demoted to 0.03
walk_forward.py
OOS Validation · Sunday 00:20 UTC
Rolling window retraining
Out-of-sample accuracy scoring
Gatekeeper for re-elevation
Prevents overfitting approval
learner.py · attribution.py
Per-trade · continuous
Post-trade logging of conditions, exit reason, P&L
Condition keys: vpin_regime, ofi_pressure, entry_grade, session, regime
Wilson CI per pattern → skip/reduce/boost
Output: learning_insights
reasoning_log.py
Narrative audit trail
Key decisions and patterns
Populates crypto_ai_reasoning_log
Feeds dashboard reasoning panel
Feeds dashboard reasoning panel
btc_history_analyzer.py
Hour seasonality · 2+ yr data
Per-hour win rates
Volatility regimes
Recovery patterns
Empirical HOUR_WIN_RATE dict
Learning Feedback Loop
◆ TRADE CLOSES ◆
Signal Evolution
Every 20 trades
Boost ×1.06
Decay ×0.94
Bounded [0.5×, 1.5× base]
Factor Analysis
Sun 00:05 UTC
IC/IR score per signal
Auto-demote overrides →
overrides.json
Pattern Analysis
Continuous
Wilson CI per pattern
→ skip / reduce / boost
Condition-key insights
ML Retrain
Stale-triggered
30-feature XGBoost
10.7% accuracy
currently demoted
Memory Persist
Hippocampus
Engram + cycle record
BM25 search
Context injection
▸ NEXT TRADING CYCLE ◂
Adapted signal weights · Pattern insights applied · ML gated by walk-forward · Memory context in prompts
09 — Persistence

Memory System

Hippocampus is the sole memory layer after Hermes removal (v3.2.0). Engram-based pattern memory with BM25 retrieval and chronicle narratives. Partially integrated — full utilization ongoing.

Hippocampus — engram-based
Engram-based pattern memory with BM25 retrieval. Located at /root/hippocampus/. Backing store: SQLite at /root/hippocampus/data/babingepet_memory.sqlite.
Core API
store_engram()persist
search_memory(query, k)retrieve
reinforce_engram(id)strengthen
store_chronicle()narrative
get_chronicles(filter)narrative
trigger_decay()maintenance
Domain Helpers
store_btc_decision()BTC
get_btc_pattern_context()BTC
store_altcoin_trade()Altcoin
store_ihsg_pick()IHSG
health_check()ops
10 — Safety

Risk Management Layer

Multiple guard tiers across all engines: hour vetos, regime gates, vote agreement, AI consensus veto, drawdown circuit breakers, post-loss cooldowns.

BTC/USDT Guards
Hour block (UTC){18, 23, 0}
Hour boost (UTC){7,8,9,1,2,3}
Regime vetoRANGING blocks
Vote agreement< 4/13 vetos
AI consensus< 0.40 vetos
Daily DD limit−5%
Weekly DD limit−15%
Post-loss cooldown30/60/120 min
Kelly bounds8% — 20%
Entry gradeA/B only
Altcoin Guards
BTC regime gateNo LONGs if DOWN
Min score≥ 0.05 for LONG
Sector cap2 per sector
Position limit3 concurrent
Max hold24h forced
Banned tickerWR < 40% auto
IHSG Guards
Falling knife5D < −3% → ×0.6
RSI overbought> 70 flag
GK volatility>40% risky / >50% skip
News contradictSwap pick
Commission drag0.40% round-trip
Veto / Gate / Guard Taxonomy
VETO · Hour block VETO · RANGING regime VETO · <4/13 vote VETO · AI agreement <0.40 VETO · Daily/Weekly DD GATE · BTC TRENDING_DOWN GATE · Min score 0.05 GATE · Sector cap GATE · Entry grade A/B GUARD · Kelly bounds GUARD · Post-loss cooldown GUARD · Signal debounce GUARD · Banned ticker GUARD · GK vol penalty
11 — Persistence

Database Schema

Supabase PostgreSQL. 20+ tables across BTC, Altcoin, IHSG, and cross-market learning. Hosted externally, accessed via service key.

BTC/USDT Tables
crypto_signals
crypto_candles
crypto_trades
crypto_orderbook
crypto_ai_predictions
btc_decisions
crypto_sim_positions
sim_portfolio
crypto_sentiment
crypto_ai_reasoning_log
Altcoin & IHSG
altcoin_picks_history
altcoin_sim_positions
ihsg_picks_history
ihsg_sim_positions
Cross-Market
learning_insights
news
Local SQLite
Hippocampus memory runs on local SQLite (not Supabase). Sole memory layer after Hermes retirement.
babingepet_memory.sqlite
Hippocampus engrams + chronicles
~/.hermes/babingepet.db
⚠ Retired — safe to delete (Hermes v3.1.0)
12 — Interface

API Endpoint Map

60+ total endpoints exposed via FastAPI on port 8420. Grouped by market. Auth via token-based session (daily rotation).

BTC/USDT (~30 endpoints)
GET/api/healthSystem health
GET/api/priceBTC price + changes
GET/api/signalsSignal history
GET/api/orderbookLatest snapshot
GET/api/whale-tradesWhales >$500K
GET/api/sim/portfolioPortfolio snapshots
GET/api/sim/positionsOpen/closed positions
GET/api/sim/statsP&L, Sharpe, DD, WR
GET/api/sim/risk-metricsRisk metrics
GET/api/sim/kelly-metricsKelly analytics
GET/api/decisions/latestLatest verdict
GET/api/decisions/historyDecision history
GET/api/learning/insightsLearning patterns
GET/api/reasoning/logAI reasoning log
GET/api/regimeCurrent regime
GET/api/ml/predictionXGBoost output
POST/api/backtest/runTrigger backtest
GET/api/execution-costCost analytics
GET/api/prompt/statsToken stats
GET/api/recovery/statusRecovery status
IHSG (~11 endpoints)
GET/api/ihsg/picksLatest session picks
GET/api/ihsg/marketMarket overview
GET/api/ihsg/analyzeOn-demand analyze
GET/api/ihsg/sim/portfolioIHSG portfolio
GET/api/ihsg/sim/positionsIHSG positions
GET/api/ihsg/learning/insightsIHSG learning
Altcoins (~10 endpoints)
GET/api/altcoins/picksLatest 4h picks
GET/api/altcoins/analyzeOn-demand analyze
GET/api/altcoins/sim/portfolioPortfolio snaps
GET/api/altcoins/sim/positionsPositions
GET/api/altcoins/sim/risk-metricsRisk metrics
GET/api/altcoins/orderbookOrderbook
IHSG Scanner ⚠ PENDING
POST/api/neobdm/analyze/{ticker}Not registered
POST/api/neobdm/money-managementNot registered
Auth & Dashboards
POST/api/auth/loginToken issue
GET/api/auth/verifyToken verify
POST/api/auth/force-rotateManual rotate
GET/BTC dashboard ✓
GET/ihsgIHSG dashboard ✓
GET/altcoinsAltcoin dashboard ✓
GET/neobdmNot registered ⚠
13 — Time-Based Operations

Scheduler Timeline

15 active APScheduler jobs inside the FastAPI lifespan. Mix of interval (60s-4h) and cron (UTC-scheduled) triggers.

Active Jobs (from api.py)
Job IDTriggerSchedulePurpose
btc_collectorinterval60sBinance Futures data pull
btc_signalsinterval60sSignal computation
btc_simulatorinterval60sPaper trading cycle
btc_aiinterval20min9-agent AI swarm
ihsg_session_1cron01:50 UTCIHSG S1 full analysis
ihsg_session_2cron06:20 UTCIHSG S2 full analysis
ihsg_price_checkinterval30minIHSG exit checks
altcoin_analysisinterval4hAltcoin full cycle
altcoin_price_checkinterval30minAltcoin exit checks
health_dailycron23:30 UTCDaily health rollup
health_weeklycronSat 01:00 UTCWeekly anomaly scan
health_alertsinterval15minReal-time alerts
factor_ic_weeklycronSun 00:05 UTCIC/IR factor analysis
walk_forward_weeklycronSun 00:20 UTCOOS validation
auth_password_rotatecron23:00 UTCDaily password rotation
Post-Hermes cleanup (v3.2.0): The 5 Hermes analytics agent functions previously listed as "pending scheduling" have been retired along with the Hermes Agent Framework. Adaptive Learning (§08) is now the primary self-improvement mechanism.
14 — Ops

Deployment Architecture

Ubuntu 22.04+ VPS. FastAPI on port 8420 behind Nginx SSL. Single long-running process after Hermes removal. Domain and credential details redacted.

Server Stack
OSUbuntu 22.04+
RuntimePython 3.12
Web frameworkFastAPI + Uvicorn
Port8420
Reverse proxyNginx + SSL
Primary domain<primary-domain>
Secondary domain<secondary-domain>
VPS IP<vps-public-ip>
Auth
Master username<master-username>
Master password<master-password>
Daily rotation23:00 UTC
NotificationTelegram
Process Supervision
# Babingepet API (nohup — no systemd unit) nohup uvicorn crypto.api:app \ --host 0.0.0.0 --port 8420 --workers 1 \ > /tmp/babingepet.log 2>&1 & # Telegram bot runs in-process (no separate gateway after Hermes removal)
Operational gap: The main Babingepet API is not registered as a systemd unit — runs via nohup and requires manual restart after reboot. Registering babingepet.service is a recommended hardening task.
Telegram
Bot handle<telegram-bot-handle>
BTC alertsSTRONG signals
IHSG / Altcoin picksPer cycle
Health alertsEvery 15m
Environment Variables
SUPABASE_URL # Database SUPABASE_ANON_KEY # Database (anon) OPENROUTER_API_KEY # AI models TELEGRAM_BOT_TOKEN # Bot auth TELEGRAM_CHAT_ID # Target chat
15 — Observability

Health Monitoring

Three-tier health check: real-time alerts, daily rollup, weekly anomaly scan. Delivered via Telegram.

health_alerts
Every 15 min
Real-time alert loop for degraded state. Data freshness, scheduler job failures, connectivity issues.
health_daily
23:30 UTC (06:30 WIB)
Daily rollup of data freshness, connectivity status, scheduler health, all jobs fired successfully.
health_weekly
Saturday 01:00 UTC
Weekly anomaly detection + trend analysis. Surfaces degradation not visible day-to-day.
16 — Transparency

Known Gaps & Activation Backlog

Documented deltas between designed architecture and currently-wired production behavior. All items surfaced during v3.1.0 reconciliation.

1. IHSG Scanner engine has no API routes
Engine fully implemented but scanner unreachable from any dashboard.
Effort: Small — add 2 FastAPI routes
2. /neobdm dashboard route not registered
Dashboard HTML file exists on disk but no FastAPI route to serve it.
Effort: Trivial — one route line
3. ml_xgboost at 0.03 weight
ML signal effectively disabled. Re-elevation gated by walk-forward validation.
Effort: Ongoing — data-dependent
4. Polymarket zombie imports in recovery.py
Imports inside try/except fallbacks. Modules no longer exist — imports fail silently. Harmless but misleading.
Effort: Trivial — cleanup
5. Babingepet API not a systemd unit
Runs via nohup. Requires manual restart after reboot. Registering babingepet.service is a recommended hardening task.
Effort: Small — write service file
6. Hippocampus memory minimally utilized
Writes happen, reads are rare. Full potential unrealized.
Effort: Medium — integrate into prompts
17 — Historical

Polymarket Legacy

Polymarket was part of Babingepet through v2.x. Removed April 18, 2026 after zero trades in a week.

Removed
✕ All Polymarket engines + signals
✕ Scheduler jobs
✕ API endpoints (26 routes)
✕ Dashboard (/polymarket)
✕ CLOB execution layer
✕ WebSocket real-time feeds
✕ Arbitrage scanner
✕ Lifecycle state machine
Residual
• Archived at archive/polymarket/
• Zombie imports in recovery.py (try/except)
• Directory name polymarket-quant/ (historical)
• PM-related database tables (never dropped)
Safe to remove recovery.py imports during next cleanup pass. Modules don't exist — imports always fail silently inside try/except.
Babingepet 2.0 · Architecture Document · v3.2.0 · April 19, 2026
Hermes removed · Reconciled against live codebase · Sensitive data redacted · Apple-inspired glassmorphism design language