Skip to content

Quanturama/Skill-X1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Q5 Momentum Classifier

BNB Hack: AI Trading Agent Edition 2026 — Track 2: CMC Strategy Skill

A deterministic BSC momentum skill that scores five microstructure questions and returns a fully specified trade decision. No LLM required. All signals are numeric, all rules are explicit, every output is reproducible.


What It Does

Most strategy skills return LLM-generated commentary. This one returns a trade spec — a structured object with entry price, stop loss, two take-profit levels, R:R ratio, and position size — or nothing, if conditions don't warrant a trade.

The core question it answers per signal:

Is the market in a state where microstructure asymmetry favors a directional entry with R:R ≥ 2.0?


CMC Data Integration

All five scoring inputs are sourced from CoinMarketCap Agent Hub in live use:

Input CMC Source
price_5m_change_pct CMC quotes + klines
price_1h_change_pct CMC quotes
volume_1h_vs_avg CMC historical volume
liquidity_score CMC market liquidity proxy
funding_rate CMC perp data via review_perp_orderbook_pressure skill

The live agent additionally calls detect_market_regime and monitor_market_sentiment_shift from CMC Skill Hub as a macro veto layer on top of this skill's output.


The Q5 Scoring Engine

Five questions, deterministic answers, max 10 points:

Question Max Signal
Q1 — Momentum alignment 3 pts 5m + 1h same direction = 3, 5m only = 1, none = 0
Q2 — Volume confirmation 2 pts ≥1.5× avg = 2, ≥1.2× = 1, below = 0
Q3 — Execution quality 2 pts Spread < 0.1% and no SPREAD_WIDE flag
Q4 — Funding rate 2 pts Neutral funding = 2, moderate = 1, extreme = 0
Q5 — Liquidity 1 pt liquidity_score ≥ 0.6

Gate: score ≥ 6.5 → eligible. Below → NOISE, no trade.

Direction is set by Q1 only — deterministic from 5m momentum sign. No LLM involved in direction.


3C Entry Filter

When score clears the gate, three conditions must pass before a trade spec is built:

  • C1 — Context: direction must be LONG or SHORT (not FLAT)
  • C2 — Catalyst: price not extended — LONG below 80% of 24h range, SHORT above 20%
  • C3 — Confirmation: 1h momentum aligned with direction

Any failure → null trade spec returned. Signal logged, no entry.


Exit Protocol

Static, set at entry, never modified:

Exit Level Size
SL day low × 0.995 (LONG) / day high × 1.005 (SHORT) 100%
TP1 entry ± 2R 50% close
TP2 entry ± 3R remaining 50%
Time 7200s (2h) 100% remaining

Minimum R:R enforced at 2.0 before any trade spec is returned.


Usage

from q5_momentum.implementation import run

result = run({
    "symbol": "ADA",
    "current_price": 0.62,
    "price_24h_high": 0.65,
    "price_24h_low": 0.58,
    "price_1h_change_pct": 0.012,
    "price_5m_change_pct": 0.004,
    "volume_1h_vs_avg": 1.65,
    "spread": 0.0004,
    "funding_rate": 0.0002,
    "liquidity_score": 0.75,
    "risk_flags": [],
})

# result["regime"]           → "TRENDING_LONG"
# result["score"]            → 10.0
# result["sl_price"]         → 0.5771
# result["tp1_price"]        → 0.7058
# result["rr_ratio"]         → 2.0
# result["position_size_pct"]→ 0.02

No dependencies. Pure Python 3.11+.


Backtest

14 days, 5-minute resolution, 6 BSC tokens (ADA, LINK, INJ, DOGE, FLOKI, PENDLE).

Metric Value
Total trades 518
Win rate 44.6%
Avg win +0.95%
Avg loss -0.98%
Breakeven win rate @ 2.0 R:R 34%

Window is a ranging market — TIME exits dominate because price rarely trends 2h without the macro filter layer. The live agent pairs this skill with a CMC detect_market_regime veto that suppresses entries during range_chop regimes.

# Reproduce — Binance public API, no key required
python3 backtest/run_backtest.py

Why Deterministic

LLM-based strategy skills are unauditable — the same inputs can produce different outputs, and judges can't verify rule adherence. Q5 Momentum Classifier is the opposite: given the same inputs, it always returns the same output. The scoring logic is inspectable line-by-line. The backtest is reproducible by anyone with a Python interpreter.

That's what a strategy spec needs to be if it's going to be trusted in a live agent.

About

CMC BSC use

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages