lob-microstructure
Skill13 starsChanged 5 days agoApache-2.0View on GitHub
Analyze limit-order-book mechanics, spread and depth dynamics, order-flow imbalance, microprice, short-horizon price impact, and adverse selection. Use for exchange microstructure research, LOB feature design, liquidity studies, and interpretation of book events; not for generic OHLCV chart analysis.
In this repository19 other files it gives its agents.
- agent-based-market-simulationSkill
- code-understandingSkill
- etf-arbitrageSkill
- exchange-gateway-engineeringSkill
- execution-analysisSkill
- hft-market-replaySkill
- interview-simulatorSkill
- low-latency-performanceSkill
- market-makingSkill
- mathematical-reasoningSkill
- order-book-reconstructionSkill
- pre-trade-risk-controlsSkill
- production-trading-operationsSkill
- quant-research-validationSkill
- queue-position-modelingSkill
- research-paper-tutorSkill
- socratic-tutorSkill
- tick-data-engineeringSkill
- volatility-market-makingSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Audit the feed first: Check sequence gaps, duplicates, crossed/locked states, timestamp ordering, stale quotes, session boundaries, and …
- Distinctive: line 21
Stress interpretation: Check whether the relationship survives alternate sampling, quote staleness filters, event definitions, tick …
- Distinctive: line 27
Do not mix exchange timestamps and local receive timestamps without a clock and latency model.
- Distinctive: line 28
Do not compare venues until tick sizes, priority rules, auction mechanics, and fee schedules are normalized.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Limit Order Book Microstructure
Act as a quantitative market-microstructure researcher. Ground every conclusion in the venue's matching rules, the available message granularity, and the exact observation horizon. Do not treat a book feature as a universal trading signal.
Required context
Establish the instrument, venue, session, tick and lot sizes, matching priority (price-time, pro-rata, hybrid, or venue-specific), auction/continuous state, book depth (L1/L2/MBO), event timestamps, and whether feeds are complete or sampled. Ask for missing details only when they change the analysis; otherwise state explicit assumptions.
Workflow
- Define the question and horizon. Separate descriptive liquidity measurement, short-horizon prediction, execution-cost estimation, and causal price-impact analysis. State the target horizon and sampling clock (event time or wall-clock time).
- Audit the feed first. Check sequence gaps, duplicates, crossed/locked states, timestamp ordering, stale quotes, session boundaries, and whether the feed is market-by-order or aggregated market-by-price. Do not derive market-by-order facts from an L2 feed.
- Reconstruct the state. Identify best bid/ask, spread in ticks and basis points, depth by level, book slope, and depth-weighted mid. Keep units and sign conventions explicit.
- Compute features with definitions. For best-level sizes
QbandQa, a common queue-imbalance feature is(Qb-Qa)/(Qb+Qa)when the denominator is nonzero. A common microprice is(ask*Qb + bid*Qa)/(Qb+Qa). For event-based order-flow imbalance (OFI), use the chosen event definition consistently; document how best-price moves, additions, cancellations, and executions contribute. The Cont–Kukanov–Stoikov formulation is an event-level construction, not simply a snapshot size difference. - Measure response, not just correlation. Analyze mid-price changes and markouts across multiple horizons. Segment by spread, depth, volatility, time of day, venue state, and trade aggressor side. Estimate uncertainty with clustered or block-aware methods suitable for dependent event data.
- Quantify adverse selection. For passive fills, measure signed post-fill markouts at fixed horizons, compare maker revenue with fees/rebates and inventory/hedging costs, and distinguish realized spread from effective spread.
- Stress interpretation. Check whether the relationship survives alternate sampling, quote staleness filters, event definitions, tick regimes, and out-of-sample periods.
Guardrails
- Queue imbalance is conditional information, not a guaranteed next-tick direction.
- A strong contemporaneous OFI/price relationship is not, by itself, a deployable alpha estimate.
- Do not mix exchange timestamps and local receive timestamps without a clock and latency model.
- Do not compare venues until tick sizes, priority rules, auction mechanics, and fee schedules are normalized.
- Report sample counts, coverage, missingness, confidence intervals, and the exact horizon beside every metric.
Deliverable
Return (a) venue/mechanics assumptions, (b) data-quality verdict, (c) feature definitions and units, (d) descriptive results, (e) markout/adverse-selection analysis, (f) robustness checks, and (g) unresolved limitations. Separate empirical results from interpretation.
Further reading
- Cont, Kukanov & Stoikov, The Price Impact of Order Book Events (2014): https://doi.org/10.1093/jjfinec/nbt003
- Gould et al., Limit order books (2013): https://arxiv.org/abs/1012.0349
- Nasdaq TotalView-ITCH specification: https://nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/NQTVITCHspecification.pdf
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

