gdex-hl-anomaly
Scored, time-stamped anomaly events for HyperLiquid perps (oracle divergence, funding extremity, liquidity shock) against per-market learned baselines, with coverage records
- License 许可
- MIT
- 最近更新
- 2026-11-15
- Stars
- ★ 81
- Forks
- 17
01 前言 Front Matter
- name
- gdex-hl-anomaly
- description
- Scored, time-stamped anomaly events for HyperLiquid perps (oracle divergence, funding extremity, liquidity shock) against per-market learned baselines, with coverage records
02 资源文件 13
- 参考文档APPROACH.md5.8 KB
- 脚本backtest/backtest.py5.6 KB
- 脚本backtest/calibrate.py3.5 KB
- 参考文档backtest/calibration.json743 B
- 参考文档backtest/results.json40.4 KB
- 参考文档backtest/RESULTS.md4.7 KB
- 许可证LICENSE1.0 KB
- 参考文档sample/anomaly_coverage_sample.json443 B
- 其他sample/anomaly_sample.ndjson1.9 KB
- 脚本scripts/hl_anomaly.py14.9 KB
- 脚本scripts/test_hl_anomaly.py5.4 KB
- 参考文档SOURCE.md344 B
- 参考文档TRUST.auto.yaml2.0 KB
03 SKILL.md 正文
GDEX: HyperLiquid Anomaly Events
Detects unusual behaviour on the HyperLiquid perpetual markets that GDEX trades, and emits it as events (NDJSON, one record per event), not alerts. Each event says what was unusual, when it happened, how unusual it was against that market's own recent history, and where to re-derive it.
Standard library only — no API key, no Gemach infrastructure. Reads the public HyperLiquid
info endpoint directly.
When to Use
- Building a risk feed that needs market anomalies with an event time and a score
- Screening HyperLiquid markets for manipulation, oracle stress or liquidity shocks
- Backfilling anomaly history for a window (1h bars reach ~7 months back, 4h ~2 years)
Run
python3 scripts/hl_anomaly.py # last 24h, every active core market
python3 scripts/hl_anomaly.py --coins BTC ETH SOL --hours 72
python3 scripts/hl_anomaly.py --start 2025-03-20 --end 2025-03-27 --coins JELLY --interval 1h
Output is NDJSON: zero or more signal_type: "anomaly" records, then exactly one
signal_type: "anomaly_coverage" record.
Categories
anomaly_category |
Fires when | Source |
|---|---|---|
oracle_divergence |
hourly mark-vs-oracle premium is far from the market's baseline | fundingHistory |
funding_extremity |
8h mean funding is far from baseline and premium is outside HyperLiquid's clamp band (inside it funding is pinned to the interest rate and carries no information). Always carries the premium fields. | fundingHistory |
liquidity_shock |
bar volume or bar range spikes far above baseline (spikes only) | candleSnapshot |
large_outflow, governance_concentration and security_flag_change are part of the contract
enum but are not produced by this skill (they need on-chain or token-security sources).
Event record
Each event carries the 15-column anomaly contract shape, plus the model's own features.
| Field | Meaning |
|---|---|
anomaly_id |
stable id: sha256 of entity, category, event time and data source (first 32 hex). Re-running the same window gives the same id |
entity_id |
hl-<coin>, same key as the hl_markets feed |
entity_type |
market (a perpetual market) |
chain |
hyperliquid |
anomaly_category |
oracle_divergence, funding_extremity or liquidity_shock |
anomaly_score |
0–100. It is 0 at the calibrated threshold and rises monotonically above it. A ranking, not a probability |
confidence |
not emitted. Nothing in the model is a calibrated probability, and the field is left out rather than faked |
detection_method |
statistical: robust z against a learned per-market baseline |
model_version |
changes whenever thresholds or features change |
baseline_window |
7d |
observed_metric |
the quantity that fired: premium_pct, funding_8h_mean_hourly_pct, volume_base or bar_range_pct |
observed_value, expected_value |
that quantity, and its baseline median (the model's expectation) |
detected_at |
epoch seconds when the anomaly happened (the funding hour, or the bar close), not when the job ran. detected_at_utc gives the same instant in ISO-8601 |
evidence_ref |
the public endpoint, coin, time, and a sha256 of the exact baseline used |
summary |
one-line description |
z, z_threshold, feature fields |
the robust z and the threshold it crossed; premium/funding or volume/range values and their baselines |
Coverage record — read this before trusting an empty result
Every run states detector_window_start, detector_window_end, markets_scored and markets_not_scored
(too little history, delisted, or no data). No event for a scored market means nothing
crossed a threshold in that window; it does not mean the market was normal. Markets in
markets_not_scored were not evaluated at all.
Method and evidence
APPROACH.md— the model, why each choice was made, and its known limitsbacktest/RESULTS.md— hit rate and false-alarm rate on three real eventsbacktest/calibrate.py,backtest/backtest.py— reproduce bothsample/anomaly_sample.ndjson— records for contract tests
04 同仓库更多 Skills
troves
Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say "Troves" explicitly.
trade
Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say "swap".
staking
Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say "stake" explicitly.
send
Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say "pay 10 STRK to 0x...".
portfolio
View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks "what do I have", "show me everything", "how much am I worth", "my positions", "my investments", "rebalance my portfolio", "I want 50% ETH", "optimize my holdings", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say "portfolio".
multi-swap
Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions "two swaps", "three swaps", "swap X and Y at the same time", or wants to convert multiple tokens in a single call.