diff --git a/.gitignore b/.gitignore index d803c05..4f7a895 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .claude/ .tmp/ +.obsidian/ +research/ diff --git a/venue-expert/CONTRIBUTING.md b/venue-expert/CONTRIBUTING.md new file mode 100644 index 0000000..99d6127 --- /dev/null +++ b/venue-expert/CONTRIBUTING.md @@ -0,0 +1,99 @@ +# Contributing a New Venue + +## File Placement + +``` +venue-expert/{asset_class}/{region}/{venue}.md # standalone (ice.md, eurex.md, hkex.md) +venue-expert/{asset_class}/{region}/{venue}/{venue}.md # venue with reference docs (nyse/, nasdaq/) +venue-expert/{asset_class}/{region}/{country}/{venue}.md # country-grouped (china/shfe.md) +``` + +Use a subdirectory when the venue needs its own `references/` folder (specs, regulatory docs). + +| Token | Values | +|-------|--------| +| `asset_class` | `equity`, `futures` | +| `region` | `amer`, `emea`, `apac` | +| `country` | only when region has multiple exchanges in one country (e.g. `china`) | +| `venue` | lowercase exchange name (`shfe`, `cme`, `ice`, `nyse`, `hkex`) | + +## 12-Section Template + +New venues should follow all 12 sections (exemplars: `shfe.md`, `gfex.md`). Older docs deviate. Omit sections only if genuinely N/A. + +| # | Section | What Goes Here | +|---|---------|----------------| +| 1 | Identity & Products | MIC, timezone, product table (code/multiplier/tick/hours), operator | +| 2 | Data Characteristics | Feed protocol, encoding, tick timestamps, price encoding quirks, depth | +| 3 | Data Validation Checklist | Sentinel values, known bad fields, filtering rules | +| 4 | Order Book Mechanics | Matching algorithm, modify semantics (queue retain/loss), implied books | +| 5 | Transaction Costs | Fee tiers (maker/taker), exchange fees, clearing fees, spread norms | +| 6 | Position Limits & Margin | Limit tiers, margin model (SPAN/VaR/fixed), hedge exemptions | +| 7 | Regulatory Framework | Regulator, key rules, access restrictions, reporting obligations | +| 8 | Regime Change Database | Historical parameter changes with dates (fees, limits, hours, products) | +| 9 | Failure Modes & Gotchas | Known feed gaps, recovery behavior, common integration mistakes | +| 10 | Market Maker Programs | MM obligations, benefits, tiers, LMM/DMM specifics | +| 11 | Empirical Parameters | Fill rates, cancel rates, typical spreads, queue dynamics | +| 12 | Primary Sources | Official docs, spec PDFs, API references, regulatory filings | + +## Research Questions + +Answer these before writing. Tables over prose. + +### Universal (all venues) + +| # | Question | +|---|----------| +| 1 | What matching algorithm? FIFO, pro-rata, hybrid? Modify = queue loss? | +| 2 | What market data protocol? Encoding, transport, depth, implied books? | +| 3 | What are the session hours in UTC? Pre-open, continuous, auction, night? | +| 4 | What are the fee tiers? Maker-taker or flat? Rebate thresholds? | +| 5 | What margin model? SPAN, SPAN 2, VaR, fixed percentage? | +| 6 | What position limits? Per-contract, per-account, near-expiry tightening? | +| 7 | What are the known data quirks? Sentinel values, timestamp resolution, bad fields? | +| 8 | What happens on disconnect? Replay available? Gap recovery mechanism? | +| 9 | Where is the matching engine physically? Co-location options? | +| 10 | Who is the regulator? Key rules affecting electronic trading? | +| 11 | What products trade? Code, multiplier, tick size, contract size, hours? | +| 12 | What market maker programs exist? Obligations, tiers, benefits? | +| 13 | What historical regime changes? Fee/hour/limit changes with dates? | +| 14 | What empirical parameters? Typical spreads, fill rates, queue depths? | + +### Futures-specific + +| # | Question | +|---|----------| +| F1 | Settlement method? Daily mark, VWAP window, or closing price? | +| F2 | Spread instruments native or synthetic? Implied pricing? | + +### Equity-specific + +| # | Question | +|---|----------| +| E1 | Auction mechanics? Opening/closing cross, order types eligible? | +| E2 | Market maker obligations? DMM/LMM/eDMM? Parity or time priority? | + +## Post-Write Checklist + +After writing `{venue}.md`, update these files: + +| # | File | Action | +|---|------|--------| +| 1 | `SKILL.md` — L3 File Index | Add row to equity or futures table | +| 2 | `SKILL.md` — Context Detection | Add query pattern → L1/L2/L3 routing row | +| 3 | `matrices/matching_algorithms.md` | Add venue's matching algo, modify semantics | +| 4 | `matrices/latency.md` | Add cross-venue fiber/mw latency; within-DC latency from co-lo specs | +| 5 | `matrices/session_overlaps.md` | Add session hours in UTC | +| 6 | `matrices/tcost_comparison.md` | Add spread/impact/fill-rate/fees | +| 7 | `matrices/data_characteristics.md` | Add feed protocol, encoding, depth, quirks | +| 8 | `cards/{appropriate_card}.md` | Add venue to existing L1 card or create new one | +| 9 | Parent region/country doc | Add venue reference (e.g. `futures_china.md`, `equity_amer.md`) | +| 10 | `SKILL.md` — Debugging Checklist | Add section if new asset class or region | + +## Style Rules + +- Default to tables; prose permitted for sequential logic (matching waterfalls, recovery sequences) +- First line after `#` title = one-sentence context blurb (what, where, assumes what) +- Use `**bold**` for values that surprise or contradict assumptions +- Link parent doc in blurb (e.g. "Assumes familiarity with `futures_china.md`") +- No filler, no hedging, no "it is worth noting" diff --git a/venue-expert/README.md b/venue-expert/README.md new file mode 100644 index 0000000..922b506 --- /dev/null +++ b/venue-expert/README.md @@ -0,0 +1,37 @@ +# venue-expert + +3-layer microstructure knowledge base for trading venues. + +## Why + +Centralizes venue mechanics that otherwise get re-researched per engineer and silently differ across backtests. + +## Layers + +| Layer | Dir | Speed | Use Case | +|-------|-----|-------|----------| +| L1 Cards | `cards/` | 30 sec | Quick lookup, orientation, onboarding | +| L2 Matrices | `matrices/` | 2 min | Cross-venue comparison, strategy-to-venue fit | +| L3 Deep Docs | `{asset_class}/{region}/` | 10+ min | Deep research, debugging | + +Query-pattern routing in `SKILL.md` maps keywords to the cheapest sufficient layer. + +## Key Files + +| File | Purpose | +|------|---------| +| [`SKILL.md`](SKILL.md) | Routing table — maps query patterns to L1/L2/L3 files | +| [`CONTRIBUTING.md`](CONTRIBUTING.md) | How to add a new venue (template, research questions, checklist) | +| `cards/*.md` | L1 quick-reference cards | +| `matrices/*.md` | L2 cross-venue comparison tables | + +## Coverage + +| Asset Class | Venues | +|-------------|--------| +| US Equity | 16 exchanges across 6 operators (NYSE, Nasdaq, Cboe, IEX, MEMX, LTSE, MIAX Pearl) | +| Chinese Futures | SHFE, DCE, CZCE, CFFEX, INE, GFEX | +| Americas Futures | CME Group (CME, CBOT, NYMEX, COMEX) | +| EMEA Futures | ICE Futures Europe, Eurex | +| APAC Futures | SGX | +| APAC Equity | HKEX | diff --git a/venue-expert/SKILL.md b/venue-expert/SKILL.md index 9b6e4b5..6715d4c 100644 --- a/venue-expert/SKILL.md +++ b/venue-expert/SKILL.md @@ -17,147 +17,138 @@ description: > # Venue Expert -Hierarchical microstructure knowledge base for trading venues. Primary use cases: research, debugging, and building trading systems. - -## Purpose - -Provide deep venue-specific expertise for: -- Quants building execution models and alpha signals -- Developers implementing feed handlers and order entry -- Researchers studying market microstructure -- Debuggers diagnosing trading system issues - -## Hierarchy Model - -Knowledge is organized in an inheritance hierarchy: - -``` -Asset Class (equity, futures, crypto, fx) - | - v -Geography (amer, emea, apac) - | - v -Exchange (nasdaq, nyse, cme, binance) -``` - -Each level inherits concepts from its parent. Exchange-level files assume familiarity with geo-level and asset-class-level concepts. - -## Current Coverage - -**Implemented paths:** -- `equity/` - Equity market fundamentals -- `equity/amer/` - US equity market structure (Reg NMS, NBBO, SIP, TRF) -- `equity/amer/nasdaq/` - Nasdaq-specific mechanics (ITCH, OUCH, crosses) -- `futures/` - Futures market fundamentals -- `futures/apac/` - APAC futures overview -- `futures/apac/china/` - Chinese futures (CTP, 5 exchanges, regulatory) -- `futures/apac/china/shfe/` - SHFE metals/energy -- `futures/apac/china/dce/` - DCE ferrous/agricultural -- `futures/apac/china/czce/` - CZCE agricultural/chemicals -- `futures/apac/china/cffex/` - CFFEX financial futures -- `futures/apac/china/ine/` - INE internationalized products - -**Planned paths:** -- `equity/amer/nyse/` - NYSE mechanics -- `equity/emea/lse/` - London Stock Exchange -- `futures/amer/cme/` - CME Group -- `crypto/binance/` - Binance exchange - -## Navigation - -### Context Detection - -Route to appropriate depth based on query specificity: - -| Query Pattern | Target File | -|---------------|-------------| -| Generic equity concepts | `equity/equity.md` | -| US market structure, Reg NMS, NBBO | `equity/amer/equity_amer.md` | -| Nasdaq-specific (ITCH, NOII, crosses) | `equity/amer/nasdaq/nasdaq.md` | -| Generic futures concepts | `futures/futures.md` | -| APAC futures overview | `futures/apac/futures_apac.md` | -| Chinese futures, CTP, 夜盘 | `futures/apac/china/futures_china.md` | -| SHFE-specific (metals, CloseToday) | `futures/apac/china/shfe/shfe.md` | -| DCE-specific (iron ore, stop orders) | `futures/apac/china/dce/dce.md` | -| CZCE-specific (3-digit years, UpdateMillisec=0) | `futures/apac/china/czce/czce.md` | -| CFFEX-specific (index futures, restrictions) | `futures/apac/china/cffex/cffex.md` | -| INE-specific (crude oil, foreign access) | `futures/apac/china/ine/ine.md` | - -### Drill-Down Behavior - -Start at the most specific applicable level. Reference parent concepts without repeating them. For example, when discussing Nasdaq auctions, assume familiarity with US equity auction concepts from `equity_amer.md`. - -## Reference Organization - -Each level has a `references/` directory with subdirectories: - -- `regulatory/` - Rules, regulations, compliance guidance -- `specs/` - Protocol specifications, data formats - -Reference files provide deep detail on specific topics. Load them when queries require specification-level precision. +3-layer microstructure knowledge base for trading venues. + +## Layer Navigation + +| Layer | Dir | Purpose | When to Use | +|-------|-----|---------|-------------| +| L1 Cards | `cards/` | 30-sec venue overview | Quick lookup, orientation | +| L2 Matrices | `matrices/` | Cross-venue comparison | Comparing venues, finding arb | +| L3 Deep Docs | existing hierarchy | Full venue documentation | Deep research, debugging | + +## L1 Card Index + +| Card | Path | Coverage | +|------|------|----------| +| US Equity | `cards/us_equity.md` | 16 exchanges, SIPs, fee models, LULD, auctions, co-lo | +| Chinese Futures | `cards/chinese_futures.md` | 6 exchanges (SHFE/DCE/CZCE/CFFEX/INE/GFEX), CTP, sessions, fees, spreads | +| CME Group | `cards/cme.md` | 4 exchanges (CME/CBOT/NYMEX/COMEX), MDP 3.0, matching algos, SPAN 2 | +| Global Venues | `cards/global_venues.md` | ICE, Eurex, SGX, HKEX, GFEX overview | + +## L2 Matrix Index + +| Matrix | Path | Coverage | +|--------|------|----------| +| Matching Algorithms | `matrices/matching_algorithms.md` | FIFO/Pro-Rata/Allocation across all venues; modify semantics; LMM/DMM | +| Latency | `matrices/latency.md` | Cross-venue fiber/microwave; within-DC; exchange matching latency | +| Session Overlaps | `matrices/session_overlaps.md` | All venues in UTC; overlap windows; cross-venue arb timing | +| Transaction Cost | `matrices/tcost_comparison.md` | Spreads, impact, fill rates, cancel rates, recovery across venues | +| Data Characteristics | `matrices/data_characteristics.md` | Feed protocols, encoding, depth, timestamps, quirks per venue | + +## Context Detection + +| Query Pattern | L1 Card | L2 Matrix | L3 Deep Doc | +|-------|---------|-----------|-------------| +| US equity overview, venues, fees | `cards/us_equity.md` | — | [[equity/amer/equity_amer.md\|equity_amer.md]] | +| Nasdaq ITCH, OUCH, crosses | `cards/us_equity.md` | `matrices/data_characteristics.md` | [[equity/amer/nasdaq/nasdaq.md\|nasdaq.md]] | +| NYSE, DMM, parity, XDP | `cards/us_equity.md` | `matrices/matching_algorithms.md` | [[equity/amer/nyse/nyse.md\|nyse.md]] | +| Chinese futures, CTP, 夜盘 | `cards/chinese_futures.md` | — | [[futures/apac/china/futures_china.md\|futures_china.md]] | +| SHFE metals, CloseToday | `cards/chinese_futures.md` | — | [[futures/apac/china/shfe.md\|shfe.md]] | +| DCE iron ore, stop orders | `cards/chinese_futures.md` | — | [[futures/apac/china/dce.md\|dce.md]] | +| CZCE 3-digit codes, UpdateMillisec=0 | `cards/chinese_futures.md` | `matrices/data_characteristics.md` | [[futures/apac/china/czce.md\|czce.md]] | +| CFFEX index futures, restrictions | `cards/chinese_futures.md` | — | [[futures/apac/china/cffex.md\|cffex.md]] | +| INE crude oil, foreign access | `cards/chinese_futures.md` | — | [[futures/apac/china/ine.md\|ine.md]] | +| GFEX silicon, lithium, palladium | `cards/chinese_futures.md` / `cards/global_venues.md` | — | [[futures/apac/china/gfex.md\|gfex.md]] | +| CME overview, MDP 3.0, SPAN | `cards/cme.md` | — | [[futures/amer/cme.md\|cme.md]] | +| CME matching, FIFO vs Pro-Rata | `cards/cme.md` | `matrices/matching_algorithms.md` | [[futures/amer/cme.md\|cme.md]] | +| CME settlement, VWAP window | `cards/cme.md` | — | [[futures/amer/cme.md\|cme.md]] | +| ICE Brent, Basildon | `cards/global_venues.md` | `matrices/latency.md` | [[futures/emea/ice.md\|ice.md]] | +| Eurex, EOBI, FGBL, FESX | `cards/global_venues.md` | `matrices/matching_algorithms.md` | [[futures/emea/eurex.md\|eurex.md]] | +| SGX iron ore, TITAN, ITCH | `cards/global_venues.md` | `matrices/latency.md` | [[futures/apac/sgx.md\|sgx.md]] | +| HKEX broker queue, OMD-C | `cards/global_venues.md` | `matrices/data_characteristics.md` | [[equity/apac/hkex.md\|hkex.md]] | +| Matching algorithm comparison | — | `matrices/matching_algorithms.md` | — | +| Latency, microwave, fiber | — | `matrices/latency.md` | — | +| Session overlaps, trading hours | — | `matrices/session_overlaps.md` | — | +| Spread, tcost, market impact | — | `matrices/tcost_comparison.md` | — | +| Data feed, protocol, quirks | — | `matrices/data_characteristics.md` | — | +| Queue position, fill rate | — | `matrices/tcost_comparison.md` | [[futures/apac/china/references/models/queue_position.md\|queue_position.md]] | +| Regime changes, regulatory | `cards/chinese_futures.md` / `cards/us_equity.md` | — | [[futures/apac/china/references/regime_changes.md\|regime_changes.md]] | +| Generic futures concepts | — | — | [[futures/futures.md\|futures.md]] | +| Generic equity concepts | — | — | [[equity/equity.md\|equity.md]] | +| Spread execution, calendar spreads | — | — | [[futures/references/spreads.md\|spreads.md]] | +| Flow interpretation, OI patterns | — | — | [[futures/references/flow_interpretation.md\|flow_interpretation.md]] | + +## L3 File Index + +### Equity + +| Path | Description | +|------|-------------| +| [[equity/equity.md\|equity.md]] | Equity market fundamentals (CLOB, order types, sessions) | +| [[equity/amer/equity_amer.md\|equity_amer.md]] | US equity market structure (Reg NMS, NBBO, SIP, TRF) | +| [[equity/amer/nasdaq/nasdaq.md\|nasdaq.md]] | Nasdaq exchange mechanics (ITCH, OUCH, crosses) | +| [[equity/amer/nasdaq/references/specs/itch_protocol.md\|itch_protocol.md]] | ITCH 5.0 protocol specification | +| [[equity/amer/nasdaq/references/specs/ouch_protocol.md\|ouch_protocol.md]] | OUCH 4.2/5.0 order entry spec | +| [[equity/amer/nasdaq/references/specs/totalview.md\|totalview.md]] | TotalView product details | +| [[equity/amer/nasdaq/references/regulatory/nasdaq_rules.md\|nasdaq_rules.md]] | Nasdaq rulebook highlights | +| [[equity/amer/references/regulatory/sec_reg_nms.md\|sec_reg_nms.md]] | Reg NMS overview | +| [[equity/amer/references/regulatory/finra_rules.md\|finra_rules.md]] | FINRA rules reference | +| [[equity/amer/references/regulatory/rule_605_606.md\|rule_605_606.md]] | Disclosure rules (605/606) | +| [[equity/amer/references/specs/sip_specs.md\|sip_specs.md]] | SIP specifications | +| [[equity/amer/nyse/nyse.md\|nyse.md]] | NYSE mechanics (DMM, parity, XDP, auctions) | +| [[equity/apac/hkex.md\|hkex.md]] | HKEX equity mechanics (broker queue, OMD-C, Stock Connect) | +| `equity/emea/lse/` | London Stock Exchange — planned | + +### Futures + +| Path | Description | +| --------------------------------------------------------------------------------------------- | ------------------------------------------------------------- | +| [[futures/futures.md\|futures.md]] | Futures market fundamentals (margin, settlement, rolls) | +| [[futures/references/spreads.md\|spreads.md]] | Calendar/inter-commodity spread mechanics (CME/ICE) | +| [[futures/references/flow_interpretation.md\|flow_interpretation.md]] | Flow analysis framework | +| [[futures/apac/futures_apac.md\|futures_apac.md]] | APAC futures overview | +| [[futures/apac/china/futures_china.md\|futures_china.md]] | Chinese futures main doc (CTP, 6 exchanges, regulatory) | +| [[futures/apac/china/shfe.md\|shfe.md]] | SHFE specifics (metals, CloseToday) | +| [[futures/apac/china/dce.md\|dce.md]] | DCE specifics (iron ore, stop orders) | +| [[futures/apac/china/czce.md\|czce.md]] | CZCE specifics (3-digit codes, UpdateMillisec=0) | +| [[futures/apac/china/cffex.md\|cffex.md]] | CFFEX specifics (index futures, restrictions) | +| [[futures/apac/china/ine.md\|ine.md]] | INE specifics (crude oil, foreign access) | +| [[futures/apac/china/gfex.md\|gfex.md]] | GFEX specifics (silicon, lithium, palladium, mixed ownership) | +| [[futures/apac/china/references/specs/ctp_market_data.md\|ctp_market_data.md]] | CTP struct specification | +| [[futures/apac/china/references/specs/data_quality_checklist.md\|data_quality_checklist.md]] | Validation checklist | +| [[futures/apac/china/references/specs/ctp_versions.md\|ctp_versions.md]] | CTP SDK version history and breaking changes | +| [[futures/apac/china/references/specs/failure_modes.md\|failure_modes.md]] | Failure mode catalog | +| [[futures/apac/china/references/models/queue_position.md\|queue_position.md]] | Queue estimation models | +| [[futures/apac/china/references/models/trade_direction.md\|trade_direction.md]] | Trade direction inference | +| [[futures/apac/china/references/models/causal_analysis.md\|causal_analysis.md]] | Causal identification framework | +| [[futures/apac/china/references/models/cross_product_analysis.md\|cross_product_analysis.md]] | Cross-product patterns | +| [[futures/apac/china/references/models/spreads.md\|spreads.md]] | Chinese spread execution (CTP, legging risk) | +| [[futures/apac/china/references/regime_changes.md\|regime_changes.md]] | Regime change database | +| [[futures/amer/cme.md\|cme.md]] | CME Group mechanics (MDP 3.0, matching, SPAN, settlement) | +| [[futures/emea/ice.md\|ice.md]] | ICE Futures Europe mechanics (Brent, iMpact, Basildon) | +| [[futures/emea/eurex.md\|eurex.md]] | Eurex mechanics (EOBI, T7, volatility interruptions) | +| [[futures/apac/sgx.md\|sgx.md]] | SGX mechanics (iron ore, TITAN, ITCH) | +| `futures/apac/hkex/` | HKEX derivatives — planned | ## Debugging Checklist -When debugging trading system issues: - ### US Equity -1. **Feed issues** - Check sequence gaps, timestamp alignment, halt state handling -2. **Auction issues** - Verify order type eligibility, cutoff times, NOII parsing -3. **Execution issues** - Validate tick/lot compliance, fee tier, priority rules -4. **Regulatory issues** - Confirm trade-through protection, best execution logic +1. **Feed issues** — Check sequence gaps, timestamp alignment, halt state handling +2. **Auction issues** — Verify order type eligibility, cutoff times, NOII parsing +3. **Execution issues** — Validate tick/lot compliance, fee tier, priority rules +4. **Regulatory issues** — Confirm trade-through protection, best execution logic ### Chinese Futures (CTP) -1. **Data issues** - DBL_MAX validation (1.7976931348623157e+308), CZCE UpdateMillisec=0, night replay filtering -2. **Session issues** - TradingDay vs ActionDay semantics, 21:00 reset, trading breaks (10:15-10:30) -3. **Order issues** - CloseToday/CloseYesterday (SHFE/INE), cancel-replace queue loss, DCE stop orders -4. **Auth issues** - 看穿式监管 AppID/AuthCode, CTP version ≥6.3.15, physical machine required -5. **Gap issues** - CTP has NO replay; reconnection gaps are permanent data loss - -## File Index - -### Content Files - -**Equity:** -- `equity/equity.md` - Equity market fundamentals -- `equity/amer/equity_amer.md` - US equity market structure -- `equity/amer/nasdaq/nasdaq.md` - Nasdaq exchange mechanics - -**Futures:** -- `futures/futures.md` - Futures market fundamentals -- `futures/apac/futures_apac.md` - APAC futures overview -- `futures/apac/china/futures_china.md` - Chinese futures (main) -- `futures/apac/china/shfe/shfe.md` - SHFE specifics -- `futures/apac/china/dce/dce.md` - DCE specifics -- `futures/apac/china/czce/czce.md` - CZCE specifics -- `futures/apac/china/cffex/cffex.md` - CFFEX specifics -- `futures/apac/china/ine/ine.md` - INE specifics - -### Reference Files - -**US Equity References:** -- `equity/amer/references/regulatory/sec_reg_nms.md` - Reg NMS overview -- `equity/amer/references/regulatory/finra_rules.md` - FINRA rules -- `equity/amer/references/regulatory/rule_605_606.md` - Disclosure rules -- `equity/amer/references/specs/sip_specs.md` - SIP specifications - -**Nasdaq References:** -- `equity/amer/nasdaq/references/specs/itch_protocol.md` - ITCH 5.0 spec -- `equity/amer/nasdaq/references/specs/ouch_protocol.md` - OUCH 4.2/5.0 spec -- `equity/amer/nasdaq/references/specs/totalview.md` - TotalView product -- `equity/amer/nasdaq/references/regulatory/nasdaq_rules.md` - Nasdaq rulebook - -**Futures References:** -- `futures/references/spreads.md` - Calendar/inter-commodity spread mechanics (CME/ICE) -- `futures/references/flow_interpretation.md` - Flow analysis framework (when flow signals direction) - -**Chinese Futures References:** -- `futures/apac/china/references/specs/ctp_market_data.md` - CTP struct specification -- `futures/apac/china/references/specs/data_quality_checklist.md` - Validation checklist -- `futures/apac/china/references/specs/failure_modes.md` - Failure mode catalog -- `futures/apac/china/references/models/queue_position.md` - Queue estimation models -- `futures/apac/china/references/models/trade_direction.md` - Trade direction inference -- `futures/apac/china/references/models/causal_analysis.md` - Causal identification framework -- `futures/apac/china/references/models/cross_product_analysis.md` - Cross-product patterns -- `futures/apac/china/references/models/spreads.md` - Chinese spread execution (CTP, legging risk) -- `futures/apac/china/references/regime_changes.md` - Regime change database +1. **Data issues** — DBL_MAX validation (1.7976931348623157e+308), CZCE UpdateMillisec=0, night replay filtering +2. **Session issues** — TradingDay vs ActionDay semantics, 21:00 reset, trading breaks (10:15–10:30) +3. **Order issues** — CloseToday/CloseYesterday (SHFE/INE), cancel-replace queue loss, DCE stop orders +4. **Auth issues** — 看穿式监管 AppID/AuthCode, CTP version >= 6.3.15, physical machine required +5. **Gap issues** — CTP has NO replay; reconnection gaps are permanent data loss + +### CME Group +1. **Feed issues** — MDP 3.0 sequence gaps; use Feed A/B arbitration first, then UDP snapshot recovery +2. **Book issues** — Implied depth = 2 (not 10); consolidate direct + implied books separately +3. **Matching issues** — Check per-product algorithm (F/K/A/C/Q/O); FIFO qty-down retains priority +4. **Margin issues** — SPAN 2 migration in progress; energy already on VaR-based; check asset class status +5. **Settlement issues** — ES/NQ window may have shifted; verify with CME GCC before production diff --git a/venue-expert/cards/chinese_futures.md b/venue-expert/cards/chinese_futures.md new file mode 100644 index 0000000..71075e3 --- /dev/null +++ b/venue-expert/cards/chinese_futures.md @@ -0,0 +1,114 @@ +# Chinese Futures Markets — Quick Reference Card + +## Exchanges + +| Exchange | Code | Products | Night Session | Fee Model | Matching | CTP ExchangeID | +|----------|------|----------|---------------|-----------|----------|----------------| +| SHFE | 上海期货交易所 | Metals, energy, rubber (~20) | Yes (21:00–02:30 max) | Mixed (per-lot + per-turnover) | Price-time | SHFE | +| DCE | 大连商品交易所 | Ferrous, agricultural, chemicals (~20) | Yes (21:00–23:00) | Mixed (per-lot + per-turnover) | Price-time | DCE | +| CZCE | 郑州商品交易所 | Agricultural, chemicals (~20) | Yes (21:00–23:00) | Mixed (per-lot + per-turnover) | Price-time | CZCE | +| CFFEX | 中国金融期货交易所 | Index futures, treasury bonds (~8) | No | Per-turnover | Price-time | CFFEX | +| INE | 上海国际能源交易中心 | Internationalized products (~5) | Yes (21:00–02:30 max) | Mixed | Price-time | INE | +| GFEX | 广州期货交易所 | Silicon, lithium, platinum, palladium (5) | No | Per-turnover only | Price-time | GFEX | + +## Key Parameters + +| Parameter | Value | +|-----------|-------| +| CTP snapshot frequency | 500ms (2 snapshots/sec); L2 at 250ms for SHFE/DCE/CZCE | +| Standard depth levels | 1 (CTP TCP); 5 (L2 paid/co-lo) | +| Tick conventions | Per-product: 1 CNY/ton (rb), 10 CNY/ton (cu), 0.02 CNY/g (au), 0.5 CNY/ton (i) | +| Lot conventions | Per-product: 10 tons/lot (rb), 5 tons/lot (cu), 1000g/lot (au), 100 tons/lot (i) | +| Price limits | ±4–6% of previous settlement (exchange/product-dependent) | +| Position limit framework | Three-phase: general month → pre-delivery → delivery month; tightens near expiry | +| Mandatory open/close flags | All exchanges require Open/Close specification on every order | +| CloseToday/CloseYesterday | SHFE/INE only; must specify 平今(3) vs 平昨(4). DCE/CZCE/CFFEX/GFEX use FIFO | +| Invalid value sentinel | DBL_MAX (1.7976931348623157e+308), not zero | +| Contract code format | SHFE/DCE/INE/GFEX: lowercase+YYMM; CFFEX: UPPERCASE+YYMM; CZCE: UPPERCASE+YMM (3-digit) | +| Order modification | Not supported; cancel-replace only (loses queue priority) | + +## Session Schedule (Beijing Time) + +| Session | Hours | Exchanges | +|---------|-------|-----------| +| Night call auction | 20:55–21:00 | SHFE, INE, DCE, CZCE | +| Night continuous (tier 1) | 21:00–23:00 | Most night products (rb, i, m, TA, SR, all DCE/CZCE night) | +| Night continuous (tier 2) | 21:00–01:00 | Base metals (cu, al, zn, pb, ni, sn, ss, bc) | +| Night continuous (tier 3) | 21:00–02:30 | Precious metals (au, ag), crude oil (sc) | +| Day call auction | 08:55–09:00 (CFFEX: 09:25–09:30) | All exchanges | +| Morning session 1 | 09:00–10:15 | All | +| Break | 10:15–10:30 | All commodity exchanges | +| Morning session 2 | 10:30–11:30 | All | +| Lunch | 11:30–13:30 | All | +| Afternoon session | 13:30–15:00 (CFFEX: 15:00/15:15) | All | + +## Data Feed + +| Feed | Type | Latency | Content | +|------|------|---------|---------| +| CTP standard (TCP) | Snapshot | ~500ms intervals | 1-level depth, last price, OHLC, volume, OI | +| CTP multicast (co-lo) | Snapshot | 250ms (SHFE/INE) | 5-level depth | +| Exchange direct (DCE 飞创, CZCE 易盛) | Snapshot | 250ms | 5-level depth, exchange-specific API | +| Exchange matching engine | Continuous | ~500μs order-to-ack | Not externally accessible; 500ms snapshot is deliberate downsampling | + +## Fee Models + +| Type | Description | Exchanges | +|------|-------------|-----------| +| Per-lot (元/手) | Fixed fee per contract traded | SHFE (au, al, zn, ru), DCE (m, y, c), CZCE (TA, SR, CF) | +| Per-turnover (万分之X) | Percentage of trade value | SHFE (rb, cu, ag), DCE (i, j, jm), CZCE (SA), CFFEX (all), INE (sc, bc), GFEX (all) | +| Intraday close surcharge (平今) | Elevated close-today fee on select products | CFFEX IF/IH/IC/IM: 万分之2.3 (10× open); SHFE ag: up to 5× | +| 申报费 (order submission fee) | Tiered by order-to-trade ratio; since May 2024 | All exchanges | + +## Spread by Product + +| Product | Exchange | Tick | Median Spread (ticks) | Half-Spread (bps) | +|---------|----------|------|-----------------------|-------------------| +| rb (rebar) | SHFE | 1 CNY/ton | 1 | ~1.4 | +| cu (copper) | SHFE | 10 CNY/ton | 1 | ~0.7 | +| al (aluminum) | SHFE | 5 CNY/ton | 1 | ~1.2 | +| au (gold) | SHFE | 0.02 CNY/g | 1–2 | ~0.2–0.3 | +| i (iron ore) | DCE | 0.5 CNY/ton | 1–2 | ~3–6 | +| m (soybean meal) | DCE | 1 CNY/ton | 1 | ~1.6 | +| p (palm oil) | DCE | 2 CNY/ton | 1 | ~1.2 | +| TA (PTA) | CZCE | 2 CNY/ton | 1 | ~1.8 | +| IF (CSI 300) | CFFEX | 0.2 pts | 1–3 | ~0.3–0.8 | +| sc (crude oil) | INE | 0.1 CNY/bbl | 1–2 | ~0.9–1.8 | + +## Regulatory Timeline + +| Date | Event | Impact | +|------|-------|--------| +| 2013-07-05 | First night session (SHFE: au, ag) | Structural break in intraday vol patterns | +| 2015-09-07 | CFFEX maximum restrictions (10 lots/day, 40% margin, 万分之23 平今) | Index futures market effectively frozen | +| 2016-01-04 | Circuit breaker triggered (5% and 7% CSI300); suspended Jan 8 | 4 days total; magnet effect observed | +| 2018-03-26 | INE crude oil (sc) launches — first internationalized product | Foreign access via overseas intermediary | +| 2019-04-22 | CFFEX 4th relaxation (500 lots/day, 万分之3.45 平今) | Most impactful easing — 10× daily limit increase | +| 2019-06-14 | 看穿式监管 enforced (CTP ≥6.3.15, AppID/AuthCode mandatory) | VM/cloud environments fail; physical machine required | +| 2020-09-08 | CTP v6.5.1: InstrumentID char[31]→char[81] | Binary-breaking struct change; recompilation mandatory | +| 2022-08-01 | Futures and Derivatives Law effective | Registration-based listing → accelerated product launches | +| 2022-09-02 | QFI access launched: 41 products opened to foreign investors | New participant type in order flow | +| 2022-12-22 | GFEX launches (Industrial Silicon SI) | 6th exchange operational | +| 2023-03-20 | CFFEX 平今 fee reduced to 万分之2.3 | Latest fee change for index futures | +| 2024-09-30 | State Council 国办发47号: HFT fee rebates cancelled, mandatory algo reporting | Most consequential regime change for quant firms since 2015 | +| 2025-10-09 | CSRC Programmatic Trading Management Rules effective | ≥5 orders within 1 second ×5 instances = programme trading | +| 2025 Q1 | QFI expansion to ~91+ products; GFEX products included | First GFEX foreign access | + +## Co-Location Map + +| DC | Exchanges | Location | +|----|-----------|----------| +| Shanghai Zhangjiang | SHFE, INE | SHFE data center (CTP multicast co-lo) | +| Dalian | DCE | DCE co-lo (飞创 DFIT L2 feed) | +| Zhengzhou | CZCE | CZCE co-lo (易盛 Esunny L2 feed) | +| Shanghai | CFFEX | CFFEX co-lo | +| Guangzhou | GFEX | GFEX co-lo | + +## Deep Docs +- [[futures/apac/china/futures_china.md|futures_china.md]] +- [[futures/apac/china/shfe.md|shfe.md]] +- [[futures/apac/china/dce.md|dce.md]] +- [[futures/apac/china/czce.md|czce.md]] +- [[futures/apac/china/cffex.md|cffex.md]] +- [[futures/apac/china/ine.md|ine.md]] +- [[futures/apac/china/gfex.md|gfex.md]] diff --git a/venue-expert/cards/cme.md b/venue-expert/cards/cme.md new file mode 100644 index 0000000..87b56ce --- /dev/null +++ b/venue-expert/cards/cme.md @@ -0,0 +1,92 @@ +# CME Group — Quick Reference Card + +## Exchanges + +| Exchange | MIC | Products | Fee Model | Matching | Co-Location | +|----------|-----|----------|-----------|----------|-------------| +| CME | XCME | Equity index (ES, NQ), FX (6E, 6J), SOFR (SR3) | Per-contract tiered | FIFO/Allocation/Pro-Rata | Aurora, IL (CyrusOne) | +| CBOT | XCBT | Treasuries (ZN, ZB, ZT), Grains (ZC, ZS, ZW) | Per-contract tiered | FIFO/Configurable | Aurora, IL (CyrusOne) | +| NYMEX | XNYM | Energy (CL, NG) | Per-contract tiered | FIFO | Aurora, IL (CyrusOne) | +| COMEX | XCEC | Metals (GC, SI) | Per-contract tiered | FIFO | Aurora, IL (CyrusOne) | + +## Key Parameters + +| Parameter | Value | +|-----------|-------| +| Market data protocol | MDP 3.0 (SBE/UDP multicast) | +| Outright book depth | 10 levels (instrument-dependent; some get 5) | +| Implied book depth | **2 levels** (best 2 bid + best 2 ask; NOT 10) | +| Timestamp precision | uint64 nanoseconds since Unix epoch (UTC); microsecond accuracy | +| Margin framework | SPAN 2 (VaR-based, replacing classic 16-scenario SPAN) | +| Performance bond levels | Non-HRP: 100% maintenance; HRP (retail): 110% maintenance | +| Recovery layers | Feed A/B arbitration → UDP snapshot loop → TCP Replay (max 2,000 pkt) → Instrument Recovery → Channel Reset | +| Sequence numbers | Per-channel, reset weekly | + +## Top Products + +| Product | Code | Tick | Multiplier | Algorithm | Settlement Window (CT) | +|---------|------|------|------------|-----------|----------------------| +| E-mini S&P 500 | ES | 0.25 pts ($12.50) | $50 | FIFO (F) | 14:59:30–15:00:00 | +| E-mini Nasdaq | NQ | 0.25 pts ($5.00) | $20 | FIFO (F) | 14:59:30–15:00:00 | +| WTI Crude Oil | CL | $0.01 ($10.00) | $1,000 | FIFO (F) | 13:28:00–13:30:00 | +| Gold | GC | $0.10 ($10.00) | $100 | FIFO (F) | 12:29:00–12:30:00 | +| 10-Year T-Note | ZN | 1/64 ($15.625) | $1,000 | FIFO (F) | 13:59:30–14:00:00 | +| Treasury Bond | ZB | 1/32 ($31.25) | $1,000 | FIFO (F) | 13:59:30–14:00:00 | +| 2-Year T-Note | ZT | 1/128 ($7.8125) | $2,000 | Configurable (K) | 13:59:30–14:00:00 | +| 3-Month SOFR | SR3 | 0.0025 ($6.25) | $2,500 | Allocation (A) | 13:59:00–14:00:00 | + +## Session Schedule (CT) + +| Session | Hours | Products | +|---------|-------|----------| +| Sunday open | 17:00 CT Sunday | All Globex products | +| Globex overnight | 17:00–08:30 CT | Most products | +| RTH (equities/FX) | 08:30–15:15 CT | ES, NQ, 6E, etc. | +| RTH (rates) | 07:00–14:00 CT | ZN, ZB, ZT, SR3 | +| RTH (energy) | 08:00–13:30 CT | CL, NG | +| RTH (metals) | 07:20–12:30 CT | GC, SI | +| Daily maintenance | 16:00–17:00 CT (M–Th); 16:00 Fri close | All | + +## Data Feed + +| Feed | Book Type | Content | +|------|-----------|---------| +| MBP (Market By Price) | Aggregated, configurable depth (typically 10) | Bid/ask levels + implied (2 levels); incremental + snapshot recovery | +| MBOFD (Market By Order Full Depth) | Individual orders, unlimited depth | Every visible order; no implied data | +| MBOLD (Market By Order Limited Depth) | Individual orders, top 10 | Top 10 bid/ask individual orders | +| Snapshot Recovery | UDP loop | Full book snapshots for splice with incremental cache | +| TCP Replay | FIX-ASCII logon → SBE response | Max 2,000 packets/request; 24-hour window; not for primary recovery | + +## Matching Algorithms + +| Algorithm | Code | Products | +|-----------|------|----------| +| FIFO | F | ES, NQ, CL, NG, GC, SI, ZN, ZB outrights | +| Configurable (Split FIFO/Pro-Rata) | K | ZT (split), ZC/ZS/ZW (40% FIFO / 60% Pro-Rata) | +| Allocation (TOP → Pro-Rata → FIFO) | A | SR3, SR1 (inherited from Eurodollar) | +| Pro-Rata (spreads) | C | 6E, 6J spreads | +| Threshold Pro-Rata + LMM | Q | ZN, ZB, ZT options; SR3 options | +| Threshold Pro-Rata (no LMM) | O | ZC, ZS, ZW options | + +## SPAN 2 Migration + +| Asset Class | Status | +|-------------|--------| +| NYMEX Energy | Completed — July 21, 2023 | +| Equity Products | Completed — October 2024 | +| Interest Rate & FX | Pending — originally planned H2 2024, delayed | +| Agriculture & Remaining | Pending — originally planned H2 2025, delayed | + +## Modify Semantics (FIFO) + +| Action | Queue Position | +|--------|---------------| +| Decrease quantity | Retained | +| Increase quantity | Lost (re-queued to back) | +| Change price | Lost | +| Change account | Lost | +| GTC across sessions | Retained (absent priority-losing mods) | +| Iceberg display refresh | Lost | + +## Deep Docs +- [[futures/amer/cme.md|cme.md]] diff --git a/venue-expert/cards/global_venues.md b/venue-expert/cards/global_venues.md new file mode 100644 index 0000000..fdf9e87 --- /dev/null +++ b/venue-expert/cards/global_venues.md @@ -0,0 +1,83 @@ +# Global Venues — Quick Reference Card + +## Venues Overview + +| Venue | Region | Asset | MIC | Matching | Co-Location | Data Feed | +|-------|--------|-------|-----|----------|-------------|-----------| +| ICE Futures Europe | EMEA | Energy, softs | IFEU | Price-time (FIFO) | Basildon, Essex (NOT LD4) | iMpact (binary multicast) | +| Eurex | EMEA | Fixed income, equity index | XEUR | FIFO (FI/equity); Pro-Rata (rates) | Equinix FR2, Frankfurt | EOBI (L3, full depth, ns) | +| SGX | APAC | Iron ore, equity index | XSES | Price-time | 25 Serangoon North Ave 5, Singapore | ITCH (MoldUDP64, ns) | +| HKEX | APAC | Equities, derivatives | XHKG | Price-time | Hong Kong | OMD-C (equities); OMD-D (derivatives) | +| GFEX | APAC | Silicon, lithium, PGMs | — | Price-time | Guangzhou | CTP (~500ms snapshots, 5-level) | + +## ICE Brent + +| Field | Value | +|-------|-------| +| Symbol | B (Brent Crude) | +| Contract size | 1,000 barrels | +| Tick size | $0.01/barrel ($10/contract/tick) | +| Trading hours | 01:00–23:00 London time (~22 hrs) | +| Settlement (daily) | VWAP 19:28–19:30 London time | +| Settlement (final) | Cash against ICE Brent Index (BFOETM; 5 intraday sampling points) | +| Co-location | Basildon, Essex — European Liquidity Centre | +| Matching latency | <1 ms average; ~6 μs wire-to-wire (FPGA) | +| Feed protocol | iMpact: FOD (full order depth) + Price Level (top 5); ms timestamps + MiFID μs | +| Modify: qty decrease | Retains queue position | +| Modify: qty increase or price change | Loses queue position | + +## Eurex + +| Field | Value | +|-------|-------| +| Key FI products | FGBL (Bund), FGBM (Bobl), FGBS (Schatz), FGBX (Buxl), FOAT (OAT), FBTP (BTP) | +| Key equity products | FESX (Euro STOXX 50), FDAX (DAX), FDXM (Mini-DAX) | +| Key rates products | FEU3 (Euribor), FST3 (Euro STR) | +| Matching (FI/equity) | Time (FIFO) | +| Matching (rates) | Pro-Rata (FEU3, FST3) | +| Feed protocol | EOBI: full L3 order-by-order, no depth limit, ns timestamps | +| EOBI availability | Co-location only (10 Gbit/s); select benchmarks + all Xetra cash | +| Co-location | Equinix FR2, Frankfurt | +| Session hours | 01:15–22:00 CET (continuous); pre-trading 01:00 | +| Volatility interruption | Dynamic trigger → auction with random end; non-persistent orders deleted | +| Self-trade prevention | Since T7 R12.1: Cancel Resting / Cancel Incoming / Cancel Both | +| Implied pricing | Supported (calendar spread ↔ outright); not labeled in EOBI | + +## SGX + +| Field | Value | +|-------|-------| +| Key product | FEF (TSI Iron Ore CFR China 62% Fe) | +| Contract size | 100 metric tonnes | +| Tick size | $0.01/dmt ($1.00/contract) | +| Settlement | Cash-settled against Platts IODEX 62% Fe CFR China | +| T Session (day) | 07:25–19:55 SGT | +| T+1 Session (night) | 20:15–05:15 SGT (~21.5 hrs total) | +| Platform | TITAN (Nasdaq Genium INET) | +| Feed protocol | ITCH (MoldUDP64); full order-by-order, ns timestamps | +| Order entry | OUCH protocol | +| Co-lo latency | <100 μs exchange-stated; sub-15 μs at Tier-1 | +| SGX vs DCE volume | SGX ~100–120K/day; DCE ~2M/day (~18× greater) | +| SGX vs DCE price discovery | DCE leads during Chinese hours; SGX leads non-Chinese hours | + +## HKEX + +| Field | Value | +|-------|-------| +| Unique feature | **Broker queue visibility** — real-time broker ID per order at each price level | +| Broker queue depth | Up to 40 brokers per side (bid/ask), ~5–10 spread levels | +| Coverage | All SEHK-listed securities (equities, ETFs, warrants, CBBCs, debt) | +| Derivatives broker queue | **Not available** (OMD-D has no broker identification) | +| Feed products | SS (Standard — broker queue included), SP (Premium + CBQ add-on), SF (FullTick) | +| VCM (Volatility Control) | Cooling-off mechanism for extreme moves | +| CAS (Closing Auction) | Closing auction session for price discovery | +| Stock Connect | Northbound/Southbound cross-border trading with mainland China | +| Non-display cost | HK$20,000/firm/month for automated trading use | +| OMD-C launch | September 30, 2013 | +| Comparable venues | Indonesia (IDX), Thailand (SET) also provide broker queue; NYSE/Nasdaq/CME do not | + +## Deep Docs +- [[futures/emea/ice.md|ice.md]] +- [[futures/emea/eurex.md|eurex.md]] +- [[futures/apac/sgx.md|sgx.md]] +- [[equity/apac/hkex.md|hkex.md]] diff --git a/venue-expert/cards/us_equity.md b/venue-expert/cards/us_equity.md new file mode 100644 index 0000000..2b2ab23 --- /dev/null +++ b/venue-expert/cards/us_equity.md @@ -0,0 +1,112 @@ +# US Equity Markets — Quick Reference Card + +## Venues + +| Venue | MIC | Tape | Fee Model | Key Characteristic | +|-------|-----|------|-----------|-------------------| +| NYSE | XNYS | A | Maker-taker | Physical floor; **parity allocation**; DMMs; D-Orders | +| NYSE Arca | ARCX | B/C | Maker-taker | Fully electronic; dominant ETF listing; LMMs; 4AM–8PM | +| NYSE American | XASE | A | Maker-taker | Smaller-cap equities; eDMMs; Early Open Auction 7AM | +| NYSE National | XCIS | A/B/C | **Taker-maker** | Inverted fee model; no auctions | +| NYSE Chicago/Texas | XCHI | A/B/C | Maker-taker | Low market share; no auctions | +| Nasdaq | XNAS | C | Maker-taker | ITCH 5.0; TotalView; M-ELO; Carteret NJ | +| Nasdaq BX | XBOS | B/C | **Taker-maker** | Inverted; targets price-sensitive flow | +| Nasdaq PSX | XPHL | A | Maker-taker | Pro-rata allocation for some securities | +| Cboe BZX | BATS | B/C | Maker-taker | Largest Cboe venue; Secaucus NJ | +| Cboe BYX | BATY | B/C | **Taker-maker** | Inverted Cboe venue | +| Cboe EDGX | EDGX | B/C | Maker-taker | MidPoint extended life orders | +| Cboe EDGA | EDGA | B/C | **Taker-maker** | Inverted; low-cost removing | +| IEX | IEXG | B/C | Maker-taker | 350μs speed bump; Crumbling Quote Indicator | +| MEMX | MEMX | B/C | Maker-taker | Member-owned; lowest latency claims | +| LTSE | LTSE | B/C | Maker-taker | Long-term focused listings | +| MIAX Pearl | EPRL | B/C | Maker-taker | Equity exchange (from options) | + +## Key Parameters + +| Parameter | Value | +|-----------|-------| +| Minimum tick (≥$1.00) | $0.01 (penny) | +| Minimum tick (<$1.00) | $0.0001 | +| Access fee cap | $0.003/share (Rule 610) | +| Sub-penny quoting | Prohibited ≥$1.00 (Rule 612) | +| LULD bands (Tier 1) | ±5% reference price (±10% open/close) | +| LULD bands (Tier 2) | ±10% reference price (±20% open/close) | +| MWCB Level 1 | −7% S&P 500 → 15-min halt (before 3:25 PM) | +| MWCB Level 2 | −13% S&P 500 → 15-min halt (before 3:25 PM) | +| MWCB Level 3 | −20% S&P 500 → market closed for day | +| Round lot (≤$250) | 100 shares | +| Round lot ($250–$1000) | 40 shares | +| Round lot ($1000–$10000) | 10 shares | +| Round lot (>$10000) | 1 share | + +## Session Schedule (Eastern Time) + +| Session | Hours | Venues | +|---------|-------|--------| +| Pre-market | 04:00–09:30 | Arca, Nasdaq, select ECNs | +| Regular | 09:30–16:00 | All exchanges | +| Post-market | 16:00–20:00 | Arca, Nasdaq, select ECNs | +| Opening auction | ~09:28–09:30 | NYSE (DMM), Nasdaq (cross) | +| Closing auction | ~15:50–16:00 | NYSE (MOC/LOC 3:50 cutoff), Nasdaq | + +## Data Feeds + +| Feed | Type | Latency | Content | Cost | +|------|------|---------|---------|------| +| CTA SIP (Tape A/B) | Consolidated | <17μs processing | NBBO + trades | Regulated fees | +| UTP SIP (Tape C) | Consolidated | ~13μs processing | NBBO + trades | Regulated fees | +| Nasdaq ITCH 5.0 | Direct/L3 | Sub-μs co-lo | Order-by-order, full depth, ns timestamps | ~$20K+/mo | +| NYSE XDP | Direct/L3 | Sub-μs co-lo | Order-by-order, full depth, ns timestamps, MPID attribution | ~$20K+/mo | +| Cboe PITCH | Direct/L3 | Sub-μs co-lo | Order-by-order, full depth | ~$15K+/mo | + +## Fee Models + +| Model | Add (make) | Remove (take) | Venues | +|-------|-----------|--------------|-------| +| Maker-taker | Rebate ~$0.002–0.0032 | Fee ~$0.003 | NYSE, Nasdaq, Arca, BZX, EDGX, IEX | +| Taker-maker (inverted) | Fee ~$0.0003–0.0014 | Rebate ~$0.001–0.002 | NYSE National, Nasdaq BX, BYX, EDGA | + +## Effective Spread by Cap Tier + +| Tier | Effective Spread (bps) | +|------|----------------------| +| Mega-cap (top 50) | 1–3 | +| Large-cap (S&P 500) | 2–7 | +| Mid-cap (S&P 400) | 5–15 | +| Small-cap (R2000) | 10–30 | +| Micro-cap | 30–200+ | + +## Regulatory Timeline + +| Date | Event | Impact | +|------|-------|--------| +| 2005-06 | Reg NMS adopted | Penny tick; $0.003 fee cap; sub-penny prohibition | +| 2007-02 | Reg NMS Phase 2 live | Full order protection (Rule 611) | +| 2010-02 | Alternative Uptick Rule (201) | 10% decline triggers short-sale restriction | +| 2010-05 | Flash Crash | Prompted LULD development | +| 2013-04 | LULD Phase I | Price bands replace SSCBs for S&P 500/R1000 | +| 2013-08 | LULD Phase II | All NMS securities; SSCBs retired | +| 2016-10 | Tick Size Pilot | $0.05 tick for ~1,200 small-caps | +| 2018-03 | M-ELO launches | 500ms midpoint holding period | +| 2018-09 | Tick Size Pilot ends | All stocks return to penny tick | +| 2020-03 | COVID MWCB triggers | 4× Level 1 triggers in 10 days | +| 2020-12 | MDI Rule adopted | Round lot redefinition; odd-lot transparency | +| 2023-09 | Dynamic M-ELO | AI-powered holding period (140+ factors) | +| 2024-09 | Tick/Fee reform adopted | Half-penny tick ~1,700 tickers; 10-mil fee cap | +| 2025-11 | New round lots live | Tiered by price: 100/40/10/1 | +| 2026-04 | Odd-lot quotes on SIPs | New BOLO message types | +| 2026-11 | Tick/fee compliance (delayed) | $0.005 tick + $0.001 fee cap | + +## Co-Location Map + +| DC | Venues | Location | +|----|--------|----------| +| Mahwah, NJ | NYSE, NYSE Arca, NYSE American | ICE campus | +| Carteret, NJ | Nasdaq, Nasdaq BX, Nasdaq PSX | Equinix NY5 | +| Secaucus, NJ | Cboe BZX/BYX/EDGX/EDGA | Equinix NY4/5 | +| Weehawken, NJ | IEX | IEX POP | + +## Deep Docs +- [[equity/amer/equity_amer.md|equity_amer.md]] +- [[equity/amer/nasdaq/nasdaq.md|nasdaq.md]] +- [[equity/amer/nyse/nyse.md|nyse.md]] diff --git a/venue-expert/equity/amer/equity_amer.md b/venue-expert/equity/amer/equity_amer.md index 410b8ef..d373896 100644 --- a/venue-expert/equity/amer/equity_amer.md +++ b/venue-expert/equity/amer/equity_amer.md @@ -65,6 +65,67 @@ US equity CLOBs use **price-time priority**: **Gotcha:** Reserve refresh typically loses time priority. Check venue-specific rules. +## NYSE Mechanics + +See [[equity/amer/nyse/nyse.md|nyse.md]] for NYSE-specific mechanics (parity allocation, DMM, D-Orders, XDP feed). + +Key difference from other US venues: NYSE uses **parity allocation** (not pure price-time) — invalidates standard FIFO queue models for Tape A securities. + +## Hidden/Reserve Order Dynamics + + +### Hidden Depth Prevalence + +- 22-25% hidden depth at L1 (Tuttle 2006, Nasdaq 100 study) +- Reserve order minimum display size: 100 shares (standard across venues) +- Hidden orders are non-protected quotations -- excluded from NBBO +- Execution priority: all displayed orders at same price execute before any hidden at that price + +### Reserve Refresh Mechanics + +| Component | Timestamp Behavior | Priority | +|-----------|--------------------|----------| +| Displayed portion | New timestamp on refresh | Goes to back of displayed queue | +| Hidden portion | Retains original timestamp | Lower priority than ALL displayed at same price | + +**Implications for queue models:** +- Reserve refreshes create phantom queue position loss +- Models that assume stable queue position underestimate adverse selection on reserves +- Refresh frequency is unobservable from SIP data; requires direct feed + +### Midpoint Extended Life Orders (M-ELO) + +| Parameter | Value | +|-----------|-------| +| Initial holding period | 500ms (Mar 2018 launch) | +| Reduced holding period | 10ms (May 2020) | +| Dynamic M-ELO | Sep 2023, AI-powered midpoint estimation | +| Eligible securities | All NMS stocks on Nasdaq | + +M-ELO prevents latency arbitrage by requiring both sides to rest before matching. Dynamic M-ELO uses machine learning to determine optimal execution timing at midpoint. + +### IEX Speed Bump + +| Parameter | Value | +|-----------|-------| +| Delay mechanism | 350us coil (38 miles of fiber) | +| Direction | All inbound and outbound messages | +| CQI trigger frequency | ~0.02% of time | +| Marketable orders caught by CQI | ~32% | + +CQI (Crumbling Quote Indicator) detects when NBBO is likely about to change. When active, IEX disables price-sliding for incoming orders, protecting resting liquidity from adverse selection. + +### Venue-Specific Hidden Order Variants + +| Venue | Hidden Type | Special Behavior | +|-------|-------------|------------------| +| Nasdaq | Non-Displayed (NOND) | Standard hidden, retains timestamp | +| Nasdaq | Post-Only Hidden | Adds hidden; if would lock, posts at less aggressive | +| NYSE | Non-Displayed Limit | Below displayed in parity allocation | +| NYSE Arca | Passive Liquidity (PLO) | Pegs to far side of NBBO | +| IEX | Midpoint Peg | D-Peg discretionary, CQI-protected | +| MEMX | Hidden | Standard hidden, price-time within hidden tier | + ## Auctions ### Purpose @@ -189,6 +250,42 @@ Exchange-proprietary feeds: | Direct (co-located) | 10-50us | | Direct (remote) | 100us+ network RTT | +## SIP vs Direct Feed Reconciliation + + +### CTA Latency Benchmarks + +| Exchange to SIP | Quote Median (us) | Trade Median (us) | +|-----------------|--------------------|--------------------| +| NYSE to CTA | 105 | 154 | +| Nasdaq to UTP | 17 | 22 | +| Cboe to CTA | 401-409 | 456-472 | +| Nasdaq to CTA | 540 | 586 | + +### SIP-Direct Dislocation + +- 97% of SIP-priced trades match direct-feed NBBO (Bartlett & McCrary 2019) +- Mean dislocation duration: 1,002 us (median 489 us) +- Mean dislocation size: $0.0109 +- Dislocations cluster during high-volatility periods and around NBBO transitions +- Economic significance: material only for sub-millisecond strategies + +### TAQ-LOB Matching + +Composite key matching methodology for TAQ-to-LOB reconciliation: + +| Field | Resolution | Source | +|-------|------------|--------| +| Symbol | Exact | Both feeds | +| Price | Exact | Both feeds | +| Size | Exact | Both feeds | +| Participant timestamp | Nanosecond | TAQ (post-2015) | + +- Holden, Pierson & Wu (2024): matched 654M TAQ-to-LOB trades +- Lee-Ready accuracy improved from 86.75% to 92.05% with matched data +- Pre-2015 TAQ: millisecond timestamps only, matching degrades significantly +- Cross-venue matching requires normalization of exchange-specific timestamp epochs + ## Fee Structure ### Maker-Taker Model @@ -281,6 +378,20 @@ Major wholesalers (Citadel Securities, Virtu): **PFOF:** Brokers may receive payment for order flow. Disclosed via Rule 606. +## Market Maker Programs + + +| Program | Quote Width | NBBO Uptime | Rebate | +|---------|-------------|-------------|--------| +| Nasdaq MM | 8-30% designated | Continuous | QMM +$0.0004, top ~$0.0032 | +| Nasdaq QMM | >=1,000 symbols >=25% | 25% in 1,000+ | Remove $0.00295 | +| NYSE DMM | LULD-based % | >=15% (non-ETP)/>=25% (ETP) | Up to $0.0035 | +| NYSE SLP | At NBB/NBO | >=10% at NBBO | ~$0.0032 | +| NYSE Arca LMM | <=2% from NBBO | 90% continuous | Enhanced + $10-40K/yr | +| IEX IEMM | Designated % | Inside >=20%, Depth >=75% | Fee discounts | + +**Flash Crash evidence:** Buy-side depth fell to ~25% midday levels, sell-side ~15%. DMMs who stayed helped curtail turmoil (MacKenzie 2015). + ## Disclosures ### Rule 605 @@ -326,7 +437,101 @@ Reconcile across data sources: - BBO prices should align (within latency tolerance) - Trade counts should reconcile (accounting for aggregation) -See `references/specs/sip_specs.md` for detailed alignment procedures. +See `references/specs/sip_specs.md` [[equity/amer/references/specs/sip_specs.md|sip_specs.md]] for detailed alignment procedures. + +## Data Validation Checklist + + +45-check architecture organized in 12 sections (A-L): + +| Section | Checks | Critical | High | Medium | Key Checks | +|---------|--------|----------|------|--------|------------| +| A: Sequence Integrity | 5 | 3 | 2 | 0 | Session ID, seq monotonicity, gap retransmission | +| B: Timestamp Monotonicity | 4 | 1 | 2 | 1 | Non-decreasing, Replace consistency, range | +| C: Book Consistency | 4 | 3 | 1 | 0 | No negatives, no crossed book, no phantoms | +| D: Cross-Type Consistency | 4 | 2 | 2 | 0 | E/C to A/F chain, no ref reuse | +| E: Auction Validation | 4 | 0 | 3 | 1 | NOII intervals, cross price in collar | +| F: Corporate Action | 4 | 2 | 1 | 1 | Stock Directory completeness, locate mapping | +| G: Halt State Machine | 4 | 0 | 2 | 2 | Valid transitions T->H->Q->T, halt codes | +| H: Trade Break | 3 | 1 | 1 | 1 | Order NOT restored after break | +| I: Volume Reconciliation | 2 | 0 | 1 | 1 | ITCH vs SIP within 0.1% | +| J: Stock Locate | 3 | 2 | 0 | 1 | Daily locate-to-symbol map | +| K: System Events | 2 | 1 | 1 | 0 | O->S->Q->M->E->C sequence | +| L: Best Practices | 6 | 0 | 4 | 2 | Withdrawn quotes, locked NBBO, printable flag | + +**Totals:** 45 checks -- 13 Critical, 19 High, 13 Medium. + +**Processing order:** Transport (A) -> Timestamp (B) -> Reference Data (J,K) -> State Machine (G) -> Order Lifecycle (C,D) -> Auction (E) -> Trade Breaks (H) -> Volume (I) -> Corporate Actions (F) -> Best Practices (L). + +Full 45-check detail in `nasdaq/references/specs/itch_protocol.md` [[equity/amer/nasdaq/references/specs/itch_protocol.md|itch_protocol.md]]. + +## Empirical Parameters + + +### Spread Parameters + +| Tier | Effective Spread (bps) | +|------|------------------------| +| Mega-cap (top 50) | 1-3 (AAPL/MSFT ~0.7) | +| Large-cap (S&P 500) | 2-7 (Hagstromer 2021: mean 3.2) | +| Mid-cap (S&P 400) | 5-15 | +| Small-cap (R2000) | 10-30 | +| Micro-cap | 30-200+ | + +**Intraday pattern:** J-shaped. Open 50-200% above average, midday trough, close moderate widening. + +### Impact Parameters + +**Almgren-Chriss (2005) calibration:** + +| Parameter | Symbol | Value | Meaning | +|-----------|--------|-------|---------| +| Permanent impact | gamma | 0.314 | Price shift per unit participation | +| Temporary impact | eta | 0.142 | Execution cost per unit speed | +| Impact exponent | beta | 0.6 | Concavity of impact function | + +**Universal square-root law:** +``` +G = sigma * sqrt(|Q|/V) * theta +``` +Where sigma = daily volatility, Q = order size, V = daily volume, theta ~ 1. + +**Impact decay:** + +| Horizon | Retained Impact | +|---------|-----------------| +| Same-day (EOD) | ~2/3 of peak | +| ~5 days | ~60% of day-1 | +| ~50 days | ~50% of day-1 | + +Permanent component is the fraction that does not revert. Temporary component decays exponentially with half-life of minutes to hours depending on participation rate. + +### Fill Rate (Back-of-Queue, Large-Tick) + +| Horizon | Fill Rate | +|---------|-----------| +| 1 second | ~1-5% | +| 10 seconds | ~5-15% | +| 1 minute | ~10-30% | +| End-of-day | ~20-50% | + +### Order Book Imbalance (OBI) Predictive Power + +- **L1 OFI:** R-squared ~65% contemporaneous 10s (Cont, Kukanov & Stoikov 2014) +- **Multi-level (10 levels):** R-squared ~80% +- **Signal half-life:** 5-30 seconds + +### Large Print Refill + +4-phase pattern: +1. Response-latency (<1s) +2. HFT reaction (1-5s) +3. Stimulated refill (5-10s) +4. Normalization (10+s) + +- 50% depth restored in 2-5 seconds +- 100% in 5-10 seconds +- Limit order intensity takes ~30 min to normalize ## Gotchas Checklist @@ -341,6 +546,99 @@ See `references/specs/sip_specs.md` for detailed alignment procedures. 9. **Erroneous trades** - Validate against LULD bands; filter outliers 10. **NBBO staleness** - SIP NBBO stale ~10,000x/day in active stocks +## Regime Change Database + + +| Date | Event | Impact | +|------|-------|--------| +| 2005-06-29 | Reg NMS adopted | Penny tick, $0.003 cap, sub-penny prohibited | +| 2007-02-05 | Reg NMS Phase 2 all NMS | Full order protection | +| 2007-07-03 | Uptick rule eliminated | No short-sale test until 2010 | +| 2010-02-24 | Alt Uptick Rule (201) | 10% decline triggers restriction | +| 2010-05-06 | Flash Crash | Prompted LULD | +| 2013-04-08 | LULD Phase I + MWCB reform | Price bands replace SSCBs; S&P 500-based 7/13/20% | +| 2013-08-05 | LULD Phase II all NMS | SSCBs fully retired | +| 2016-10-03 | Tick Size Pilot | $0.05 tick ~1,200 stocks | +| 2018-03-12 | Nasdaq M-ELO | 500ms holding | +| 2018-09-28 | Tick Pilot ends | All return to penny | +| 2019-04-11 | LULD permanent | No longer pilot | +| 2020-03-09-18 | 4x MWCB Level 1 (COVID) | First triggers under new rules | +| 2020-05-11 | M-ELO reduced to 10ms | Broadened M-ELO | +| 2020-12-09 | MDI Rule adopted | Round lot redef, competing consolidators | +| 2024-09-18 | Tick/access fee reform | Half-penny tick ~1,700 stocks, $0.001 cap | +| 2025-10-31 | Compliance delayed to Nov 2026 | Penny tick persists through Oct 2026 | +| 2025-11-03 | New round lot definitions live | Tiered: 100/40/10/1 by price | + +### Backtesting Regime Boundaries + +| Period | Key Constraint | +|--------|----------------| +| Pre-2005 | Decimal conversion (2001), pre-Reg NMS fee structure | +| 2005-2007 | Reg NMS adopted but not fully phased in | +| Pre-2007 | Requires uptick rule modeling for short sales | +| 2007-2010 | No short-sale price test; unrestricted shorting | +| 2010-2013 | Alt uptick rule active; pre-LULD (SSCBs instead) | +| 2013-2016 | LULD regime; pre-Tick Pilot | +| Oct 2016-Sep 2018 | Tick Pilot: ~1,200 stocks at $0.05 tick | +| 2019-2024 | LULD permanent; penny tick universal | +| Sep 2024-Oct 2026 | Half-penny tick ~1,700 stocks; $0.001 access fee cap | +| Nov 2026+ | New round lot definitions; competing consolidators | + +LULD Amendment 10 (Jul 2016): 80% fewer halts via wider bands and straddle-state elimination. + +## Outage & Corruption Registry + + +| Date | Venue | Duration | Severity | Handling | +|------|-------|----------|----------|----------| +| 2010-05-06 | All US + CME | ~36 min | CRITICAL | Exclude busted trades; flag 2:32-3:07 PM | +| 2013-08-22 | Nasdaq SIP | ~3 hrs | CRITICAL | Exclude 12:14-3:25 PM all Tape C | +| 2014-10 | CTA SIP | ~27 min | HIGH | Flag SIP data 1:07-1:41 PM | +| 2015-07-08 | NYSE | ~3.5 hrs | HIGH | Exclude NYSE venue; flag NBBO quality | +| 2020-03-09-18 | All US + CME | 15 min each | HIGH | Flag halt windows; extensive LULD pauses | +| 2024-06-03 | CTA SIP (NYSE) | ~2 hrs | HIGH | Exclude erroneous prints; use bust notices | + +### Outage Handling Protocol + +1. **CRITICAL events:** Exclude entire window from all analytics; do not interpolate +2. **HIGH events:** Flag window; venue-specific exclusion; validate NBBO quality in surrounding periods +3. Check exchange bust/correction notices for affected prints +4. SIP outages affect all Tape participants -- cascade to NBBO quality downstream +5. For multi-day studies spanning outages: use dummy variable or exclude entire day +6. Flash Crash busted-trade threshold: 60%+ from pre-2:40 PM reference price + +## Vendor Data Quirks + + +### Dataset-Specific Issues + +| Vendor/Dataset | Critical Quirk | Impact | +|----------------|----------------|--------| +| TAQ Monthly (MTAQ) | Second-level timestamps; withdrawn quotes unflagged | 43% effective spread overestimation vs DTAQ (Holden & Jacobsen 2014) | +| TAQ Daily (DTAQ) | Millisecond to microsecond mid-2015 | Timestamp regime break in historical analysis | +| LOBSTER | Nasdaq-only; day-unique order IDs; unadjusted prices | No multi-venue book; no corp action adjustment | +| LOBSTER | Hidden Type P = executed portion only | Understates hidden liquidity | +| Bloomberg | Bar timestamp = bar OPEN time | Off-by-one-period if misinterpreted as close | +| Bloomberg | No retroactive corp action adjustments post ex-date open | Stale adjustments for undetermined dividends | +| WRDS | Microsecond upgrade mid-2015 | Pre-2015: millisecond; post-2015: microsecond participant timestamps | + +### TAQ Version Comparison + +| Feature | MTAQ | DTAQ | +|---------|------|------| +| Timestamp resolution | 1 second | Millisecond (pre-2015) / Microsecond (post-2015) | +| Withdrawn quote flags | Missing | Present | +| Effective spread accuracy | ~43% overestimated | Baseline | +| Availability | 1993+ | 2003+ | +| Storage | Compressed monthly | Daily files | + +### Survivorship Bias Corrections + +- **Backbone:** CRSP PERMNO as primary identifier +- **Shumway correction:** Impute -30% NYSE/AMEX, -55% Nasdaq for missing performance-related delistings +- **Missing data:** 13% of delistings (2,742 of 20,680) still missing returns as of ~2017 +- **Implication:** Uncorrected delisting bias overstates returns by 0.5-1.0% annually for small-cap portfolios + ## References See `references/` directory for detailed documentation: diff --git a/venue-expert/equity/amer/nasdaq/nasdaq.md b/venue-expert/equity/amer/nasdaq/nasdaq.md index 97fe7a3..f2a699f 100644 --- a/venue-expert/equity/amer/nasdaq/nasdaq.md +++ b/venue-expert/equity/amer/nasdaq/nasdaq.md @@ -24,6 +24,21 @@ Nasdaq is both: Nasdaq-listed securities trade on all NMS exchanges. Consolidated data via UTP SIP (Tape C). +## Timestamp Provenance + +ITCH timestamps: 6-byte unsigned integer, nanoseconds since midnight ET. + +| Property | Detail | +|----------|--------| +| Clock source | Matching engine clock (GPS-PTP at Carteret DC) | +| Sync protocol | GPS + PTP (IEEE 1588); High Precision Time (Dec 2014 via Perseus) | +| Encoding | 6-byte (48-bit) big-endian, ns since midnight | +| Max representable | ~78.2 hours (2^48 ns) — covers 04:00-20:00 ET | +| Monotonicity | NOT guaranteed — ties common for batch events (sweeps, crosses) | +| Tie-breaking | 2-byte Tracking Number field (semantics not publicly documented) | +| US regulatory mandate | None for nanosecond accuracy (unlike MiFID II RTS 25) | +| Accuracy guarantee | Not stated in spec; typical GPS-PTP <30 ns to GPS | + ## Order Book Mechanics ### Price-Time Priority @@ -98,6 +113,23 @@ Prevents accidental self-trades between a firm's own orders. **Gotcha:** STP cancellations can affect queue position and fill expectations. +### Cancellation Rate Empirics + +~96.8% of US equity orders cancelled before trading (SEC MIDAS 2013). 90% cancelled within 1 second. + +| Dimension | Value | Source | +|-----------|-------|--------| +| Trade-to-order (corporate stocks) | 2.5-4.2% | SEC MIDAS 2013 | +| Trade-to-order (ETPs) | 0.17-0.24% (~99.8% cancelled) | SEC MIDAS 2013 | +| Cancel-to-trade ratio at/inside spread | ~13 | SEC Data Highlight 2014-02 | +| Cancel-to-trade ratio >50bp from spread | ~117 | SEC Data Highlight 2014-02 | +| Median cancelled order lifetime (2013) | 847 ms | Nasdaq/MIDAS | +| Median cancelled order lifetime (2022) | 99.7 ms (88% decline) | Nasdaq/MIDAS | +| HFT share of cancellations | 54-60% | Hasbrouck & Saar 2013 | +| Orders revised 25+ times | 4% of Nasdaq orders; max single: 5,217 | Nikolsko-Rzhevska 2020 | + +**STP visibility:** STP cancellations NOT distinguishable from genuine cancellations in public ITCH feed. Cancel reason code "Q" (Self Match Prevention) only in OUCH 5.0 and FIX drop copy. Nasdaq Nordic ITCH includes explicit STP Cancel Quantity field — US feed lacks this. + ### Displayed vs Non-Displayed Priority ``` @@ -108,6 +140,24 @@ Priority Order: Reserve order displayed portion has full priority. Hidden portion has lower priority than all displayed at same price. +### Hidden/Reserve Dynamics + +| Metric | Value | Source | +|--------|-------|--------| +| Hidden depth at L1 (Nasdaq 100) | ~22-25% of dollar depth | Tuttle 2006 | +| Hidden volume share | ~15% of volume, ~20% of trades | Hautsch & Huang 2012 | +| Hidden usage by cap | More prevalent in illiquid/smaller-cap | Tuttle, Bessembinder | + +**Reserve mechanics:** Minimum display 100 shares. Refresh triggers when displayed falls below 100, receiving new timestamp (back of displayed queue). Hidden portion retains original entry timestamp but has lower priority than all displayed at same price. + +**Detection from ITCH:** +- Execution at empty visible price levels reveals hidden depth +- Excess execution volume beyond displayed quantity +- Same Order ID across reserve refreshes reveals iceberg pattern +- Small IOC pings detect hidden depth post-hoc + +**M-ELO:** Not distinctly identifiable in public ITCH — appears as non-displayed midpoint execution. FIX ExecInst "L" identifies M-ELO on entry side. Dynamic M-ELO (Sep 2023): ML adjusts holding period every 30s, 20.3% higher fill rates, 11.4% lower markouts vs static. + ### Modify/Replace Behavior **Modifying an order:** @@ -134,7 +184,7 @@ Reserve order displayed portion has full priority. Hidden portion has lower prio **NOII (Net Order Imbalance Indicator):** -Disseminated every 5 seconds from 9:25-9:30 AM: +Disseminated every 5 seconds (9:25-9:28), then every 1 second (9:28-9:30): - Indicative clearing price - Paired shares (matched volume) - Imbalance size and direction @@ -281,6 +331,29 @@ Lower-cost alternative: **Gotcha:** Must aggregate direct feeds from all venues for complete picture. +## ITCH Protocol Version History + +| Version | Date | Key Changes | Breaking | +|---------|------|-------------|----------| +| ITCH 1.00 | Jan 2000 | Session mgmt moved up; Broken Trade; timestamps hundredths of sec | Yes | +| ITCH 2.00 | Nov 2001 | Price → 6+4 implied digits; timestamps → ms; shares 9→6 digits | Yes | +| ITCH 2.0a | Feb 2006 | Added attributed Add Order (F); added Halt/Resume | Additive | +| ITCH 3.00 | Jul 2006 | Separate Seconds/Milliseconds timestamps; Stock Directory, NOII, Type C/D/Q | Yes | +| ITCH 3.10 | Oct 2008 | Expanded Order Ref/Match ID to 12 bytes; added Replace | Additive | +| ITCH 4.00 | Oct 2008 | All numerics → binary; timestamps → nanoseconds (split Seconds+ns); SoupBinTCP | Yes | +| ITCH 4.10 | Jan 2010 | Symbol 6→8 chars; NYSE/MKT/Arca Market Category; Reg SHO (Jul 2010); RPI (Nov 2012) | Yes | +| ITCH 5.00 | Jul 2013 | Unified 6-byte ns timestamp; Stock Locate (2B) + Tracking Number (2B) all msgs; MWCB/IPO/LULD | Yes | + +**Historical data:** ITCH 5.0 files in Nasdaq Data Store from **April 8, 2014**. Version encoded in directory path (`ITCHFiles_v5`) and filename (`SMMDDYY-v#.txt.gz`), not file header. BinaryFILE format is version-agnostic. + +**Transport compatibility:** + +| Protocol | Used With | Purpose | +|----------|-----------|---------| +| MoldUDP64 v1.00 | ITCH 4.0-5.0 | Real-time multicast; REWINDER recovery | +| SoupBinTCP v3/4 | ITCH 4.0-5.0 | TCP point-to-point; GLIMPSE snapshot | +| BinaryFILE v1.00 | All versions | Offline file storage | + ## Fee Structure ### Nasdaq Fee Schedule @@ -368,7 +441,7 @@ Key rule sections: - NOII/EOII terminology formalization - Hybrid Closing Cross option -See `references/regulatory/nasdaq_rules.md` for details. +See `references/regulatory/nasdaq_rules.md` [[equity/amer/nasdaq/references/regulatory/nasdaq_rules.md|nasdaq_rules.md]] for details. ## Gotchas Checklist diff --git a/venue-expert/equity/amer/nasdaq/references/specs/itch_protocol.md b/venue-expert/equity/amer/nasdaq/references/specs/itch_protocol.md index 4d603de..93d57c9 100644 --- a/venue-expert/equity/amer/nasdaq/references/specs/itch_protocol.md +++ b/venue-expert/equity/amer/nasdaq/references/specs/itch_protocol.md @@ -12,6 +12,25 @@ ITCH is a high-performance, low-latency protocol for market data dissemination. **Official specification:** https://www.nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/NQTVITCHSpecification.pdf +## Version History + +| Version | Spec Date | Key Changes | Compat | +|---------|-----------|-------------|--------| +| ITCH 1.00 | Jan 19, 2000 | Session mgmt to higher protocol; Broken Trade; timestamps hundredths of sec | Breaking | +| ITCH 2.00 | Nov 5, 2001 | Price 6+4 implied digits; timestamps → ms; shares 9→6 digits | Breaking | +| ITCH 2.0a | Feb 24, 2006 | References INET→NASDAQ; attributed Add Order (F); Halt/Resume | Additive | +| ITCH 3.00 | Jul 11, 2006 | Separate Seconds/Milliseconds msgs; Stock Directory, NOII, Type C/D/Q | Breaking | +| ITCH 3.10 | Oct 20, 2008 | Order Ref/Match ID expanded to 12B; Order Replace added | Additive | +| ITCH 4.00 | Oct 21, 2008 | All numerics → binary (from ASCII); ns timestamps (Seconds+ns field); SoupBinTCP | Breaking | +| ITCH 4.10 | Jan 26, 2010 | Symbol 6→8 chars; NYSE/MKT/Arca Market Category; Reg SHO (Jul 2010); RPI (Nov 2012) | Breaking (widths) | +| ITCH 5.00 | Jul 10, 2013 | Unified 6B ns timestamp; Stock Locate (2B) + Tracking Number (2B) all msgs; MWCB/IPO/LULD msgs | Breaking (all offsets) | + +**Version detection:** Encoded in directory path (`ITCHFiles_v5`, `ITCHFiles_v41`) and filename (`SMMDDYY-v#.txt.gz`). BinaryFILE format (2-byte big-endian length + payload) is version-agnostic — no header indicates ITCH version. + +**ITCH 5.0 historical data available from April 8, 2014** in Nasdaq Data Store. Exact ITCH 4.1 sunset undocumented but falls between Jul 2013 spec and early 2014. + +**FPGA feed:** MoldUDP64 only (10Gb/40Gb at Carteret). Software and FPGA carry identical ITCH 5.0 payloads in guaranteed identical order. + ## Protocol Characteristics ### Message Format @@ -140,6 +159,40 @@ Prices stored as integers with implied decimal: - **Price (4):** 4 bytes, divide by 10000 for dollars - Example: 1234500 = $123.45 +### Sub-Penny Price Encoding + +**Price(4):** 4-byte unsigned big-endian, 4 implied decimal places (value = price x 10,000). + +| Price | Integer | Hex | Context | +|-------|---------|-----|---------| +| $100.00 | 1,000,000 | 0x000F4240 | Standard penny | +| $100.005 | 1,000,050 | 0x000F4272 | Midpoint of $100.00/$100.01 | +| $100.0025 | 1,000,025 | 0x000F4259 | Under half-penny tick regime | +| $0.0001 | 1 | 0x00000001 | Minimum non-zero (sub-dollar) | +| $200,000.0000 | 2,000,000,000 | 0x77359400 | Maximum Price(4) | + +**Price(8):** 8 implied decimals. Only in MWCB Decline Level Message (Type V) — Level 1/2/3 fields. All other message types use Price(4). + +**Midpoint execution reporting:** +- Midpoint peg orders do NOT generate Add Order messages on ITCH +- Against displayed order: Type C (Executed with Price) contains sub-penny midpoint price +- Two non-displayed match: Type P (Trade Non-Cross) reports match price +- Both use Price(4), fully sub-penny capable to $0.0001 + +**Half-penny tick:** SEC Rule 612 amendment (Sep 2024) introduces $0.005 tick for liquid stocks, effective Nov 2025 (delayed to Nov 2026). Midpoint between half-penny levels (e.g., $100.0025 = integer 1,000,025) already representable in Price(4). + +| Message | Price Field | Bytes | Sub-Penny | Notes | +|---------|-------------|-------|-----------|-------| +| A/F (Add) | Price | 4 | Yes (displayed at penny) | Rule 612 constrains displayed | +| E (Executed) | — | — | N/A | Uses original Add price | +| C (Exec w/ Price) | Execution Price | 4 | **Yes** | Midpoint/non-display | +| U (Replace) | Price | 4 | Yes | New price | +| P (Trade) | Price | 4 | **Yes** | Non-displayable matches | +| Q (Cross) | Cross Price | 4 | Typically penny | Auction clearing | +| I (NOII) | Near/Far/Ref | 4 each | Yes | Indicative | +| V (MWCB) | Levels | **8 each** | Yes | Only Price(8) in ITCH 5.0 | +| J (LULD) | Ref/Upper/Lower | 4 each | Yes | Collar prices | + ### Timestamp Encoding 6-byte timestamp: @@ -218,6 +271,34 @@ Maintain: - In practice, never wraps within a day - Numbers reset each trading day +### Corporate Action Handling + +ITCH order books are **stateless across days** — all orders cancelled overnight, reference numbers day-unique, Stock Locates assigned daily. + +**Forward splits:** Invisible in ITCH. No split message exists. New Type R with post-split data at day start; all prior orders already cancelled. Stock opens via normal Opening Cross. Example: AAPL 4:1 (Aug 28, 2020) — fresh Stock Directory, new orders at ~$127 vs prior ~$500. + +**Reverse splits:** Mandatory halt since Nov 2023 (Rule 4120(a)(14)). +1. Day before: Type H halt (M1 Corporate Action) ~7:50 PM +2. Effective date: Type R (post-split) → halted → NOII (Cross Type "H") → Quotation (State "Q") → Trading (State "T") at 9:00 AM → Cross Trade (Type Q) +- CUSIP changes (visible in Daily List, not ITCH) +- All orders cancelled per FINRA Rule 5330(b) + +**Symbol changes:** No ITCH cross-reference. Old symbol absent from Type R; new symbol appears. Use Nasdaq Daily List for mapping. ITCH carries no CUSIP/ISIN (unlike Nasdaq Nordic ITCH which includes ISIN). + +**IPOs:** Type K (IPO Quoting Period) → halt reason IPO1 → quotation-only (IPOQ) → NOII → Cross Type "H" (not "O"). Can occur any time during day. + +**Spin-offs:** Zero ITCH indication. New entity appears as fresh Type R on first trading day. Parent ex-date price drop unexplained in protocol. + +| Action | ITCH Messages | Orders | Detection | +|--------|--------------|--------|-----------| +| Forward split | Type R (new day) | Cancelled overnight | Daily List for ratios | +| Reverse split | Type H (M1), R, I, Q, H (resume) | Cancelled 8 PM; halt 7:50 PM; resume 9 AM | CUSIP change via Daily List | +| Symbol change | Type R (new symbol) | Old dead; new fresh | Daily List for mapping | +| IPO | Type R (IPO=Y), H (IPO1), K, I, Q | Accepted during quotation-only | Type K IPO Price | +| Spin-off | Type R (new entity) | Standard overnight cancel | No ITCH link; use Daily List + CRSP | + +**LOBSTER:** Event Type 7 for halts (Price=-1 halt, 0 quote resume, 1 trade resume). No halt reason code. Unadjusted raw prices. Data from Jan 6, 2009. + ### Timestamp Edge Cases **Midnight rollover:** @@ -337,6 +418,29 @@ Peak message rates: 9. [ ] Validate with known prints 10. [ ] Performance test at peak rates +## Validation Checklist Reference + +Full 45-check validation architecture documented in `../../equity_amer.md` § Data Validation Checklist. + +**Key checks for ITCH implementors:** + +| Priority | Check | Severity | +|----------|-------|----------| +| 1 | Session ID constant for entire day | Critical | +| 2 | Sequence number strict monotonic, no gaps/duplicates | Critical | +| 3 | Timestamp non-decreasing (>1ms regression = corruption) | Critical | +| 4 | Every E/C/X/D/U references valid active Order Ref from prior A/F | Critical | +| 5 | No negative remaining quantities | Critical | +| 6 | No crossed book during continuous trading (State "T") | Critical | +| 7 | System Event ordering: O→S→Q→M→E→C exactly once each | Critical | +| 8 | Stock Directory complete before first trade | Critical | +| 9 | Order NOT restored after Type B (broken trade) | Critical | +| 10 | Gap retransmission verified before further processing | Critical | + +**Processing order:** Transport → Timestamp → Reference Data → State Machine → Order Lifecycle → Auction → Trade Breaks → Volume → Corporate Actions → Best Practices. + +Severity distribution: 13 Critical, 19 High, 13 Medium. + ## Official Resources - **Spec PDF:** https://www.nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/NQTVITCHSpecification.pdf diff --git a/venue-expert/equity/amer/nasdaq/references/specs/totalview.md b/venue-expert/equity/amer/nasdaq/references/specs/totalview.md index 08f0032..3cdb9c4 100644 --- a/venue-expert/equity/amer/nasdaq/references/specs/totalview.md +++ b/venue-expert/equity/amer/nasdaq/references/specs/totalview.md @@ -1,98 +1,16 @@ # Nasdaq TotalView -Nasdaq's premium market data product providing full depth-of-book visibility. - -## Overview - -TotalView provides: -- Complete order book depth (all price levels) -- Order-level event stream -- Auction imbalance indicators (NOII) -- Real-time updates via ITCH protocol - -**Product page:** https://www.nasdaqtrader.com/Trader.aspx?id=TotalView +Premium full depth-of-book product. Uses ITCH 5.0 protocol (see [[equity/amer/nasdaq/references/specs/itch_protocol.md|itch_protocol.md]]). ## Product Tiers -### TotalView-ITCH - -Full depth-of-book for Nasdaq: -- All orders at all price levels -- Order add/modify/cancel/execute events -- Opening, closing, halt cross data -- NOII (Net Order Imbalance Indicator) - -**Coverage:** Nasdaq Stock Market only - -### Nasdaq Basic - -Entry-level product: -- Top-of-book quotes -- Last sale -- No depth - -**Use case:** Basic displays, compliance - -### Nasdaq Level 2 - -Intermediate depth: -- Aggregated book depth -- No order-level detail -- Lower cost than TotalView - -## Data Content - -### Order Book Data - -| Data Element | Availability | -|--------------|--------------| -| Full depth (all levels) | Yes | -| Individual order details | Yes | -| Order reference numbers | Yes | -| Market participant IDs | Attributed orders | -| Hidden order size | No (by definition) | - -### Auction Data - -| Data Element | Availability | -|--------------|--------------| -| NOII (imbalance indicator) | Yes | -| Paired shares | Yes | -| Imbalance size/direction | Yes | -| Indicative prices (near/far) | Yes | -| Cross trade results | Yes | +| Tier | Content | +|------|---------| +| TotalView-ITCH | Full depth, all orders, all levels, NOII | +| Nasdaq Level 2 | Aggregated depth, no order-level detail | +| Nasdaq Basic | Top-of-book only | -### Administrative Data - -| Data Element | Availability | -|--------------|--------------| -| Stock directory | Yes | -| Trading action (halt/resume) | Yes | -| Reg SHO restriction | Yes | -| LULD price bands | Yes | -| IPO release time | Yes | - -## NOII Details - -Net Order Imbalance Indicator disseminated for: -- Opening Cross (9:25-9:30 AM ET) -- Closing Cross (3:50-4:00 PM ET) -- Halt Cross (during halt) -- IPO Cross - -### NOII Fields - -| Field | Description | -|-------|-------------| -| Paired Shares | Shares that can be matched | -| Imbalance Shares | Unmatched shares | -| Imbalance Direction | Buy (B), Sell (S), None (N), No Imbalance (O) | -| Current Reference Price | Inside midpoint | -| Near Indicative Price | Max paired shares price | -| Far Indicative Price | With imbalance consideration | -| Cross Type | Opening (O), Closing (C), Halt (H), IPO (I) | - -### Dissemination Schedule +## NOII Dissemination Schedule | Cross | Start | End | Frequency | |-------|-------|-----|-----------| @@ -100,152 +18,26 @@ Net Order Imbalance Indicator disseminated for: | Closing | 3:50 | 4:00 | Every 1 second | | Halt | Halt start | Reopen | Every 1 second | -## Delivery Methods - -### Direct Connect - -- Co-location at Carteret, NJ -- MoldUDP64 multicast -- Lowest latency (~10-50 microseconds) -- Highest cost - -### Nasdaq Cloud Data Service - -- Cloud delivery -- Multiple cloud providers -- Higher latency (milliseconds) -- Lower infrastructure cost - -### Redistributors - -Third-party vendors: -- Bloomberg -- Refinitiv -- ICE -- Various specialists - -Variable latency, bundled services. - -## Technical Specifications - -### Protocol +## Delivery -ITCH 5.0 (see `itch_protocol.md` for details) +| Method | Latency | Use Case | +|--------|---------|----------| +| Direct (Carteret, NJ co-lo) | ~10-50 μs | MoldUDP64 multicast | +| SoupBinTCP | Higher | Recovery, replay | +| Nasdaq Cloud | ms-range | Lower infrastructure cost | -### Transport +## Capacity Planning -| Method | Use Case | -|--------|----------| -| MoldUDP64 | Primary multicast | -| SoupBinTCP | Recovery, replay | -| Nasdaq Cloud | Cloud delivery | +| Metric | Normal | Peak | +|--------|--------|------| +| Bandwidth | 50-200 Mbps | 1+ Gbps burst | +| Message rate | 1-5M msg/sec | 10+ M msg/sec | -### Bandwidth Requirements - -| Scenario | Bandwidth | -|----------|-----------| -| Normal | 50-200 Mbps | -| Peak | 500+ Mbps | -| Burst | 1+ Gbps | - -### Message Rates - -| Period | Rate | -|--------|------| -| Average | 1-5 million msg/sec | -| Peak | 10+ million msg/sec | -| Opening/closing | Higher concentration | - -## Use Cases - -### Quantitative Trading - -- Full book reconstruction -- Queue position modeling -- Order flow analysis -- Market making signals - -### Execution Algorithms - -- Real-time book state -- Liquidity detection -- Smart order routing input -- Execution quality monitoring - -### Research - -- Historical book analysis -- Microstructure research -- Auction dynamics study -- Market quality analysis - -### Surveillance - -- Manipulation detection -- Spoofing/layering detection -- Best execution monitoring -- Trade reconstruction - -## Comparison with Competitors +## Cross-Venue Comparison | Feature | TotalView | NYSE ArcaBook | Cboe Depth | |---------|-----------|---------------|------------| -| Protocol | ITCH | Pillar | Cboe proprietary | +| Protocol | ITCH 5.0 | XDP | Cboe proprietary | | Coverage | Nasdaq | NYSE Arca | Cboe exchanges | | Auctions | NOII | Auction imbalance | Limited | -| Attribution | Partial | No | No | - -## Historical Data - -### Nasdaq Data Store - -Historical TotalView data available: -- ITCH files by date -- Full day reconstruction -- Research licensing - -### Academic Access - -University programs may have access through: -- WRDS (Wharton Research Data Services) -- TAQ (Trades and Quotes) -- Direct academic licensing - -## Pricing - -Pricing varies by: -- Usage type (display, non-display, derived data) -- Distribution (internal, external) -- Geographic scope -- Platform (professional, non-professional) - -Contact Nasdaq for current pricing. - -## Getting Started - -### Certification - -1. Obtain Nasdaq connectivity -2. Develop feed handler -3. Complete Nasdaq certification -4. Production go-live - -### Development Resources - -- ITCH specification PDF -- Sample data files -- Test environment access -- Technical support - -### Support - -- Technical: Nasdaq Global Data Services -- Sales: Nasdaq sales team -- Email: dataservices@nasdaq.com - -## Official Resources - -- **TotalView overview:** https://www.nasdaqtrader.com/Trader.aspx?id=TotalView -- **ITCH specification:** https://www.nasdaqtrader.com/content/technicalsupport/specifications/dataproducts/NQTVITCHSpecification.pdf -- **Auction/Cross resources:** https://www.nasdaqtrader.com/Trader.aspx?id=AuctionCrosses -- **Nasdaq Trader portal:** https://www.nasdaqtrader.com/ +| Attribution | Partial (Type F) | No | No | diff --git a/venue-expert/equity/amer/nyse/nyse.md b/venue-expert/equity/amer/nyse/nyse.md new file mode 100644 index 0000000..43b8efb --- /dev/null +++ b/venue-expert/equity/amer/nyse/nyse.md @@ -0,0 +1,211 @@ +# NYSE Exchange Mechanics + +**Timezone:** ET (Eastern Time, UTC-5 / UTC-4 DST) + +NYSE-specific market microstructure. Assumes familiarity with US equity concepts from `../equity_amer.md`. + +## Overview and Role + +### NYSE as Operator + +| Venue | MIC | Tape | Fee Model | Characteristics | +|-------|-----|------|-----------|-----------------| +| NYSE | XNYS | A | Maker-taker | Physical floor; parity allocation; DMMs; D-Orders | +| NYSE Arca | ARCX | B&C | Maker-taker | Fully electronic; dominant ETF listing; LMMs; 4AM-8PM | +| NYSE American | XASE | — | Maker-taker | Smaller-cap; eDMMs; Early Open Auction 7AM | +| NYSE National | XCIS | — | Taker-maker (inverted) | Fully electronic; no auctions | +| NYSE Chicago/Texas | XCHI | — | Maker-taker | Rebranded NYSE Texas (2025); no auctions; low share | + +### Listing vs Trading + +NYSE is both: +- **Listing venue** for NYSE-listed securities (Tape A) +- **Trading venue** for all NMS stocks + +NYSE-listed securities trade on all NMS exchanges. Consolidated data via CTA SIP (Tape A). + +## Matching Engine — Pillar Platform + +All NYSE Group equity markets run on **Pillar** from **Mahwah, NJ**. + +NYSE Arca, American, National, and Texas use standard **price-time priority**. NYSE (Tape A) uses a unique **parity allocation model**. + +### Parity Allocation Model + +After market orders (time priority), displayed orders at the same price are allocated on **parity** among three participant types: + +| Participant | Description | +|-------------|-------------| +| Floor Broker | Physical floor representatives | +| DMM | Designated Market Maker | +| Book Participant | All electronic limit orders (aggregated as one) | + +**15% setter priority:** The participant who sets the best price receives 15% of the first execution before the parity wheel engages. + +**Implication:** Floor brokers and DMMs can effectively trade ahead of earlier electronic limit orders. This invalidates standard price-time priority assumptions in microstructure models applied to NYSE Tape A data. + +## DMM (Designated Market Maker) + +### Obligations (Rule 104) + +| Parameter | Tier 1 (S&P 500) | Tier 2 | Tier 3 | +|-----------|-------------------|--------|--------| +| Designated Percentage | 8% | 28% | 30% | +| NBBO quoting minimum (non-ETP) | ≥15% of day | ≥15% of day | ≥15% of day | +| NBBO quoting minimum (ETP) | ≥25% of day | ≥25% of day | ≥25% of day | +| Minimum depth | 1 round lot each side | 1 round lot | 1 round lot | + +Must maintain continuous two-sided quotes. After Aggressing Transaction, must re-enter opposite side at or before applicable Price Participation Point (PPP). + +### DMM Economics + +| Revenue Source | Detail | +|----------------|--------| +| Adding credits | Up to $0.0035/share (tiered) | +| Monthly rebates | Flat rebates for less-active securities | +| Market data | Revenue sharing | +| Capital requirement | $125M base across all units + per-security add-ons | + +### Facilities + +DMMs facilitate openings, closings, and reopenings — receiving aggregate order information for price discovery. No algorithmic collars on opening — DMM selects opening price. + +### Stress Behavior Evidence + +**Flash Crash (May 6, 2010):** Buy-side depth fell to ~25% midday levels, sell-side ~15%. Market makers left stub quotes (1c bids) executed against. NYSE specialists who remained helped curtail turmoil (MacKenzie 2015). + +**NYSE halt (Jul 8, 2015):** Anand et al. (2017, JFE) used this as natural experiment — removing DMMs caused liquidity to decrease market-wide across all exchanges. Removing voluntary EDGX providers had no measurable effect. + +**COVID (Mar 2020):** NYSE floor closed Mar 23, fully electronic. NYSE-listed stocks experienced worse liquidity deterioration than Nasdaq-listed during this period, partly due to DMM inability to operate on floor. + + +## Opening and Closing Auctions + +### Opening Auction + +DMM-facilitated with no modification cutoffs. + +| Time | Event | +|------|-------| +| 8:00 AM | Imbalance publication begins (90 min before open) | +| 9:30 AM | Opening auction executes | + +No algorithmic collars — DMM selects opening price. + +### Closing Auction + +| Time | Event | +|------|-------| +| 3:50 PM | MOC/LOC entry cutoff; NOII begins (every 1 second) | +| 3:59:50 PM | D-Order entry cutoff | +| 4:00 PM | Closing auction executes | + +**D-Orders** (floor broker discretionary orders): enter until 3:59:50 PM, account for **>46% of NYSE closing auction volume**. + +Closing auction captures ~9-10% of daily consolidated volume in NYSE-listed securities (2024), up from ~3% in 2010. + + +## Halts and Reopenings + +NYSE-specific halt mechanics: +- DMM-facilitated reopenings with aggregate order information +- Floor operations during halts (when floor is open) +- Standard LULD and MWCB apply (see `../equity_amer.md` [[equity/amer/equity_amer.md|equity_amer.md]]) + +## Market Data: XDP + +NYSE's **XDP Integrated Feed** provides: + +| Feature | Detail | +|---------|--------| +| Depth | Full depth-of-book (every visible order individually, not aggregated) | +| Timestamps | Nanosecond precision | +| Timestamp method | Source Time Reference (1/sec, seconds) + nanosecond offset per message | +| Attribution | Firm MPID on Add Order messages | +| Symbol Indexes | Stable across days and markets | + +### Key Message Types + +| Type | Code | Description | +|------|------|-------------| +| Add Order | 100 | New order | +| Modify | 101 | Order modification | +| Delete | 103 | Order removal | +| Replace | 104 | Order replacement | +| Execution | 220 | Trade | +| Non-Displayed Trade | 221 | Hidden execution | +| Cross Trade | 222 | Auction print | +| Imbalance | 230 | Auction imbalance | + +**Gotcha:** XDP timestamp reconstruction requires tracking Source Time Reference messages — missing one corrupts all subsequent timestamps. + + +## Fee Structure + +### NYSE Maker-Taker + +| Role | Typical Rate | +|------|-------------| +| DMM adding | Up to $0.0035/share | +| SLP adding | Up to ~$0.0032/share | +| Standard adding | ~$0.0020/share | +| Removing | ~$0.0030/share | + +### NYSE National (Inverted) + +Taker-maker model — removing receives rebate, adding pays fee. Creates different adverse selection dynamics. + + +## Parity Allocation Deep Dive + +Standard price-time priority (used by all other US exchanges): first order at best price wins. + +NYSE parity: after price priority, displayed orders split on **equal parity** among active participant types. Within each participant type, standard time priority applies. + +### Practical Impact + +1. A floor broker joining a price level late can receive equal allocation with the Book Participant (all prior electronic orders aggregated) +2. DMM always participates in parity alongside other types +3. Setter (15%) bonus rewards price improvement — incentivizes aggressive quoting +4. Depth-of-book analysis must account for parity — queue position models calibrated on price-time venues are biased for NYSE + + +## Pillar Migration Timeline + +| Date | Event | +|------|-------| +| Q3 2015 | NYSE Arca Equities migrated to Pillar | +| Jan 24, 2022 | NYSE Tape A equities phased migration begins | +| Oct 2023 | NYSE American Options completes — all NYSE Group on Pillar | +| Jun 2, 2025 | FINRA/NYSE TRF migrated to Pillar | + + +## Empirical Notes + +### Spread Recovery Asymmetry + +After extreme intraday price changes, NYSE bid-ask spreads widen so much that the large widening eliminates most profits from a contrarian strategy. Nasdaq spreads stay almost constant, yielding significant short-term abnormal profits (Lillo & Farmer studies). + + +### DMM Behavior Under Stress + +Menkveld (2013): HFT market makers earn ~EUR 0.88/trade gross but can withdraw rapidly during stress. DMMs (obligated) cannot — demonstrating structural value during Flash Crash and 2015 halt. + + +## Gotchas Checklist + +1. **Parity model** — Invalidates price-time priority assumptions for NYSE Tape A +2. **D-Orders** — Invisible until near close but dominate auction volume (46%) +3. **XDP timestamp** — Must track Source Time Reference; missing one corrupts all subsequent +4. **National inverted** — Different adverse selection dynamics from standard maker-taker +5. **DMM obligation changes** — 2008 specialist->DMM, 2019 Aggressing Transaction redef, 2023 modernization +6. **Floor closure** — COVID Mar 23 2020 fully electronic; affects DMM contribution analysis +7. **Pillar migration** — Phased over years; pre-Pillar data has different characteristics +8. **Setter priority** — 15% bonus creates incentive structures absent at other venues + +## References + +See parent directory `../` for shared US equity references: +- `../equity_amer.md` — US equity market structure overview +- `../references/regulatory/sec_reg_nms.md` — Reg NMS rules +- `../references/specs/sip_specs.md` — SIP specifications diff --git a/venue-expert/equity/apac/hkex.md b/venue-expert/equity/apac/hkex.md new file mode 100644 index 0000000..516c4bf --- /dev/null +++ b/venue-expert/equity/apac/hkex.md @@ -0,0 +1,156 @@ +# HKEX Equity Mechanics + +Broker queue visibility — virtually unique among major developed-market exchanges. Equities focus; derivatives (OMD-D) documented separately. + +## 1. Identity + +| Attribute | Value | +|-----------|-------| +| MIC | **XHKG** | +| Location | Hong Kong | +| Operator | Hong Kong Exchanges and Clearing (HKEX) | +| Market | SEHK (Stock Exchange of Hong Kong) | +| Products | Equities, ETFs, REITs, warrants, CBBCs, inline warrants, debt | +| Key feature | **Real-time broker queue identification** | + +## 2. Broker Queue — Unique Feature + +### What Is Visible + +Real-time **4-digit HKEX Exchange Participant (broker) numbers** at each price level, per side. + +| Attribute | Value | +|-----------|-------| +| Identifier | 4-digit Exchange Participant number | +| Granularity | **Per-order** — same broker appears multiple times if multiple orders | +| Max per side | **40 brokers** across ~5–10 spread levels | +| Max total | **80 entries** per security (40 bid + 40 ask) | +| Scope | **Equities ONLY** — derivatives OMD-D has NO broker identification | +| Update mode | **Real-time but conflated** (not streaming tick-by-tick) | +| Delay | **None** — no artificial delay | + +### What "Per-Order" Means + +Unlike aggregated broker statistics (e.g., "Broker 1234 has 50,000 shares at $100"), HKEX shows each individual order separately. If Broker 1234 has three orders at $100.00, the broker queue shows: + +``` +Bid $100.00: [1234] [1234] [1234] [5678] [9012] ... +``` + +This enables tracking of order additions, modifications, and cancellations by broker. + +### Coverage + +| Security Type | Broker Queue Available | +|---------------|----------------------| +| Equities | **Yes** | +| ETFs | **Yes** | +| REITs | **Yes** | +| Warrants | **Yes** | +| CBBCs | **Yes** | +| Inline warrants | **Yes** | +| Debt securities | **Yes** | +| **Derivatives** | **NO** | + +## 3. Feed Products + +### Product Comparison + +| Product | Code | Broker Queue | Update Mode | Notes | +|---------|------|-------------|-------------|-------| +| Securities Standard | **SS** | **Included natively** | Conflated (~2,000 spu/s) | Base-level product | +| Securities Premium | **SP** | Via free **CBQ** add-on | CBQ conflated; orders streaming | Streaming order data + conflated broker queue | +| Securities FullTick | **SF** | Implicit via per-order data | **Streaming** | Full order-by-order; broker ID implicit in each order | + +### CBQ (Continuous Broker Queue) + +| Attribute | Value | +|-----------|-------| +| Availability | **Complimentary** add-on with SP subscription | +| Update mode | Conflated (not streaming) | +| Content | Same broker queue as SS but as separate add-on channel | + +### Cost + +| Category | Cost | +|----------|------| +| Display usage | Included in SS/SP/SF subscription | +| **Non-display** (automated trading) | **HK$20,000/firm/month** | + +## 4. Limitations + +| Limitation | Detail | +|------------|--------| +| **Conflated updates** | Multiple changes within conflation interval merged; cannot see every individual change | +| **40-broker cap** | Deep books truncated beyond 40 brokers per side | +| **Broker ID ≠ ultimate client** | ID identifies the Exchange Participant, not the end investor | +| **Multiple IDs per broker** | Large brokers use multiple 4-digit IDs (e.g., Goldman Sachs, Morgan Stanley appear under **8+ IDs** each) | +| **No derivatives** | OMD-D products (DS, DP, DF) include MBP/MBO but NO broker identification | + +### Conflation Detail + +SS operates at ~2,000 snapshots per second (spu/s). At this rate, events within ~500μs windows are merged. SF (FullTick) provides streaming per-order data where broker identification is implicit — each order carries the broker ID. + +## 5. Stock Connect + +HKEX operates Stock Connect with mainland China, creating unique broker queue dynamics. + +| Direction | Description | Broker Queue Visibility | +|-----------|-------------|------------------------| +| **Northbound** | HK/international investors → Shanghai/Shenzhen stocks | N/A (trading on SSE/SZSE) | +| **Southbound** | Mainland investors → HKEX stocks | **Specific Connect broker IDs** visible in HKEX broker queue | + +### Connect Broker IDs + +Stock Connect mainland investor orders route through specific designated Exchange Participant IDs. These are **distinct from regular HK broker IDs**, enabling identification of mainland Chinese investor flow in HKEX-listed securities. + +| Observation | Implication | +|-------------|------------| +| Surge in Connect broker IDs at a price level | Mainland buying/selling interest | +| Connect IDs appearing ahead of institutional IDs | Mainland flow leading | +| Connect IDs absent in names usually popular with mainland | Potential regime change | + +## 6. Analytical Applications + +### Flow Detection + +| Application | Method | +|-------------|--------| +| **Institutional flow** | Identify investment bank Exchange Participant IDs (Goldman, Morgan Stanley, etc.) | +| **Retail flow** | Identify retail-focused broker IDs | +| **Stock Connect flow** | Track specific Connect broker IDs for mainland investor activity | +| **Accumulation detection** | Same broker ID repeatedly appearing at multiple price levels | +| **Distribution detection** | Institutional broker IDs appearing on ask side across price levels | + +### Alpha Signal Generation + +| Signal | Description | +|--------|-------------| +| Broker composition change | New institutional brokers appearing at a price → potential informed flow | +| Queue position shift | Broker moving from deep to aggressive levels → urgency signal | +| Connect flow divergence | Mainland vs HK institutional flow disagreement → potential reversion | +| Broker count concentration | Few brokers dominating a level → potentially informed large orders | + +## 7. Historical Timeline + +| Date | Event | +|------|-------| +| 1986 | AMS (Automatic Matching System) launch — broker visibility available | +| Successive upgrades | AMS → AMS/3 → various iterations | +| **Sep 30, 2013** | **OMD-C** (Orion Market Data - Cash) launch — modern delivery mechanism | +| 2014 | Stock Connect (Shanghai) launch | +| 2016 | Stock Connect (Shenzhen) launch | + +Real-time broker queue also available at IDX (Indonesia) and SET (Thailand). No equivalent at NYSE, Nasdaq, CME, LSE, JPX, or Chinese exchanges. + +## 8. Gotchas Checklist + +1. **Conflated, not streaming** — multiple changes within ~500μs interval merged; use SF for tick-by-tick +2. **40-broker cap per side** truncates deep books — you may miss brokers beyond top 40 +3. **Broker ID ≠ ultimate client** — EP number identifies the brokerage, not the end investor +4. **Derivatives (OMD-D) has NO broker queue** — equities only feature +5. **Large brokers split across multiple 4-digit IDs** — e.g., Goldman Sachs uses 8+ IDs; must maintain mapping table +6. **Stock Connect broker IDs are distinct** from regular HK brokers — must know which IDs are Connect +7. **Non-display fee HK$20,000/firm/month** — separate cost for automated trading use +8. **CBQ is complimentary with SP** — no extra charge but requires SP subscription +9. **No equivalent at NYSE/Nasdaq/CME/LSE/JPX** — cannot replicate this analysis methodology elsewhere diff --git a/venue-expert/futures/amer/cme.md b/venue-expert/futures/amer/cme.md new file mode 100644 index 0000000..abc77f9 --- /dev/null +++ b/venue-expert/futures/amer/cme.md @@ -0,0 +1,416 @@ +# CME Group Mechanics + +4 exchanges on Globex. MDP 3.0 market data. 9 matching algorithms. SPAN/SPAN 2 margin. Aurora IL (CyrusOne). + +## 1. Overview and Role + +| Exchange | MIC | Products | Founded | +|----------|-----|----------|---------| +| CME | XCME | Equity index (ES, NQ), FX (6E, 6J), Livestock (LE, HE) | 1898 | +| CBOT | XCBT | Treasuries (ZN, ZB, ZF, ZT), Grains (ZC, ZS, ZW), SOFR (SR3) | 1848 | +| NYMEX | XNYM | Energy (CL, NG), Metals (GC, SI) | 1882 | +| COMEX | XCEC | Gold (GC), Silver (SI), Copper (HG) | 1933 | + +All trade on **Globex** electronic platform at **CyrusOne CHI1, Aurora, Illinois**. + +## 2. Market Data: MDP 3.0 + +### Encoding + +| Attribute | Value | +|-----------|-------| +| Format | **SBE (Simple Binary Encoding)** | +| Byte order | **Little-endian** (native x86, zero-copy) | +| Transport | **UDP multicast** | +| Price encoding | int64 mantissa × 10⁻⁹ (fixed exponent -9) | +| Schema file | `templates_FixBinary.xml` (versioned) | +| Performance | Delivers trade messages ahead of legacy FIX/FAST **>95%** of the time | + +### Message Types + +| Category | Key Messages | Template IDs (approx v9+) | +|----------|-------------|---------------------------| +| Incremental Refresh | Book (bid/ask/implied), TradeSummary, DailyStatistics, SessionStatistics, LimitsBanding, Volume | 46, 48, 49, 51, 50, varies | +| Snapshot | SnapshotFullRefresh (MBP), SnapshotFullRefreshOrderBook (MBO) | 52, 53 | +| Security Definition | Future, Option, Spread, FixedIncome, Repo, FX | 54, 55, 56, 58, 59, varies | +| Security Status | SecurityStatus, SecurityStatusWorkup | 30, 60 | +| Admin | Heartbeat, ChannelReset, QuoteRequest | 12, 4, 39 | + +Template IDs shift between schema versions — always reference the current `templates_FixBinary.xml`. + +### Book Depth + +| Book Type | Depth | Content | Implied Data | +|-----------|-------|---------|-------------| +| **MBP** (Market By Price) | Variable per instrument (typically **10**) | Aggregated per price | **Yes** — implied entries use MDEntryType E/F | +| **MBOFD** (Market By Order Full Depth) | **No limit** | Every individual order | No | +| **MBOLD** (Market By Order Limited Depth) | **Top 10** bid/ask | Individual orders | No | + +**Implied depth = 2 levels (best 2 bid + best 2 ask), NOT 10.** Implied entries use distinct MDEntryType values: **E = Implied Bid, F = Implied Offer** (vs 0/1 for direct). Implied and direct books are maintained separately by the client and must be consolidated. NumberOfOrders (tag 346) is **NULL** for implied entries. + +### Timestamps + +| Field | Format | Location | +|-------|--------|----------| +| SendingTime | **uint64 ns since Unix epoch (UTC)** | Packet header (8 bytes) | +| MsgSeqNum | uint32 | Packet header (4 bytes) | +| TransactTime (tag 60) | uint64 ns | Message body — start of event processing time | + +All messages from a single order action share the same TransactTime. CME synchronizes to a master clock at **microsecond accuracy** — nanosecond encoding provides ordering precision but not absolute ns accuracy. + +### AggressorSide (Tag 5797) + +Present in MDIncrementalRefreshTradeSummary. + +| Value | Meaning | When Used | +|-------|---------|-----------| +| 0 | NoAggressor | Implied trades; market open/re-open after Velocity Logic | +| 1 | Buy | Standard continuous trading — buyer is aggressor | +| 2 | Sell | Standard continuous trading — seller is aggressor | + +NoAggressor (0) for: (a) trades involving implied orders, (b) **market open or re-open after Velocity Logic events** (SecurityTradingStatus=15 or 21). First Order Detail entry for AggressorSide=1/2 is the aggressor order. + +### SecurityTradingStatus (Tag 326) + +| Value | Meaning | +|-------|---------| +| 2 | Trading Halt | +| 4 | Close | +| 15 | New Price Indication (pre-open auction) | +| 17 | Ready To Trade (Open) | +| 18 | Not Available For Trading | +| 21 | Pre-Open | +| 24 | Pre-Cross | +| 25 | Cross | +| 26 | Post Close | + +SecurityTradingEvent (tag 1174): value 5 = Implied ON, value 6 = Implied OFF. + +### Channel Structure + +| Attribute | Value | +|-----------|-------| +| Channel IDs | 3-digit numbers | +| Feeds per channel | ~8 (Incremental A/B, MBP Recovery A/B, MBO Recovery A/B, Instrument Def A/B, TCP Replay) | +| Grouping | By asset class and exchange (CME, CBOT, NYMEX, COMEX) | +| Config | `config.xml` on CME SFTP site | +| Config update | **Weekly** | +| Sequence numbers | Per-channel, **reset weekly** | + +### MatchEventIndicator (Tag 5799) + +uint8 bitmap: + +| Bit | Mask | Meaning | +|-----|------|---------| +| 7 | 0x80 | **End of Event** | +| 0 | 0x01 | Last trade summary in event | +| 4 | 0x10 | Last implied quote in event | + +Within a single matching event, implied updates arrive last (flagged by bit 4). + +## 3. Sequence Recovery + +5-layer architecture in escalating order: + +| Layer | Method | Transport | Constraints | +|-------|--------|-----------|-------------| +| 1 | **Feed A/B arbitration** | UDP | Dual-cast all incremental data; process both, arbitrate | +| 2 | **Market Recovery** | UDP snapshot loop | Continuous full book snapshots; **CME's recommended primary recovery** | +| 3 | **TCP Replay** | TCP | FIX-ASCII logon → SBE response; **max 2,000 packets; 24-hour window; one request per session** | +| 4 | **Instrument Recovery** | UDP loop | Continuous security definition messages | +| 5 | **Channel Reset** | UDP | Emergency: MDEntryType=J signals all books corrupted; RptSeq resets to 1 | + +### Market Recovery Splice + +Use `LastMsgSeqNumProcessed` (tag 369) and `TransactTime` from snapshot to splice with cached incremental data. Incremental messages with sequence ≤ LastMsgSeqNumProcessed are already reflected in the snapshot. + +### TCP Replay Constraints + +| Constraint | Value | +|-----------|-------| +| Max packets | **2,000 per request** | +| Data window | **24 hours** | +| Sessions | **One request per TCP session** | +| Protocol | FIX-ASCII logon → SBE response | +| Performance | Not optimized — small-scale recovery only | + +TCP Replay is NOT for primary recovery. Use Market Recovery (layer 2) as the primary mechanism. + +## 4. Matching Algorithms + +9 algorithms identified by FIX tag 1142-MatchAlgorithm. + +### Product-to-Algorithm Mapping + +| Product | Code | Outright | Spread | Options | +|---------|------|----------|--------|---------| +| E-mini S&P 500 | ES | **FIFO (F)** | FIFO (F) | FIFO (F) | +| E-mini Nasdaq-100 | NQ | **FIFO (F)** | FIFO (F) | FIFO (F) | +| WTI Crude Oil | CL | **FIFO (F)** | FIFO (F) | Q or F | +| Natural Gas | NG | **FIFO (F)** | FIFO (F) | Q or F | +| Gold | GC | **FIFO (F)** | FIFO (F) | Q or F | +| Silver | SI | **FIFO (F)** | FIFO (F) | Q | +| 10-Year T-Note | ZN | **FIFO (F)** | K (20% FIFO / 80% PR) | **Q** | +| 5-Year T-Note | ZF | **FIFO (F)** | K (20/80) | **Q** | +| Treasury Bond | ZB | **FIFO (F)** | K | **Q** | +| Ultra T-Bond | UB | **FIFO (F)** | K | **Q** | +| 2-Year T-Note | ZT | **K** (Split FIFO/PR) | K (20/80) | **Q** | +| 30-Day Fed Funds | ZQ | **K** | K | **Q** | +| 3-Month SOFR | SR3 | **A** (Allocation) | FIFO (packs/bundles) | **Q** | +| 1-Month SOFR | SR1 | **A** (Allocation) | — | — | +| Corn | ZC | **K** (40% FIFO / 60% PR) | K (40/60) | **O** | +| Soybeans | ZS | **K** (40/60) | K (40/60) | **O** | +| Wheat | ZW | **K** (40/60) | K (40/60) | **O** | +| Live Cattle | LE | **FIFO (F)** | K (40/60) | **O** | +| Lean Hogs | HE | **FIFO (F)** | K (40/60) | **O** | +| Euro FX | 6E | **FIFO (F)** | **C** (Pro-Rata) | Q or O | +| Japanese Yen | 6J | **FIFO (F)** | **C** (Pro-Rata) | Q or O | + +### Algorithm Descriptions + +| Code | Name | Mechanism | +|------|------|-----------| +| F | FIFO | Pure time priority | +| K | Configurable | Split FIFO/Pro-Rata (ratios vary by product) | +| A | Allocation | TOP → Pro-Rata (min 2 lots) → FIFO residual | +| C | Pro-Rata (FX spreads) | Pro-rata for spread instruments | +| Q | Threshold Pro-Rata + LMM | Options: TOP + Pro-Rata + LMM allocation | +| O | Threshold Pro-Rata | Options: TOP + Pro-Rata (no LMM) | + +### Volume Share (Databento Aug 2025) + +| Algorithm | Share of CME Volume | +|-----------|-------------------| +| FIFO (F) | **~70.3%** | +| Configurable (K) | **~12.7%** | +| Allocation (A) | **~10.5%** | +| Others | ~6.5% | + +### SOFR Matching Detail + +SR3 (Three-Month SOFR) uses **Allocation (A)**: +1. **TOP order** fills entirely at 100% up to a maximum — first non-implied order to better the market +2. **Pro-rata** with **minimum 2 lots** among remaining resting orders +3. **FIFO residual** for remaining quantity + +Inherited from Eurodollar (GE). SOFR packs and bundles use FIFO, not Allocation. SOFR options use Q (Threshold Pro-Rata + LMM). + +Eurodollar fully delisted June 2023 (LIBOR cessation). 7.5M OI converted to SOFR April 14, 2023. + +### LMM Rules + +| Attribute | Value | +|-----------|-------| +| Scope | **Options only** (not futures) | +| Max allocation | **<50%** of total match quantity | +| Example | 10-Year Treasury Note options: LMM at 40% | +| Multiple LMMs | Possible per product; matched FIFO among themselves | + +## 5. Modify Semantics + +### FIFO Products + +| Action | Queue Position | +|--------|---------------| +| Decrease quantity (price unchanged) | **Retained** | +| Increase quantity | **Lost** (re-queued to back) | +| Change price | **Lost** (re-queued to back) | +| Change account | **Lost** (re-queued to back) | +| GTC across sessions | **Retained** (absent priority-losing modifications) | + +### Pro-Rata Products + +| Attribute | Behavior | +|-----------|----------| +| Timestamp | Matters for TOP designation and FIFO residual allocation | +| Size changes | Directly affect pro-rata share (proportional to displayed qty / total at price) | +| FIFO component | Same re-queue rules as pure FIFO | + +### Iceberg Orders + +Display quantity refresh → **loses queue position** (re-queued to back upon each refresh). + +## 6. Margin: SPAN and SPAN 2 + +### Classic SPAN (1988) + +16-scenario parametric grid simulating worst-case one-day portfolio loss at 99% confidence. + +### The 16 Scenario Grid + +| Scenarios | Price Move (% of Scan Range) | Volatility | P&L Capture | +|-----------|------------------------------|------------|-------------| +| 1–2 | 0% (unchanged) | Up / Down | 100% | +| 3–6 | ±33% | Up / Down | 100% | +| 7–10 | ±67% | Up / Down | 100% | +| 11–14 | ±100% | Up / Down | 100% | +| **15–16** | **±300%** (extreme) | **Up only** | **33% only** | + +Scenarios 15–16: ±3× scan range, capture only 33% of P&L — designed for deep OTM short option tail risk. **Scanning Risk** = maximum portfolio loss across all 16 scenarios. + +Composite Delta computed using 7 price points with probability weights (0.270 at unchanged, tapering to 0.037 at ±100%). + +### Scanning Range Calibration + +| Parameter | Value | +|-----------|-------| +| Target | ≥**99th percentile** of historical daily price moves | +| Lookback | 1 month to 10 years | +| Review frequency | **Monthly** minimum | +| Volatility floors | Prevent margins from falling too low | +| Realized coverage | **99.97%** (Q3 2023) | +| Change notice | Minimum **24 hours** | + +### Margin Components + +| Component | Description | +|-----------|-------------| +| Scanning Risk | Max loss across 16 scenarios | +| **Intra-commodity spread charge** | Basis risk between contract months (assumed 0 by scenarios) | +| **Inter-commodity spread credit** | Reduction for correlated positions across products | +| **Short option minimum (SOM)** | Per-contract floor for deep OTM short options | + +### Intra-Commodity Spread Charge + +SPAN scenarios assume perfect correlation across months → $0 net P&L for calendar spreads. The intra-commodity charge captures basis risk. Example: Eurodollar Mar vs Apr spread charge = **$70** (the entire margin for that position). + +### Inter-Commodity Spread Credit + +| Example | Outright Total | Credit % | Net Margin | +|---------|---------------|----------|------------| +| 1 Long SP + 5 Short NQ | $68,000 | 75% | **$17,000** | + +Credit percentages: exchange-determined, 60–85% typical for major pairs, based on historical correlations. + +### Short Option Minimum (SOM) + +Final requirement = MAX(SPAN calculation, SOM × max(short_calls, short_puts)). Example: S&P 500 SOM = **$240** (2019). + +### Performance Bond Levels (Post-2021) + +| Category | Initial Margin | +|----------|---------------| +| **Non-HRP** (Non-Heightened Risk Profile) | **100% of maintenance** | +| **HRP** (all retail) | **110% of maintenance** | + +Replaced old Hedger/Speculator classification (1.25–1.50× multipliers). + +### SPAN 2 Migration + +| Asset Class | Status | +|-------------|--------| +| NYMEX Energy | **Completed** — July 21, 2023 | +| Equity Products | **Completed** — October 2024 | +| Interest Rate & FX | Pending — originally planned H2 2024, delayed | +| Agriculture & Remaining | Pending — originally planned H2 2025, delayed | + +### SPAN 2 Methodology + +| Attribute | SPAN 2 | Classic SPAN | +|-----------|--------|-------------| +| Scenarios | **Thousands** (filtered historical simulation) | 16 parametric | +| Methodology | **VaR-based** | Scenario-based | +| Risk components | HVaR + Stress + Liquidity + Concentration | Scanning + Spread + SOM | +| Formula | `Total = HVaR + max(0, Stress Risk − HVaR) + Liquidity + Concentration` | Max of 16 scenarios + adjustments | +| File size | **~20 GB** | Hundreds of MB | +| Replicability | Lower — approximation files available | Higher — standard 16-scenario grid | + +## 7. Settlement Methodology + +Tiered waterfall: VWAP → bid/ask midpoint → model/carry → staff discretion override. + +### Per-Product Settlement Parameters + +| Product | Code | Daily Method | Settlement Window (CT) | Duration | Final Settlement | +|---------|------|-------------|----------------------|----------|-----------------| +| E-mini S&P 500 | ES | VWAP lead month | **14:59:30–15:00:00** ⚠️ | 30 sec | SOQ of S&P 500 (3rd Fri) | +| E-mini Nasdaq-100 | NQ | VWAP lead month | **14:59:30–15:00:00** ⚠️ | 30 sec | SOQ via NOOP (3rd Fri) | +| WTI Crude Oil | CL | VWAP active month | 13:28:00–13:30:00 | 2 min | VWAP 30-min (13:00–13:30 CT) | +| Gold | GC | VWAP active month | 12:29:00–12:30:00 | 1 min | Non-active month (spread-based) | +| Treasury Bond | ZB | VWAP lead month | 13:59:30–14:00:00 | 30 sec | Physical delivery (invoice) | +| 3-Month SOFR | SR3 | Optimization | 13:59:00–14:00:00 | 60 sec | 100 − compounded SOFR | + +### ES/NQ Settlement Window Discrepancy + +⚠️ CME Confluence wiki (updated 2025) shows **14:59:30–15:00:00 CT**. Older education materials and CFTC filings show **15:14:30–15:15:00 CT**. The full-size SP contract delisting (September 2021) may have triggered a window change. **Verify with CME GCC at +1 800 438 8616 before production use.** + +### CL Crude Oil Details + +| Attribute | Value | +|-----------|-------| +| Active month window | **2-minute VWAP** (14:28:00–14:30:00 ET) | +| Back months | Calendar spread VWAPs in same window; spread volume / months between legs | +| Expiring contract | **30-minute window** (14:00:00–14:30:00 ET) | +| Bid/ask threshold | Minimum 200 contracts for consideration | + +### SR3 SOFR Settlement + +**Linear optimization** across multiple spread/butterfly instruments: +1. Front quarterly months seeded with VWAP +2. Adjusted within bid/ask ranges for 3/6/9/12-month calendar spreads + butterfly bids/asks +3. Solution minimizing spread violations and closest to VWAP seed values selected +4. Weighted toward nearer expirations + +Final settlement: **100 − R**, where R = daily compounded SOFR over reference quarter (Actual/360 day count). + +### Committee Override + +All products: *"If CME Group staff, in its sole discretion, determines that anomalous activity produces results that are not representative of fair value, staff may determine an alternative settlement price."* + +| Attribute | Value | +|-----------|-------| +| Authority | **GCC staff sole discretion** | +| Formal vote | Not required | +| Triggers | Insufficient data, system issues, price spikes, risk management | + +## 8. Session Schedule + +### Per-Product Session Hours (CT) + +| Product | Sunday Open | Mon–Fri Open | RTH Open | RTH Close | Daily Maintenance | +|---------|------------|-------------|----------|-----------|-------------------| +| ES/NQ (Equity Index) | 17:00 Sun | 17:00 | 08:30 | 15:15 | 15:15–15:30; 16:00–17:00 | +| ZN/ZB/ZF/ZT (Treasuries) | 17:00 Sun | 17:00 | 07:20 | 14:00 | 16:00–17:00 | +| SR3 (SOFR) | 17:00 Sun | 17:00 | 07:20 | 14:00 | 16:00–17:00 | +| CL/NG (Energy) | 17:00 Sun | 17:00 | 08:00 | 13:30 | 16:00–17:00 | +| GC/SI (Metals) | 17:00 Sun | 17:00 | 07:20 | 12:30 | 16:00–17:00 | +| ZC/ZS/ZW (Grains) | 19:00 Sun | 19:00 | 08:30 | 13:20 | 07:45–08:30 | +| 6E/6J (FX) | 17:00 Sun | 17:00 | 07:20 | 14:00 | 16:00–17:00 | + +Daily maintenance window: **16:00–17:00 CT** for most products (grains differ). + +## 9. Outage Registry + +| Date | Duration | Cause | Impact | +|------|----------|-------|--------| +| **Nov 28, 2025** | **~10–11 hours** | CyrusOne CHI1 cooling failure (chiller plant) | **All Globex markets** — equity index, Treasuries, crude, gold, silver, agriculture, FX, crypto | +| Aug 24, 2014 | ~4 hours | Planned software reconfiguration | All Globex (5:00–9:00 PM Chicago time) | +| ~2019 | ~3 hours | Unknown (limited public details) | Globex (partial) | + +### Nov 28, 2025 Detail + +| Attribute | Value | +|-----------|-------| +| Start | ~4:13 AM ET (post-Thanksgiving Friday) | +| Cause | Chiller plant failure at CyrusOne CHI1, Aurora | +| Failover | **CME chose NOT to failover to NY-area backup** | +| Duration | ~10–11 hours (3× previous record) | +| Restoration | All markets by 2:46 PM CT | +| Market impact | Gold erratic OTC moves; silver dropped $1 spot; $600B notional SPX options expiring could not be delta-hedged | + +## 10. Gotchas Checklist + +1. **Implied depth = 2, NOT 10** — only 2 best implied bid + 2 best implied ask levels published +2. **AggressorSide = 0** for implied trades and post-halt re-opens — cannot determine trade direction +3. **ES/NQ settlement window may have shifted** — verify 14:59:30 vs 15:14:30 with CME GCC before production +4. **Template IDs shift between schema versions** — always use current `templates_FixBinary.xml` +5. **TCP Replay: max 2K packets, 24h window, one request per session** — NOT for primary recovery +6. **Sequence numbers reset weekly** — handle wrap-around in feed handler +7. **SPAN 2 file size ~20 GB** — infrastructure must handle download/parse; classic SPAN was hundreds of MB +8. **Non-persistent orders deleted during auctions** — persistent orders preserved +9. **Channel assignments in config.xml** — updated weekly; must re-parse regularly +10. **Implied entries: NumberOfOrders = NULL** — check for NULL before accessing +11. **GCC Product Reference Sheet** — canonical source for per-instrument algorithm; tag 1142 in security definition +12. **SOFR packs/bundles use FIFO** — different from outright SR3 which uses Allocation (A) +13. **CyrusOne CHI1 single point of failure** — Nov 2025 outage showed no automatic failover diff --git a/venue-expert/futures/apac/china/cffex.md b/venue-expert/futures/apac/china/cffex.md new file mode 100644 index 0000000..dc1bf94 --- /dev/null +++ b/venue-expert/futures/apac/china/cffex.md @@ -0,0 +1,352 @@ +# CFFEX - China Financial Futures Exchange (中国金融期货交易所) + +Stock index futures, treasury bond futures. Assumes familiarity with `futures_china.md`. + +## 1. Identity & Products + +| Attribute | Value | +|-----------|-------| +| Timezone | **CST (UTC+8)** | +| Focus | Financial derivatives | +| Night session | **No** | +| Settlement | **Last-hour VWAP** (not full-day) | +| Close time | 15:00 (index), 15:15 (treasury) | +| Restrictions | Position limits, high intraday fees | +| QFI access | **Hedging only** | +| Ownership | Company-based (公司制) | + +### Products + +| Code | Product | Launch | Multiplier | Tick | Close | +|------|---------|--------|------------|------|-------| +| IF | CSI 300 Index | 2010-04-16 | 300 CNY | 0.2 pt | 15:00 | +| IH | SSE 50 Index | 2015-04-16 | 300 CNY | 0.2 pt | 15:00 | +| IC | CSI 500 Index | 2015-04-16 | 200 CNY | 0.2 pt | 15:00 | +| IM | CSI 1000 Index | **2022-07-22** | 200 CNY | 0.2 pt | 15:00 | +| T | 10Y Treasury | 2015-03-20 | 10,000 CNY | 0.005 pt | 15:15 | +| TF | 5Y Treasury | 2013-09-06 | 10,000 CNY | 0.005 pt | 15:15 | +| TS | 2Y Treasury | 2018-08-17 | 20,000 CNY | 0.005 pt | 15:15 | +| TL | 30Y Treasury | **2023-04-21** | 10,000 CNY | 0.01 pt | 15:15 | + +> IM and TL are the two newest products, launched under the registration-based listing system post-Futures Law. + +### Contract format + +UPPERCASE + YYMM (e.g., `IF2501`, `T2503`). + +--- + +## 2. Data Characteristics + +| Field | Behavior | +|-------|----------| +| UpdateMillisec | **0 or 500** (binary pattern, same as SHFE/INE) | +| AveragePrice | **× Multiplier** (divide by multiplier before use) | +| ActionDay | Correct (no night session, no date ambiguity) | +| TradingDay | Correct (no night session complexity) | +| L1 snapshot rate | 500ms via CTP | +| L2 depth | 5 levels, **500ms**, paid, via 上海金融衍生品研究院 | +| L2 availability | ~2010 (earliest among all exchanges) | + +> CFFEX L2 remains at 500ms while DCE/CZCE upgraded to 250ms. CFFEX L2 requires paid license. + +--- + +## 3. Data Validation Checklist + +| Check | Rule | Severity | +|-------|------|----------| +| UpdateMillisec | Must be exactly 0 or 500 | Hard reject if other values | +| AveragePrice | Divide by contract multiplier to get meaningful price | Data corruption if raw | +| ActionDay | Must equal calendar date (no night session) | Hard reject if mismatch | +| TradingDay | Must equal ActionDay (no night session) | Hard reject if mismatch | +| No night ticks | Reject any tick outside 09:00-15:15 window | Stale/spurious data | +| Contract code | UPPERCASE, YYMM format | Reject lowercase | +| Price limits | Index ±10%, treasury ±2% (varies) | Flag if exceeded | + +--- + +## 4. Order Book Mechanics + +### No Night Session + +```mermaid +gantt + title CFFEX Trading Hours (No Night) + dateFormat HH:mm + axisFormat %H:%M + + section Index Futures + Opening Auction :09:25, 5m + Morning :09:30, 2h + Afternoon :13:00, 2h + + section Treasury Futures + Opening Auction :09:10, 5m + Morning :09:15, 2h15m + Afternoon :13:00, 2h15m +``` + +No night session means no overnight position changes from Asian/European markets. + +### Call Auction + +| Feature | Index Futures | Treasury Futures | +|---------|--------------|-----------------| +| Opening auction | **09:25-09:30** | **09:10-09:15** | +| Closing call auction | **Options only: 14:57-15:00** | No | +| Market orders in auction | **Auto-cancelled** | **Auto-cancelled** | + +CFFEX is the **only exchange with a closing call auction** (applicable to stock index options). The closing auction price determines the options settlement price. + +Auction times differ from all commodity exchanges (which use 08:55-09:00 / 20:55-21:00). + +### Self-Trade Prevention (STP) + +Since **January 2024**, CFFEX supports self-trade prevention for treasury futures institutional clients: +- Netting of treasury futures across accounts +- Reduced margin requirements +- Must apply for STP eligibility + + +### Last-Hour VWAP Settlement + +```mermaid +flowchart LR + subgraph Commodities["SHFE/INE/DCE/CZCE"] + ALL["All Day Trades"] --> VWAP1["Full-Day VWAP"] + end + + subgraph CFFEX_IDX["CFFEX Index"] + LAST["14:00-15:00 Only"] --> VWAP2["Last-Hour VWAP"] + end + + subgraph CFFEX_TRS["CFFEX Treasury"] + LAST2["14:15-15:15 Only"] --> VWAP3["Last-Hour VWAP"] + end +``` + +**Implication:** EOD price manipulation targets the last hour, not the close. + +--- + +## 5. Transaction Costs + +### Current Fee Structure + +| Product | Open | Close Today | Ratio | +|---------|------|-------------|-------| +| IF | 0.23/10000 | **2.3/10000** | **10x** | +| IH | 0.23/10000 | **2.3/10000** | **10x** | +| IC | 0.23/10000 | **2.3/10000** | **10x** | +| IM | 0.23/10000 | **2.3/10000** | **10x** | +| T/TF/TS/TL | 3 CNY | **0 CNY** | Free close | + +### CFFEX Index Futures Fee History + +The most dramatic fee changes in Chinese futures history. Close-today fees went from ~0 to 万分之23 (100x) after the 2015 crash, then took 8 years to partially normalize. + +| Date | Close-Today Fee | Multiplier vs Normal | Daily Open Limit | Event | +|------|----------------|---------------------|-----------------|-------| +| Pre-2015 | ~万分之0.23 | 1x | Unrestricted | Normal operations | +| **2015-08-26** | **万分之1.15** | **5x** | 600/product | First tightening | +| **2015-09-07** | **万分之23** | **100x** | 10/product | Maximum restriction | +| 2017-02-17 | 万分之9.2 | 40x | 20/product | 1st relaxation | +| 2017-09-18 | 万分之6.9 | 30x | 20/product | 2nd relaxation | +| 2018-12-03 | 万分之4.6 | 20x | 50/contract | 3rd relaxation | +| 2019-04-22 | 万分之3.45 | 15x | 500/contract | 4th relaxation | +| **2023-03-20** | **万分之2.3** | **10x** | 500/contract | **Current rate** | + +> Treasury futures: 3元/手, close-today free. No fee history drama. + +### Index Arbitrage Constraints + +Index futures vs cash index arbitrage faces structural frictions: + +| Friction | Impact | +|----------|--------| +| T+1 stocks vs T+0 futures | Cannot quickly adjust stock leg | +| Position limits (1,200) | Caps arbitrage scale | +| 10x intraday fees | Discourages day arb | +| ETF creation/redemption | Delays in cash settlement | + +**Result:** Persistent basis (often discount to fair value). + +--- + +## 6. Position Limits & Margin + +### Static Speculative Position Limits + +| Product | Speculative Limit | Notes | +|---------|-------------------|-------| +| IF | **5,000 contracts** | Per single contract, single direction | +| IH/IC/IM | **1,200 contracts** each | Per single contract, single direction | +| T/TF/TS | 2,000 (non-delivery) | 600 in delivery month | +| TL | 1,000 (non-delivery) | 300 in delivery month | + +**QFI restriction:** Foreign investors (QFI) may only trade index futures **for hedging purposes** with approved quota. + +### CFFEX Index Futures Daily Open Limit History + +| Date | Daily Open Limit | Unit | Event | +|------|-----------------|------|-------| +| Pre-2015 | Unrestricted | — | Normal operations | +| 2015-08-25 | **600** | per product | First restriction | +| 2015-08-28 | **100** | per product | Rapid escalation | +| **2015-09-07** | **10** | per product | **Peak restriction** | +| 2017-02-17 | **20** | per product | 1st relaxation | +| 2017-09-18 | 20 | per product | 2nd relaxation | +| **2018-12-03** | **50** | **per contract** | 3rd relaxation; **unit changed from per-product to per-contract** | +| **2019-04-22** | **500** | per contract | 4th relaxation (10x increase) | +| 2023-03-20 | 500 | per contract | Current (no change) | + +> The per-product to per-contract shift (2018-12-03) is a subtle but critical regime change — it allowed far more total daily activity since the limit applied per individual contract month rather than across all months of IF collectively. + +### CFFEX Index Futures Margin History + +| Date | IF/IH Margin | IC Margin | IM Margin | Event | +|------|-------------|-----------|-----------|-------| +| Pre-2015 | 10% | 10% | — | Normal | +| **2015-09-07** | **40%** | **40%** | — | Peak restriction | +| 2017-02-17 | 20% | 30% | — | 1st relaxation | +| 2017-09-18 | 15% | 30% | — | 2nd relaxation | +| 2018-12-03 | **10%** | 15% | — | Near-normalization | +| **2019-04-22** | **10%** | **12%** | — | Current levels set | +| 2022-07-22 | 10% | 12% | **12%** | IM launched | +| Current | **10%** | **12%** | **12%** | No further change through 2025 | + + +--- + +## 7. Regulatory Framework + +### Abnormal Trading Thresholds + +| Metric | CFFEX Index Futures | CFFEX Treasury Futures | Other Exchanges | +|--------|--------------------|-----------------------|-----------------| +| Frequent cancels | **≥400 cancels/contract/day** | ≥500 cancels/contract/day | ≥500/contract/day | +| Large cancels | **≥100 large cancels ≥80% max size** | Per published rules | ≥50 large cancels | +| Self-trades | ≥5/contract/day | ≥5/contract/day | ≥5/contract/day | + +CFFEX index futures have **stricter thresholds** than all other exchanges (400 vs 500 cancel limit). + +### Enforcement + +CFFEX applies restrictions **from the first violation** for stock index futures — reflecting post-2015 crash sensitivity. Other exchanges follow a three-step escalation (phone warning → priority monitoring → position-opening restriction ≥1 month). + +### FOK/FAK Exemptions + +FOK and FAK order auto-cancellations do **not** count toward thresholds. Market orders, stop-loss orders, spread orders, hedging trades, and designated market maker activity are all exempt. + +### Programmatic Trading Rules + +Since 国办发47号 (2024-09-30): HFT fee rebates cancelled, mandatory programmatic trading reporting. CSRC Programmatic Trading Management Rules effective **October 9, 2025**. Programme trading defined as ≥5 instances of placing ≥5 orders within 1 second on the same trading day. + +--- + +## 8. Regime Change Database + +| Date | Event | Category | Impact | +|------|-------|----------|--------| +| **2015-08-25** | First restriction: 600/product, 12% margin, 万分之1.15 close-today | restriction | Market cooling begins | +| **2015-08-28** | Escalation: 100/product, 20% margin | restriction | Rapid tightening | +| **2015-09-07** | **Peak restriction: 10/product, 40% margin, 万分之23 fee** | restriction | **Market effectively frozen** | +| 2017-02-17 | 1st relaxation: 20/product, 20%/30% margin, 万分之9.2 | relaxation | Slow thaw begins | +| 2017-09-18 | 2nd relaxation: 15%/30% margin, 万分之6.9 | relaxation | Incremental | +| **2018-12-03** | 3rd relaxation: 50/contract (unit change), 10%/15% margin, 万分之4.6 | relaxation | Per-product → per-contract | +| **2019-04-22** | 4th relaxation: 500/contract, 10%/12% margin, 万分之3.45 | relaxation | Most impactful — 10x daily limit increase | +| **2022-07-22** | **IM (CSI 1000) + options launched**; IH options launched | product | New tickers; cross-hedging models need update | +| 2022-09-02 | QFI access launched: 41 futures/options opened | access | Foreign order flow enters | +| 2022-12-19 | Formal codification in notice [2022]73 | regulation | No parameter change | +| **2023-03-20** | **Close-today fee reduced: 万分之2.3 (current)** | fee | Latest fee change | +| **2023-04-21** | **TL (30Y Treasury) launched** | product | Completes 2Y/5Y/10Y/30Y yield curve | +| **2024-01** | **Self-trade prevention (STP) launched for treasury futures** | structure | Institutional netting, reduced margin | +| **2024-07** | **~30μs latency added via fiber extension** | structure | CFFEX-specific; minimal vs SHFE ~300μs | +| **2024-09-24** | **"924 Rally"**: stock market surge, CFFEX volumes spike | structure | Volume/liquidity regime change | +| 2024-09-30 | State Council 国办发47号: HFT fee rebates cancelled | regulation | Programmatic trading reporting mandatory | +| **2024-12-27** | Delivery/exercise fees halved for 2025 (HFT excluded) | fee | Fee parameter change effective Jan 1, 2025 | + +> Pre-2015-09 vs post-2019-04 are effectively **different markets**. Any backtest spanning this period must account for the regime discontinuity. + +--- + +## 9. Failure Modes & Gotchas + +| Gotcha | Detail | +|--------|--------| +| 10x intraday fee | Close-today fee is 万分之2.3 vs 万分之0.23 open. Forgetting this 10x multiplier destroys PnL calculations | +| Pre-2015 vs post-2019 | Different markets. Liquidity, participation, cost structure all fundamentally changed | +| Last-hour VWAP manipulation | Settlement price computed from last hour only — manipulation targets 14:00-15:00, not close | +| T+1 stocks vs T+0 futures | Cash-futures arbitrage is structurally impaired; persistent basis discount | +| Closing call auction (options only) | Options have 14:57-15:00 closing auction; futures do not. Do not expect closing auction behavior in futures | +| 400 cancel limit (index) | Stricter than all other exchanges (500). First violation triggers restrictions | +| QFI hedging only | Foreign investors cannot speculate on index futures. Hedging quota required | +| No night session | Overnight gap risk absorbs all Asian/European/US session moves into opening auction | +| IM margin = IC margin | IM launched at 12% despite being a newer, smaller-cap product — same as IC | + +--- + +## 10. Market Maker Programs + +### Program Structure + +| Attribute | Value | +|-----------|-------| +| Rules published | 2018/12 (revised 2020/11) | +| Treasury futures coverage | 4 products: TS, TF, T, TL | +| Options coverage | 3 products: IO (CSI 300), MO (CSI 1000), HO (SSE 50) | +| Disclosed market makers | **16 for CSI 300 index options** at launch (Dec 2019) | +| Named participants | Zhaoshan, CITIC, Guotai Junan, Haitong Securities | +| Quoting mode | Continuous + response quoting | +| Exemptions | Fee discounts, position limit exemptions, abnormal trading designation exemption | + +> Since January 2024, STP for treasury futures market makers. Other exchanges rarely disclose participant lists. + +--- + +## 11. Empirical Parameters + +### Spread Estimates + +| Product | Tick Size | Median Spread (ticks) | Median Half-Spread (bps) | Confidence | Source | +|---------|-----------|----------------------|--------------------------|------------|--------| +| IF (CSI 300) | 0.2 pts | 1-3 | ~0.3-0.8 | Medium | arXiv:2501.03171 | +| T (10Y bond) | 0.005 CNY | 1-3 | ~0.2-0.7 | Low | Estimate | + + +### Queue Depth and Fill Time + +| Product | Typical L1 Queue (lots) | L1 Queue (CNY notional) | Trade Freq (trades/sec) | Est. Queue Half-Life (sec) | +|---------|------------------------|------------------------|------------------------|---------------------------| +| IF | 10-50 | 10.5-60M | 1-3 | 3-10 | + + +### Weibull Fill Time Parameter + +| Product | Estimated k | Rationale | +|---------|-------------|-----------| +| IF | **0.70-0.85** | Restricted market, institutional, clustered flow | + +Sub-exponential (k < 1) reflects order flow clustering. + +### Matching Engine Latency + +| Metric | Value | Source | +|--------|-------|--------| +| Matching latency | **Sub-millisecond** | Direct measurement | +| Fiber extension (Jul 2024) | **+30μs** added | 界面新闻 practitioner report | +| Co-location order-to-ack | ~500μs baseline | Pre-Jul 2024 | +| Market data (L1 and L2) | 500ms snapshots | No 250ms upgrade (unlike DCE/CZCE) | + +> CFFEX's +30μs fiber extension was the smallest among all exchanges (SHFE added ~300μs). + +--- + +## 12. Primary Sources + +- Rules: https://www.cffex.com.cn/fgfz/ +- Products: https://www.cffex.com.cn/ +- Abnormal trading monitoring: https://www.cffex.com.cn/jcbz/ +- Fee schedule: https://www.cffex.com.cn/jsxf/ +- Position limits: https://www.cffex.com.cn/ccxe/ diff --git a/venue-expert/futures/apac/china/cffex/cffex.md b/venue-expert/futures/apac/china/cffex/cffex.md deleted file mode 100644 index 5c792fb..0000000 --- a/venue-expert/futures/apac/china/cffex/cffex.md +++ /dev/null @@ -1,152 +0,0 @@ -# CFFEX - China Financial Futures Exchange (中国金融期货交易所) - -Stock index futures, treasury bond futures. Assumes familiarity with `futures_china.md`. - -## Key Characteristics - -| Attribute | Value | -|-----------|-------| -| Timezone | **CST (UTC+8)** | -| Focus | Financial derivatives | -| Night session | **No** | -| Settlement | **Last-hour VWAP** (not full-day) | -| Close time | 15:00 (index), 15:15 (treasury) | -| Restrictions | Position limits, high intraday fees | -| QFI access | **Hedging only** | - -## Products - -| Code | Product | Multiplier | Tick | Close | -|------|---------|------------|------|-------| -| IF | CSI 300 Index | 300 CNY | 0.2 pt | 15:00 | -| IH | SSE 50 Index | 300 CNY | 0.2 pt | 15:00 | -| IC | CSI 500 Index | 200 CNY | 0.2 pt | 15:00 | -| IM | CSI 1000 Index | 200 CNY | 0.2 pt | 15:00 | -| T | 10Y Treasury | 10,000 CNY | 0.005 pt | 15:15 | -| TF | 5Y Treasury | 10,000 CNY | 0.005 pt | 15:15 | -| TS | 2Y Treasury | 20,000 CNY | 0.005 pt | 15:15 | -| TL | 30Y Treasury | 10,000 CNY | 0.01 pt | 15:15 | - -## Last-Hour VWAP Settlement - -**Critical difference from commodity exchanges:** - -```mermaid -flowchart LR - subgraph Commodities["SHFE/INE/DCE/CZCE"] - ALL["All Day Trades"] --> VWAP1["Full-Day VWAP"] - end - - subgraph CFFEX_IDX["CFFEX Index"] - LAST["14:00-15:00 Only"] --> VWAP2["Last-Hour VWAP"] - end - - subgraph CFFEX_TRS["CFFEX Treasury"] - LAST2["14:15-15:15 Only"] --> VWAP3["Last-Hour VWAP"] - end -``` - -**Implication:** EOD price manipulation targets the last hour, not the close. - -## Position Limits - -**Strict limits on speculative positions:** - -| Product | Speculative Limit | Notes | -|---------|-------------------|-------| -| IF/IH/IC/IM | **1,200 contracts** | All months combined, per client | -| T/TF/TS | 2,000 (non-delivery) | 600 in delivery month | -| TL | 1,000 (non-delivery) | 300 in delivery month | - -**QFI restriction:** Foreign investors (QFI) may only trade index futures **for hedging purposes** with approved quota. - -## Fee Structure (Anti-Speculation) - -| Product | Open | Close Today | Ratio | -|---------|------|-------------|-------| -| IF | 0.23/10000 | **2.3/10000** | **10x** | -| IH | 0.23/10000 | **2.3/10000** | **10x** | -| IC | 0.23/10000 | **2.3/10000** | **10x** | -| IM | 0.23/10000 | **2.3/10000** | **10x** | -| T/TF/TS/TL | 3 CNY | 0 CNY | Free close | - -**Purpose:** Discourage day trading in index futures after 2015 market volatility. - -## Restriction History - -```mermaid -timeline - title CFFEX Index Futures Restrictions - 2015-09-07 : Maximum restrictions - : 10 contracts/day - : 40% margin - : 0.23% intraday fee - 2017-02-17 : Round 1 relaxation - : 20 contracts/day - : 20-30% margin - 2018-12-03 : Round 3 - : 50 contracts/day - : 10-15% margin - 2019-04-22 : Round 4 (current) - : 500 contracts/day - : 12% margin - : 0.0345% fee -``` - -**Backtesting implication:** Pre-2015-09 vs post-2019-04 are effectively **different markets**. - -## STP (Single Treasury Pool) - -Since January 2024, CFFEX supports STP for institutional clients: -- Netting of treasury futures across accounts -- Reduced margin requirements -- Must apply for STP eligibility - -## No Night Session - -```mermaid -gantt - title CFFEX Trading Hours (No Night) - dateFormat HH:mm - axisFormat %H:%M - - section Index Futures - Opening Auction :08:55, 5m - Morning 1 :09:00, 1h15m - Morning 2 :10:30, 1h - Afternoon :13:00, 2h - - section Treasury Futures - Opening Auction :09:10, 5m - Morning :09:15, 2h15m - Afternoon :13:00, 2h15m -``` - -No night session means no overnight position changes from Asian/European markets. - -## Index Arbitrage Constraints - -Index futures vs cash index arbitrage faces frictions: - -| Friction | Impact | -|----------|--------| -| T+1 stocks vs T+0 futures | Cannot quickly adjust stock leg | -| Position limits (1,200) | Caps arbitrage scale | -| 10x intraday fees | Discourages day arb | -| ETF creation/redemption | Delays in cash settlement | - -**Result:** Persistent basis (often discount to fair value). - -## Data Quirks - -| Field | Behavior | -|-------|----------| -| UpdateMillisec | 0 or 500 | -| AveragePrice | × Multiplier | -| ActionDay | Correct | -| Contract format | UPPERCASE + YYMM (e.g., `IF2501`) | - -## Primary Source - -- Rules: https://www.cffex.com.cn/fgfz/ -- Products: https://www.cffex.com.cn/ diff --git a/venue-expert/futures/apac/china/czce.md b/venue-expert/futures/apac/china/czce.md new file mode 100644 index 0000000..ca0d292 --- /dev/null +++ b/venue-expert/futures/apac/china/czce.md @@ -0,0 +1,345 @@ +# CZCE - Zhengzhou Commodity Exchange (郑州商品交易所) + +Agricultural products, chemicals. Assumes familiarity with `futures_china.md`. + +## 1. Identity & Products + +| Attribute | Value | +|-----------|-------| +| Timezone | **CST (UTC+8)** | +| Focus | Agricultural (cotton, sugar), chemicals (PTA, methanol) | +| Night session | Yes (21:00-23:00 end) | +| Contract format | **3-digit year (YMM)** - ambiguous across decades | +| UpdateMillisec | **Always 0** - no sub-second ordering | +| AveragePrice | **Direct** (not scaled by multiplier) | + +### Products + +| Code | Product | Multiplier | Tick | Night | +|------|---------|------------|------|-------| +| CF | Cotton (棉花) | 5 t | 5 CNY | 23:00 | +| SR | Sugar (白糖) | 10 t | 1 CNY | 23:00 | +| TA | PTA | 5 t | 2 CNY | 23:00 | +| MA | Methanol (甲醇) | 10 t | 1 CNY | 23:00 | +| FG | Glass (玻璃) | 20 t | 1 CNY | 23:00 | +| OI | Rapeseed Oil (菜籽油) | 10 t | 1 CNY | 23:00 | +| RM | Rapeseed Meal (菜籽粕) | 10 t | 1 CNY | 23:00 | +| ZC | Thermal Coal (动力煤) | 100 t | 0.2 CNY | 23:00 | +| SA | Soda Ash (纯碱) | 20 t | 1 CNY | 23:00 | +| UR | Urea | 20 t | 1 CNY | 23:00 | +| AP | Apple | 10 t | 1 CNY | None | +| CJ | Jujube | 5 t | 5 CNY | None | +| PK | Peanut | 5 t | 2 CNY | None | +| SF | Silicon Ferro | 5 t | 2 CNY | 23:00 | +| SM | Silicon Manganese | 5 t | 2 CNY | 23:00 | +| PF | Staple Fiber | 5 t | 2 CNY | 23:00 | +| PX | PX (对二甲苯) | 5 t | 2 CNY | 23:00 | +| SH | Caustic Soda (烧碱) | 30 t | 1 CNY | 23:00 | +| PET | PET Chip (聚酯瓶片) | 5 t | 2 CNY | 23:00 | + +### Night Session Rollout + + +| Code | Product | Night session start | Hours at launch | Current hours | +|------|---------|-------------------|-----------------|---------------| +| SR | 白糖 Sugar | **2014-12-12** | 21:00-23:30 | 21:00-23:00 | +| CF | 棉花 Cotton | **2014-12-12** | 21:00-23:30 | 21:00-23:00 | +| RM | 菜籽粕 Rapeseed Meal | **2014-12-12** | 21:00-23:30 | 21:00-23:00 | +| MA | 甲醇 Methanol | **2014-12-12** | 21:00-23:30 | 21:00-23:00 | +| TA | PTA | **2014-12-12** | 21:00-23:30 | 21:00-23:00 | +| OI | 菜籽油 Rapeseed Oil | **~2015-06-11** | 21:00-23:30 | 21:00-23:00 | +| FG | 玻璃 Glass | **~2015-06-11** | 21:00-23:30 | 21:00-23:00 | +| ZC | 动力煤 Thermal Coal | **~2015-06-11** | 21:00-23:30 | 21:00-23:00 | +| SA | 纯碱 Soda Ash | **2019-12-06** | 21:00-23:00 | 21:00-23:00 | + +Hours shortened from **23:30 to 23:00** around 2019. + +## 2. Data Characteristics + +### Contract Code Ambiguity + +**Critical:** CZCE uses 3-digit year codes (YMM), creating decade ambiguity. + +```mermaid +flowchart TD + CODE["CF501"] --> Q{What year?} + Q -->|"If parsed in 2015"| Y2015["January 2015"] + Q -->|"If parsed in 2025"| Y2025["January 2025"] + + style Q fill:#f96 +``` + +**Resolution:** Use trading calendar context - if contract is listed/active, disambiguate by current date. Contracts list at most ~12-18 months ahead, so CF501 can only mean January 2025 during 2024-2025. + +### Format Comparison Across Exchanges + + +| Exchange | Format | Example | Case | +|----------|--------|---------|------| +| SHFE | Code + YYMM | rb2501 | lowercase | +| DCE | Code + YYMM | m2501 | lowercase | +| CFFEX | Code + YYMM | IF2501 | UPPERCASE | +| INE | Code + YYMM | sc2501 | lowercase | +| GFEX | Code + YYMM | si2501 | lowercase | +| **CZCE** | **Code + YMM** | **CF501** | **UPPERCASE** | + +### Vendor Handling + + +| Platform | CZCE format | Example | Notes | +|----------|-------------|---------|-------| +| CTP (native) | 3-digit | CF501 | Exchange passthrough | +| VNPY | 3-digit | TA910.CZCE | Uses CTP directly | +| TqSdk | 3-digit | CZCE.SR901 | Follows exchange convention | +| Wind (万得) | **4-digit** | CF2501.CZC | **Normalizes** for consistency | +| Sina Finance | **4-digit** | MA2109 | **Normalizes** in API | +| RQData (米筐) | **4-digit** | CF2501 | **Normalizes** for consistency | +| SimNow | 3-digit | Same as CTP | Mirrors live behavior | + +CTP-native tools preserve 3-digit format; data vendors normalize to 4-digit for cross-exchange consistency and decade disambiguation. + +### UpdateMillisec Always Zero + +CZCE does not populate sub-second timestamps: + +| Exchange | UpdateMillisec | +|----------|----------------| +| SHFE/INE | 0 or 500 | +| DCE | 0-999 | +| CFFEX | 0 or 500 | +| **CZCE** | **Always 0** | + +**Implication:** Cannot determine ordering within same second. + +### AveragePrice Not Scaled + +| Exchange | AveragePrice Meaning | +|----------|---------------------| +| SHFE/INE/DCE/CFFEX | VWAP x Multiplier | +| **CZCE** | **True VWAP** (no scaling) | + +```python +def get_vwap(tick, exchange): + if exchange == "CZCE": + return tick.AveragePrice # Direct + else: + return tick.AveragePrice / get_multiplier(tick.InstrumentID) +``` + +### Level-2 Data + + +| Attribute | Value | +|-----------|-------| +| Available since | ~2018-2020 | +| Update rate | **250ms** (4/sec) | +| Depth | 5 levels | +| Provider | 易盛 Esunny | +| Cost | Free on 易盛极星; **paid** elsewhere (~¥300-600/yr) | + +DCE and CZCE L2 at 250ms provides 2x temporal resolution vs SHFE/CFFEX at 500ms. Developers must use 易盛 proprietary DataFeed API rather than CTP for L2. + +## 3. Data Validation Checklist + +| Field | Behavior | Action | +|-------|----------|--------| +| UpdateMillisec | **Always 0** | Interpolate: 000/500/750/875 (halving intervals) | +| AveragePrice | **True VWAP** | Use directly (no divide by multiplier) | +| ActionDay | **Correct** | Use as-is | +| TradingDay (night) | **WRONG** - shows current date, not next trading day | Derive from ActionDay + time; or use SHFE TradingDay as reference | +| Contract format | **UPPERCASE + YMM** (3-digit) | Disambiguate decade from trading calendar context | + +**CZCE TradingDay bug at night:** On Friday Jan 30, 2015 at 21:02 night session, CZCE TA505 shows ActionDay=20150130 (correct), TradingDay=20150130 (wrong, should be 20150202 Monday). Never trust TradingDay from CZCE during night sessions. + +## 4. Order Book Mechanics + +### Call Auction + +| Feature | CZCE | +|---------|------| +| Night product opening auction | 20:55-21:00 | +| Day-only product opening auction | 08:55-09:00 | +| Day-session auction for night products | **No** (cancel-only 08:55-08:59) | +| Closing call auction | No | +| Market orders in auction | Explicitly excluded | +| FOK orders | **Not supported** | + + +### Cancel-Only Window (08:55-08:59) + +Unique CZCE rule for overnight orders: + +```mermaid +gantt + title CZCE Day Session Opening + dateFormat HH:mm + axisFormat %H:%M + + section Night Carryover + Cancel-only window :crit, 08:55, 4m + + section Auction + Day opening auction :08:59, 1m + + section Continuous + Trading begins :09:00, 15m +``` + +During 08:55-08:59, you can **only cancel** unmatched overnight orders, not submit new ones. + +**Critical difference from peers:** SHFE, DCE, INE, and GFEX all added full day-session call auctions for night-session products in **May 2023**. CZCE did not. This means no price discovery/re-matching opportunity for CZCE night products between 08:55-09:00 -- only cancellations. + +## 5. Transaction Costs + +### Exchange-Level Fees + + +| Code | Product | Fee type | Open/Close | Close-today | Notes | +|------|---------|----------|-----------|-------------|-------| +| TA | PTA | Per-lot | 3元/手 | **0元** | Close-today free | +| MA | 甲醇 | Per-lot | 2元/手 | Varies (0-6元) | Contract-month dependent | +| SR | 白糖 | Per-lot | 3元/手 | **0元** | Close-today free | +| CF | 棉花 | Per-lot | 4.3元/手 | **0元** | Close-today free | +| SA | 纯碱 | Per-turnover | 万分之2 | Up to 万分之4 | Close-today can be 2x open | + +### Daily Trading Limits (交易限额) + + +| Product | Daily opening limit | +|---------|-------------------| +| TA (PTA) | 30,000 lots/day | +| MA (Methanol) | 25,000 lots/day | +| CF (Cotton) | 10,000 lots/day | + +Per contract, per account. Hedging and market maker exempt. + +### Order Submission Fees (申报费) + + +Since **May 2024**, CZCE implemented 申报费 with OTR-tiered pricing, creating economic disincentives for excessive quoting beyond hard cancel limits. All Chinese exchanges implemented similar fees simultaneously. + +## 6. Position Limits & Margin + +### Position Limits (Representative) + + +| Product | General Month | Near-Delivery | Delivery Month | +|---------|--------------|---------------|----------------| +| TA PTA (OI < 500K) | 50,000 | 10,000 | 5,000 | +| CF Cotton (OI < 200K) | 20,000 | 4,000 | 800 | +| MA Methanol (OI < 300K) | 30,000 | 3,000 | 1,000 | + +For TA: when OI >= 500K, general month limit is 15% of OI. Similar OI-threshold logic applies to CF and MA. + +### Margin System + +CZCE uses a **three-period margin escalation system** varying by product. Unlike SHFE's standard four-tier pattern, CZCE periods and rates are product-specific. + +| Period | Typical Margin | +|--------|---------------| +| General month | Contract minimum (4-8%) | +| Pre-delivery (D-month minus ~15th of prior month) | Elevated (varies) | +| Delivery month | Further elevated | + +SA (Soda Ash) runs **12-17%** effective margin due to extreme volatility. Holiday margin escalation applies -- Spring Festival typically +5-10% across the board. + +## 7. Regulatory Framework + +### Abnormal Trading Thresholds + + +| Rule | Threshold | +|------|-----------| +| Frequent cancellation | >= 500 cancels/contract/day | +| Large cancellation | >= 50 large cancels (>= 800 lots each) | +| Self-trades | >= 5/contract/day | + +**Exemptions:** FOK/FAK auto-cancellations, market orders, stop-loss orders, spread orders, hedging, designated market maker activity. + +**Enforcement escalation:** First violation = phone warning to FCM CRO; second = priority monitoring list; third = position-opening restrictions >= 1 month. + +### Programme Trading Definition + +Since June 2025 CSRC rules: >= 5 instances of placing >= 5 orders within 1 second on the same trading day. + +### State Council 国办发47号 (Sep 30, 2024) + +HFT fee rebates cancelled (取消手续费减收), mandatory programmatic trading reporting, enhanced surveillance of pattern-similar accounts. Implementation via CSRC Programmatic Trading Management Rules effective **October 9, 2025**. + +## 8. Regime Change Database + +| Date | Event | Impact | +|------|-------|--------| +| **2014-12-12** | Night session launched: SR/CF/RM/MA/TA (21:00-23:30) | First CZCE night products | +| ~2015-06-11 | Night session added: OI/FG/ZC | Second batch | +| ~2019 | Night hours shortened 23:30 -> 23:00 | All CZCE night products affected | +| 2019-12-06 | SA (Soda Ash) launched with night session 21:00-23:00 | New product | +| 2020-02-03 to 2020-05-06 | COVID: all night sessions suspended | All exchanges | +| **2023-05** | SHFE/DCE/INE/GFEX add day-session auctions for night products | CZCE did NOT follow | +| **2023-09-15** | PX (对二甲苯) + Caustic Soda (烧碱, SH) launched | Night 21:00-23:00; PX-PTA spread enabled | +| 2023-11 | Daily trading limits introduced (TA 30K, MA 25K, CF 10K) | Per-contract daily caps | +| **2024-05** | 申报费 (order submission fees) with OTR-tiered pricing | All exchanges simultaneously | +| **2024-08-30** | PET Chip (聚酯瓶片) launched | Night 21:00-23:00 | +| 2024-09-30 | State Council 国办发47号 | HFT fee rebates cancelled; mandatory reporting | + +## 9. Failure Modes & Gotchas + +| Issue | Detail | Mitigation | +|-------|--------|------------| +| **3-digit code ambiguity** | CF501 = Jan 2015 or Jan 2025 (decade problem) | Disambiguate from trading calendar; only ~12-18 months listed ahead | +| **TradingDay wrong at night** | Shows current date instead of next trading day | Use SHFE TradingDay as reference; derive from ActionDay + time | +| **Cancel-only window 08:55-08:59** | No day-session auction for night products (unlike SHFE/DCE/INE/GFEX since May 2023) | Do not submit new orders during this window | +| **UpdateMillisec = 0** | No sub-second ordering possible | Interpolate: 000/500/750/875 | +| **AveragePrice direct** | Not scaled by multiplier (unlike all other exchanges) | Do not divide by multiplier | +| **No FOK support** | FOK order type unavailable | Use GFD or IOC alternatives | +| **SA close-today fee 2x** | Soda Ash close-today can be 万分之4 vs 万分之2 open | Factor into intraday cost models | + +## 10. Market Maker Programs + + +| Attribute | Value | +|-----------|-------| +| Rules published | 2019/1 (rev. 2024/4) | +| Futures MM products | **20+** (TA, MA, SR, CF, SA, FG, UR, AP, etc.) | +| Options MM products | **20+** (SR, CF, TA, MA, RM, SA, etc.) | +| Net asset requirement | Per bilateral agreement | + +CZCE has the **broadest product coverage** of any Chinese exchange for market making. Key features: + +- Continuous + response quoting obligations +- Fee discounts and position limit exemptions +- Exempt from abnormal trading designation for frequent quote/cancel +- Tiered management system +- "Active contract continuity" (活跃合约连续化) policy -- MM programs credited with reducing bid-ask spreads on non-main-month contracts + +## 11. Empirical Parameters + + +### Quoted Half-Spreads + +| Product | Tick Size | Typical Price (CNY) | Median Spread (ticks) | Median Half-Spread (bps) | Confidence | +|---------|-----------|--------------------|-----------------------|--------------------------|------------| +| TA (PTA) | 2 CNY/ton | 5,500 | 1 | ~1.8 | Medium | +| SR (Sugar) | 1 CNY/ton | 6,500 | 1 | ~0.8 | Medium | +| CF (Cotton) | 5 CNY/ton | 14,000 | 1 | ~1.8 | Low | +| MA (Methanol) | 1 CNY/ton | 2,500 | 1-2 | ~2-4 | Low | + +Most liquid CZCE products trade at median 1-tick spread during active sessions (large-tick regime where queue priority dominates). + +### Queue Depth + +| Product | Typical L1 Queue (lots) | L1 Queue (CNY notional, approx.) | Queue Half-Life (sec) | +|---------|------------------------|--------------------------------|----------------------| +| TA | 50-200 | ¥0.25-1.2M | 5-15 | + +### Session Effects + +Night sessions show spreads ~10-30% wider than daytime due to lower participation. Night volume is 30-60% lower than day sessions, with queue depths ~50-70% of daytime levels. Opening windows (20:55-21:05, 09:00-09:15) show elevated activity. + +## 12. Primary Sources + +- Rules: https://www.czce.com.cn/cn/flfg/ +- Products: https://www.czce.com.cn/cn/jysj/ +- Fee schedules: https://www.czce.com.cn/cn/jysj/jscs/ +- Market maker rules: https://www.czce.com.cn/cn/flfg/ (做市商管理办法) +- Abnormal trading rules: https://www.czce.com.cn/cn/flfg/ (异常交易管理办法) diff --git a/venue-expert/futures/apac/china/czce/czce.md b/venue-expert/futures/apac/china/czce/czce.md deleted file mode 100644 index 06bea0b..0000000 --- a/venue-expert/futures/apac/china/czce/czce.md +++ /dev/null @@ -1,127 +0,0 @@ -# CZCE - Zhengzhou Commodity Exchange (郑州商品交易所) - -Agricultural products, chemicals. Assumes familiarity with `futures_china.md`. - -## Key Characteristics - -| Attribute | Value | -|-----------|-------| -| Timezone | **CST (UTC+8)** | -| Focus | Agricultural (cotton, sugar), chemicals (PTA, methanol) | -| Night session | Yes (23:00-23:30 end) | -| Contract format | **3-digit year (YMM)** - ambiguous across decades | -| UpdateMillisec | **Always 0** - no sub-second ordering | -| AveragePrice | **Direct** (not scaled by multiplier) | - -## Products - -| Code | Product | Multiplier | Tick | Night | -|------|---------|------------|------|-------| -| CF | Cotton | 5 t | 5 CNY | 23:00 | -| SR | Sugar | 10 t | 1 CNY | 23:00 | -| TA | PTA | 5 t | 2 CNY | 23:00 | -| MA | Methanol | 10 t | 1 CNY | 23:00 | -| FG | Glass | 20 t | 1 CNY | 23:00 | -| OI | Rapeseed Oil | 10 t | 1 CNY | 23:00 | -| RM | Rapeseed Meal | 10 t | 1 CNY | 23:00 | -| ZC | Thermal Coal | 100 t | 0.2 CNY | 23:00 | -| SA | Soda Ash | 20 t | 1 CNY | 23:00 | -| UR | Urea | 20 t | 1 CNY | 23:00 | -| AP | Apple | 10 t | 1 CNY | None | -| CJ | Jujube | 5 t | 5 CNY | None | -| PK | Peanut | 5 t | 2 CNY | None | -| SF | Silicon Ferro | 5 t | 2 CNY | 23:00 | -| SM | Silicon Manganese | 5 t | 2 CNY | 23:00 | -| PF | Staple Fiber | 5 t | 2 CNY | 23:00 | - -## Contract Code Ambiguity - -**Critical:** CZCE uses 3-digit year codes (YMM), creating decade ambiguity: - -```mermaid -flowchart TD - CODE["CF501"] --> Q{What year?} - Q -->|"If parsed in 2015"| Y2015["January 2015"] - Q -->|"If parsed in 2025"| Y2025["January 2025"] - - style Q fill:#f96 -``` - -**Resolution:** Use trading calendar context - if contract is listed/active, disambiguate by current date. - -## UpdateMillisec Always Zero - -CZCE does not populate sub-second timestamps: - -| Exchange | UpdateMillisec | -|----------|----------------| -| SHFE/INE | 0 or 500 | -| DCE | 0-999 | -| CFFEX | 0 or 500 | -| **CZCE** | **Always 0** | - -**Implication:** Cannot determine ordering within same second. For time-series analysis, interpolate: -- First tick of second: 0ms -- Second tick: 500ms -- Pattern: 000, 500, 750, 875, ... (halving intervals) - -## AveragePrice Not Scaled - -**Critical difference from other exchanges:** - -| Exchange | AveragePrice Meaning | -|----------|---------------------| -| SHFE/INE/DCE/CFFEX | VWAP × Multiplier | -| **CZCE** | **True VWAP** (no scaling) | - -```python -def get_vwap(tick, exchange): - if exchange == "CZCE": - return tick.AveragePrice # Direct - else: - return tick.AveragePrice / get_multiplier(tick.InstrumentID) -``` - -## Cancel Window (08:55-08:59) - -Unique CZCE rule for overnight orders: - -```mermaid -gantt - title CZCE Day Session Opening - dateFormat HH:mm - axisFormat %H:%M - - section Night Carryover - Cancel-only window :crit, 08:55, 4m - - section Auction - Day opening auction :08:59, 1m - - section Continuous - Trading begins :09:00, 15m -``` - -During 08:55-08:59, you can **only cancel** unmatched overnight orders, not submit new ones. - -## Position Limits (Representative) - -| Product | General | Near-Delivery | Delivery Month | -|---------|---------|---------------|----------------| -| PTA | 100K (or 15% if OI≤1M) | 20,000 | 5,000 | -| Cotton | 20K (or 10% if OI≤200K) | 6,000 | 2,000 | -| Methanol | 50K | 10,000 | 5,000 | - -## Data Quirks Summary - -| Field | Behavior | Action | -|-------|----------|--------| -| UpdateMillisec | **Always 0** | Interpolate for ordering | -| AveragePrice | **True VWAP** | Use directly (no divide) | -| ActionDay | Correct | Use as-is | -| Contract format | **UPPERCASE + YMM** | Disambiguate decade | - -## Primary Source - -- Rules: https://www.czce.com.cn/cn/flfg/ -- Products: https://www.czce.com.cn/cn/jysj/ diff --git a/venue-expert/futures/apac/china/dce.md b/venue-expert/futures/apac/china/dce.md new file mode 100644 index 0000000..f739586 --- /dev/null +++ b/venue-expert/futures/apac/china/dce.md @@ -0,0 +1,312 @@ +# DCE - Dalian Commodity Exchange (大连商品交易所) + +Ferrous metals, agricultural products. Assumes familiarity with `futures_china.md`. + +## 1. Identity & Products + +| Attribute | Value | +|-----------|-------| +| Timezone | **CST (UTC+8)** | +| Focus | Ferrous (iron ore, coke), agricultural (soybeans, palm) | +| Night session | Yes (21:00-23:00) | +| Stop orders | **Only exchange with native stop orders** | +| Close position | FIFO (先开先平) default | +| ActionDay quirk | **Wrong during night session** | + +Night session rollout proceeded in three waves. DCE was not a first mover — SHFE launched night trading Jul 2013; DCE followed Jul 2014. Hours shortened twice: **02:30 -> 23:30** (2015-05-08), then **23:30 -> 23:00** (2019-03-29). + +| Code | Product | Multiplier | Tick | Night | Night Start | +|------|---------|------------|------|-------|-------------| +| p | Palm Oil | 10 t | 2 CNY | 23:00 | **2014-07-04** | +| j | Coke | 100 t | 0.5 CNY | 23:00 | **2014-07-04** | +| m | Soybean Meal | 10 t | 1 CNY | 23:00 | 2014-12-26 | +| y | Soybean Oil | 10 t | 2 CNY | 23:00 | 2014-12-26 | +| jm | Coking Coal | 60 t | 0.5 CNY | 23:00 | 2014-12-26 | +| i | Iron Ore | 100 t | 0.5 CNY | 23:00 | 2014-12-26 | +| a | Soybean No.1 | 10 t | 1 CNY | 23:00 | — | +| b | Soybean No.2 | 10 t | 1 CNY | 23:00 | — | +| c | Corn | 10 t | 1 CNY | 23:00 | 2019-03-29 | +| cs | Corn Starch | 10 t | 1 CNY | 23:00 | 2019-03-29 | +| l | LLDPE | 5 t | 5 CNY | 23:00 | 2019-03-29 | +| v | PVC | 5 t | 5 CNY | 23:00 | 2019-03-29 | +| pp | Polypropylene | 5 t | 1 CNY | 23:00 | 2019-03-29 | +| eg | Ethylene Glycol | 10 t | 1 CNY | 23:00 | 2019-03-29 | +| eb | Styrene | 5 t | 1 CNY | 23:00 | — | +| pg | LPG | 20 t | 1 CNY | 23:00 | **2020-03-30** | +| jd | Eggs | 10 t | 1 CNY | None | — | +| lh | Live Hog | 16 t | 5 CNY | None | — | + +Contract format: lowercase + YYMM (e.g., `i2501`). + +## 2. Data Characteristics + +| Field | Behavior | Notes | +|-------|----------|-------| +| UpdateMillisec | **Full 0-999 range** | Real ms from matching engine (unique among exchanges) | +| AveragePrice | × Multiplier | Divide by contract multiplier to get true VWAP | +| ActionDay | **Wrong during night** | Shows next biz day (see §9) | +| Contract format | Lowercase + YYMM | e.g., `i2501` | +| L2 depth | 5 levels, 250ms | Earliest L2 adopter among commodity exchanges (~2006) | +| L2 provider | 飞创 DFIT | **Paid** ~¥600-1800/yr (display tier) | +| L2 access | Requires DFIT DataFeed API | Not available via CTP; CTP only provides L1 at 500ms | + +DCE provides variable real millisecond timestamps from its matching engine — SHFE/INE/CFFEX only produce 0 or 500, CZCE always 0. This makes DCE the highest-resolution CTP timestamp source. + +## 3. Data Validation Checklist + +| Check | Rule | Severity | +|-------|------|----------| +| ActionDay night session | ActionDay == TradingDay during night (WRONG) — use UpdateTime | Critical | +| AveragePrice | Divide by contract multiplier before use | High | +| DBL_MAX sentinel | Check for DBL_MAX (1.7976931348623158e+308) in price fields | High | +| UpdateMillisec range | Valid 0-999; values outside range indicate data corruption | Medium | +| TradingDay consistency | TradingDay = next business day during night session (correct) | Info | + +## 4. Order Book Mechanics + +### Stop Orders (Unique to DCE) + +```mermaid +sequenceDiagram + participant Trader + participant DCE + participant Book + + Trader->>DCE: Submit Stop Order
(触发价, 委托价) + Note over DCE: Order held until triggered + DCE-->>Trader: Accepted (not in book) + + Note over Book: Market trades at trigger price + DCE->>Book: Convert to limit order + Book-->>Trader: Fill notification +``` + +**Stop order fields:** +- `StopPrice`: Trigger price (触发价) +- `Price`: Limit price after trigger (委托价) + +DCE is the only Chinese futures exchange supporting native exchange-held stop orders. All other exchanges require client-side stop logic. + +### FIFO Close Position + +DCE uses automatic FIFO (先开先平): + +```mermaid +flowchart LR + subgraph Positions["Open Positions (by time)"] + P1["Day -2: 10 lots"] + P2["Day -1: 5 lots"] + P3["Today: 8 lots"] + end + + CLOSE["Close 12 lots"] --> P1 + P1 -->|"Close 10"| P2 + P2 -->|"Close 2"| DONE[Done] +``` + +No need to specify CloseToday/CloseYesterday — system auto-selects oldest first. + +### Overnight Order Participation + +Unmatched night session orders **automatically participate** in day session auction: + +```mermaid +flowchart LR + NIGHT["Night Order
(unmatched)"] --> AUTO["Auto-entered into
Day Auction 08:55"] + AUTO --> MATCH{Matched?} + MATCH -->|Yes| FILL[Filled] + MATCH -->|No| CONTINUE["Continuous Trading"] +``` + +No action required — orders carry over by default. + +### Call Auction + +| Session | Time | Notes | +|---------|------|-------| +| Night session opening | 20:55-21:00 | Standard for all night products | +| Day session (night products) | 08:55-09:00 | **Added May 2023** — full auction, not cancel-only (unlike CZCE) | +| Day session (day-only products) | 08:55-09:00 | Standard | + +Day-session auction for night products was added simultaneously at SHFE, DCE, INE, and GFEX in May 2023. CZCE remains cancel-only during this window. Market orders excluded from all auctions. + +## 5. Transaction Costs + +| Code | Product | Fee Type | Open/Close | Close-Today | Notes | +|------|---------|----------|-----------|-------------|-------| +| i | Iron Ore | Per-turnover | 万分之1 | 万分之1 | Same rate open/close | +| j | Coke | Per-turnover | 万分之1 | **万分之1.4** | Close-today premium | +| jm | Coking Coal | Per-turnover | 万分之1 | **万分之1.4** | Close-today premium | +| m | Soybean Meal | Per-lot | 1.5元/手 | 1.5元/手 | Flat rate | +| y | Soybean Oil | Per-lot | 2.5元/手 | 2.5元/手 | Flat rate | +| c | Corn | Per-lot | 1.2元/手 | 1.2元/手 | Flat rate | + +Fees are exchange-level minimums. Brokers add surcharges (typically +0.01-1元/手 or +万分之0.1-0.5). DCE actively adjusts fees on specific contract months to manage speculation — check exchange notices before backtesting. + +## 6. Position Limits & Margin + +### Position Limits (Representative) + +| Product | General | Near-Delivery | Delivery Month | +|---------|---------|---------------|----------------| +| Iron Ore (i) | 15,000 (->7,500 from i2512) | 10K->6K->4K | 2,000 | +| Soybean Meal (m, OI<=400K) | 40,000 | 7,500 | 2,500 | +| Soybean Meal (m, OI>400K) | 20% of OI | 7,500 | 2,500 | +| Coke (j, OI<=50K) | 5K (or 10% if OI<=50K) | 300 | 100 | +| Palm Oil (p, OI<=100K) | 10,000 | 1,500 | 500 | + +DCE is **tightening** limits on i/m/p starting from 2025/2026 contracts. Iron ore general month drops from 15,000 to 7,500 for i2512 onward. + +### Effective Margin Rates + +| Product | Contract Min | Current Effective | Notes | +|---------|-------------|-------------------|-------| +| i (Iron Ore) | 5% | **13-15%** | Frequently elevated | +| j (Coke) | 5% | **20%** | Highly elevated (coal policy sensitivity) | +| jm (Coking Coal) | 5% | **15-18%** | Highly elevated | +| m (Soybean Meal) | 5% | 7-10% | Standard | + +Margins escalate in delivery month: 10% at D-month minus 15 trading days, 20% in delivery month. Holiday margin hikes typical (+5-10% before Spring Festival). + +### New Product Types + +DCE launched **monthly average price futures** (月均价期货) for LLDPE/PVC/PP in 2024 Q1. Novel settlement mechanism — requires adjusted backtesting logic. + +## 7. Regulatory Framework + +### Abnormal Trading Thresholds + +| Metric | Threshold | Notes | +|--------|-----------|-------| +| Frequent cancels | >= 500 cancels/contract/day | Per single contract | +| Large cancels | >= 50 large cancels/day | Large = >= 80% of max order size | +| Self-trades | >= 5 self-trades/contract/day | Across own accounts | + +FOK/FAK auto-cancellations do **not** count. Market maker activity exempt. Enforcement: 1st violation = phone warning to FCM CRO; 2nd = priority monitoring list; 3rd = position-opening restriction >= 1 month. + +### ActionDay Anomaly Origin + +The ActionDay bug is **exchange-side behavior**, not a CTP bug. CTP faithfully relays what DCE sends. Confirmed by per-exchange field analysis — SHFE sends correct ActionDay, CZCE sends correct ActionDay, DCE sends wrong ActionDay (= TradingDay). This has persisted across all CTP versions through 6.7.11. + +## 8. Regime Change Database + +### Night Session Rollout + +| Date | Event | +|------|-------| +| **2014-07-04** | Night sessions launch: p (palm oil), j (coke). Hours 21:00-02:30 | +| 2014-12-26 | Expansion: m, y, jm, i. Hours 21:00-02:30 | +| **2015-05-08** | Night hours shortened: **02:30 -> 23:30** | +| **2019-03-29** | Night hours shortened: **23:30 -> 23:00**. New night products: l, v, pp, eg, c, cs | +| 2020-03-30 | pg (LPG) added with night session 21:00-23:00 | + + +### COVID Suspension + +All night sessions suspended **~Feb 3 to May 6, 2020** across all Chinese exchanges. + +### Auction Changes + +| Date | Event | +|------|-------| +| **May 2023** | Day-session call auction added for night products (08:55-09:00, full auction) | + + +### New Products (2024) + +| Date | Product | Notes | +|------|---------|-------| +| 2024 Q1 | Monthly average price futures (LLDPE/PVC/PP) | Novel settlement mechanism | +| 2024 Q4 | Log futures (原木, LG) + options | New data feeds required | +| 2024 Q4 | Egg/corn starch/live hog options | Additional options chains | + + +## 9. Failure Modes & Gotchas + +### ActionDay Bug + +**Critical:** During night session, ActionDay shows next business day, not actual calendar date. + +| Time | TradingDay | ActionDay | Actual Date | +|------|------------|-----------|-------------| +| Mon 21:30 | Tuesday | **Tuesday** (WRONG) | Monday | +| Tue 10:00 | Tuesday | Tuesday | Tuesday | +| Fri 21:30 | Monday | **Monday** (WRONG) | Friday | + +Use `UpdateTime` for actual timestamp, not `ActionDay`. + +### Concrete Example (Fri Jan 30, 2015, 21:02) + +| Exchange | Product | ActionDay | Correct? | +|----------|---------|-----------|----------| +| SHFE | rb1505 | 20150130 (Fri) | Correct | +| DCE | p1505 | **20150202 (Mon)** | WRONG | +| CZCE | TA505 | 20150130 (Fri) | Correct | + +### VNPY Handling + +VNPY ignores ActionDay for DCE and substitutes `datetime.now()`: + +```python +if not data["ActionDay"] or contract.exchange == Exchange.DCE: + date_str = self.current_date # Local system date +else: + date_str = data["ActionDay"] +``` + +Known limitation: midnight boundary risk if tick arrives after local clock crosses midnight. TqSdk normalizes server-side before reaching clients. + +### SimNow Does Not Reproduce + +SimNow uses SHFE convention for all exchanges — the ActionDay bug does **not** appear in simulation. Developers must test against live feeds or recorded DCE data to encounter this. + +## 10. Market Maker Programs + +| Attribute | Value | +|-----------|-------| +| Rules published | 2018/12 (rev. 2020/12) | +| Futures MM products | ~15+ (m, i, c, pg, l, v, pp, eg, eb, etc.) | +| Options MM products | ~10+ (i, l, v, pp, m, c, p, etc.) | +| Net asset requirement | >= RMB 50M | +| Quoting mode | Continuous + response quoting | + +Benefits: fee discounts, position limit exemptions, exemption from abnormal trading designation for frequent quote/cancel, tiered management. DCE expanded market maker coverage to all new options products launched in 2023-2024. + +## 11. Empirical Parameters + +### Spread Estimates + +| Product | Median Spread (ticks) | Median Half-Spread (bps) | Confidence | Source | +|---------|----------------------|--------------------------|------------|--------| +| i (Iron Ore) | 1-2 | ~3-6 | High | Indriawan et al. 2019 | +| m (Soybean Meal) | 1 | ~1.6 | Medium | Estimate, very liquid | +| j (Coke) | 1-2 | ~1.3-2.5 | Low | Estimate | +| jm (Coking Coal) | 1-2 | ~2-4 | Low | Estimate | +| p (Palm Oil) | 1 | ~1.2 | Medium | Xiong & Li 2024 | +| eg (Ethylene Glycol) | 1-2 | ~1.1-2.2 | Low | Estimate | + + +### Queue and Arrival Parameters + +| Product | Typical L1 Queue (lots) | Trade Freq (trades/sec) | Est. Queue Half-Life (sec) | +|---------|------------------------|------------------------|---------------------------| +| i (Iron Ore) | 50-300 | 1.5-5 | 5-15 | + + +### Weibull Fill Time k Parameter + +| Product | Estimated k | Rationale | +|---------|-------------|-----------| +| i (Iron Ore) | 0.75-0.85 | High retail, wide spread regime | +| j (Coke) | 0.75-0.85 | Similar to i (estimated) | +| m (Soybean Meal) | 0.75-0.85 | Very liquid, retail-heavy, clustered flow | + +Sub-exponential (k < 1) reflects order flow clustering. No Chinese futures-specific calibration exists — values scaled from international LOB literature. + +## 12. Primary Sources + +- Rules: https://www.dce.com.cn/dalianshangpin/fgfz/ +- Products: https://www.dce.com.cn/dalianshangpin/sspz/ +- Fee schedule: https://www.dce.com.cn/dalianshangpin/ywfw/jysfw/sxfsb/ +- Abnormal trading rules: https://www.dce.com.cn/dalianshangpin/fgfz/6145685/index.html +- Market maker rules: https://www.dce.com.cn/dalianshangpin/fgfz/ (做市商管理办法) diff --git a/venue-expert/futures/apac/china/dce/dce.md b/venue-expert/futures/apac/china/dce/dce.md deleted file mode 100644 index 90fed57..0000000 --- a/venue-expert/futures/apac/china/dce/dce.md +++ /dev/null @@ -1,124 +0,0 @@ -# DCE - Dalian Commodity Exchange (大连商品交易所) - -Ferrous metals, agricultural products. Assumes familiarity with `futures_china.md`. - -## Key Characteristics - -| Attribute | Value | -|-----------|-------| -| Timezone | **CST (UTC+8)** | -| Focus | Ferrous (iron ore, coke), agricultural (soybeans, palm) | -| Night session | Yes (23:00 end) | -| Stop orders | **Only exchange with native stop orders** | -| Close position | FIFO (先开先平) default | -| ActionDay quirk | **Wrong during night session** | - -## Products - -| Code | Product | Multiplier | Tick | Night | -|------|---------|------------|------|-------| -| i | Iron Ore | 100 t | 0.5 CNY | 23:00 | -| j | Coke | 100 t | 0.5 CNY | 23:00 | -| jm | Coking Coal | 60 t | 0.5 CNY | 23:00 | -| m | Soybean Meal | 10 t | 1 CNY | 23:00 | -| y | Soybean Oil | 10 t | 2 CNY | 23:00 | -| p | Palm Oil | 10 t | 2 CNY | 23:00 | -| a | Soybean No.1 | 10 t | 1 CNY | 23:00 | -| b | Soybean No.2 | 10 t | 1 CNY | 23:00 | -| c | Corn | 10 t | 1 CNY | 23:00 | -| cs | Corn Starch | 10 t | 1 CNY | 23:00 | -| jd | Eggs | 10 t | 1 CNY | None | -| lh | Live Hog | 16 t | 5 CNY | None | -| l | LLDPE | 5 t | 5 CNY | 23:00 | -| v | PVC | 5 t | 5 CNY | 23:00 | -| pp | Polypropylene | 5 t | 1 CNY | 23:00 | -| eg | Ethylene Glycol | 10 t | 1 CNY | 23:00 | -| eb | Styrene | 5 t | 1 CNY | 23:00 | -| pg | LPG | 20 t | 1 CNY | 23:00 | - -## Stop Orders (Unique to DCE) - -```mermaid -sequenceDiagram - participant Trader - participant DCE - participant Book - - Trader->>DCE: Submit Stop Order
(触发价, 委托价) - Note over DCE: Order held until triggered - DCE-->>Trader: Accepted (not in book) - - Note over Book: Market trades at trigger price - DCE->>Book: Convert to limit order - Book-->>Trader: Fill notification -``` - -**Stop order fields:** -- `StopPrice`: Trigger price (触发价) -- `Price`: Limit price after trigger (委托价) - -## FIFO Close Position - -DCE uses automatic FIFO (先开先平): - -```mermaid -flowchart LR - subgraph Positions["Open Positions (by time)"] - P1["Day -2: 10 lots"] - P2["Day -1: 5 lots"] - P3["Today: 8 lots"] - end - - CLOSE["Close 12 lots"] --> P1 - P1 -->|"Close 10"| P2 - P2 -->|"Close 2"| DONE[Done] -``` - -No need to specify CloseToday/CloseYesterday - system auto-selects oldest first. - -## ActionDay Bug - -**Critical:** During night session, ActionDay shows next business day, not actual calendar date. - -| Time | TradingDay | ActionDay | Actual Date | -|------|------------|-----------|-------------| -| Mon 21:30 | Tuesday | **Tuesday** ❌ | Monday | -| Tue 10:00 | Tuesday | Tuesday ✓ | Tuesday | - -Use `UpdateTime` for actual timestamp, not `ActionDay`. - -## Position Limits (Representative) - -| Product | General | Near-Delivery | Delivery Month | -|---------|---------|---------------|----------------| -| Iron Ore | 15,000 | 10K→6K→4K | 2,000 | -| Soybean Meal | 80K (or 20% if OI≤400K) | 7,500 | 2,500 | -| Coke | 5K (or 10% if OI≤50K) | 300 | 100 | - -## Overnight Order Participation - -Unmatched night session orders **automatically participate** in day session auction: - -```mermaid -flowchart LR - NIGHT["Night Order
(unmatched)"] --> AUTO["Auto-entered into
Day Auction 08:55"] - AUTO --> MATCH{Matched?} - MATCH -->|Yes| FILL[Filled] - MATCH -->|No| CONTINUE["Continuous Trading"] -``` - -No action required - orders carry over by default. - -## Data Quirks - -| Field | Behavior | -|-------|----------| -| UpdateMillisec | Full 0-999 range | -| AveragePrice | × Multiplier (divide to get true VWAP) | -| ActionDay | **Wrong during night** (shows next biz day) | -| Contract format | Lowercase + YYMM (e.g., `i2501`) | - -## Primary Source - -- Rules: https://www.dce.com.cn/dalianshangpin/fgfz/ -- Products: https://www.dce.com.cn/dalianshangpin/sspz/ diff --git a/venue-expert/futures/apac/china/futures_china.md b/venue-expert/futures/apac/china/futures_china.md index 22ee07d..cbba362 100644 --- a/venue-expert/futures/apac/china/futures_china.md +++ b/venue-expert/futures/apac/china/futures_china.md @@ -1,10 +1,10 @@ # Chinese Futures Market Structure -Chinese futures operate via CTP (综合交易平台) across five exchanges. Assumes familiarity with futures fundamentals from `futures.md` and APAC context from `futures_apac.md`. +Chinese futures operate via CTP (综合交易平台) across six exchanges. Assumes familiarity with futures fundamentals from `futures.md` and APAC context from `futures_apac.md`. ## Overview -### The Five Exchanges +### The Six Exchanges | Exchange | Chinese Name | Focus | Night Session | Timezone | |----------|--------------|-------|---------------|----------| @@ -13,6 +13,7 @@ Chinese futures operate via CTP (综合交易平台) across five exchanges. Assu | DCE | 大连商品交易所 | Ferrous, agricultural | Yes | CST (UTC+8) | | CZCE | 郑州商品交易所 | Agricultural, chemicals | Yes | CST (UTC+8) | | CFFEX | 中国金融期货交易所 | Index futures, treasury | No | CST (UTC+8) | +| GFEX | 广州期货交易所 | Industrial silicon, lithium | No | CST (UTC+8) | ### Critical Constraints @@ -75,7 +76,24 @@ flowchart LR **Invalid value sentinel:** `DBL_MAX` (1.7976931348623157e+308), not zero. -See `references/specs/ctp_market_data.md` for full specification. +See `references/specs/ctp_market_data.md` [[futures/apac/china/references/specs/ctp_market_data.md|ctp_market_data.md]] for full specification. + +### CTP Timestamp Provenance + +UpdateTime and UpdateMillisec are **exchange-generated** — CTP relays without modification. The data path: Exchange Matching Engine → Exchange Front → 报盘 → FIB Bus → 行情前置 → Client API. + +| Exchange | UpdateMillisec Pattern | Interpretation | +|----------|-----------------------|----------------| +| SHFE | 0 or 500 only | Binary snapshots at 0ms/500ms marks | +| INE | 0 or 500 only | Same platform as SHFE | +| CFFEX | 0 or 500 only | Same binary pattern | +| DCE | Variable 0–999 | Actual ms from matching engine | +| CZCE | Always 0 | Exchange lacks ms resolution | + +If CTP generated timestamps, values would show continuous ms regardless of exchange. The per-exchange patterns **definitively prove** exchange origination. All brokers receive identical timestamps for the same snapshot — CTP is a multi-broker shared system. What differs across brokers is local receipt time. + + +See `references/specs/ctp_versions.md` [[futures/apac/china/references/specs/ctp_versions.md|ctp_versions.md]] for SDK version history. ## Trading Sessions @@ -144,6 +162,37 @@ All exchanges: **Price-time priority (价格优先、时间优先)** **Critical:** No in-place modification. All changes = cancel + new order = **lose queue priority**. +## Auction Algorithm Comparison + +All exchanges use the **Maximum Volume Principle (最大成交量原则)** for call auction price determination. Tie-breaking: closest to previous trading day's settlement price. Core algorithm identical; operational details diverge. + +### Algorithm Steps + +1. Accumulate all limit orders; sort buys high-to-low, sells low-to-high +2. For each candidate price P, compute matchable volume = min(cumulative buys >= P, cumulative sells <= P) +3. Select P* maximizing matchable volume +4. Three conditions: maximum volume; all buys above P* fully filled; all sells below P* fully filled; at P*, at least one side fully fills +5. Tie-breaking: closest to previous settlement price (all exchanges) + +### Inter-Exchange Differences + +| Feature | SHFE/INE | DCE | CZCE | CFFEX | GFEX | +|---------|----------|-----|------|-------|------| +| Opening auction (night products) | 20:55-21:00 | 20:55-21:00 | 20:55-21:00 | N/A (no night) | 20:55-21:00 | +| Opening auction (day-only products) | 08:55-09:00 | 08:55-09:00 | 08:55-09:00 | **09:25-09:30** | 08:55-09:00 | +| Day-session auction for night products | Full auction (since May 2023) | Full auction (since May 2023) | **Cancel-only (08:55-08:59)** | N/A | Full auction (since May 2023) | +| Closing call auction | No | No | No | **Yes (options only, 14:57-15:00)** | No | +| Market orders in auction | Not supported | Excluded | Explicitly excluded | Auto-cancelled | Excluded | + +**CZCE unique limitation:** No day-session call auction for night-session products. 08:55-08:59 allows only cancellation of unfilled night-session orders — no new orders, no re-matching. SHFE, DCE, INE, GFEX all added full day-session auctions in May 2023. + +**CFFEX unique features:** Auction at 09:25-09:30 (not 08:55). Only exchange with closing call auction — stock index options (14:57-15:00), where closing auction price determines settlement price. + +### CTP Behavior During Auction (集合竞价) + +During order-entry phase, bid/ask prices in `CThostFtdcDepthMarketDataField` are **not updated**. At transition to continuous trading, a single tick appears with auction-determined opening price and matched volume. Time priority does not apply for price determination within auction, but applies for allocation at the auction price when one side has excess orders. + + ### SHFE/INE Close Position Requirement Must specify: @@ -202,7 +251,7 @@ Required fields: | Self-trades | ≥5/day/contract | Review → restriction | | HFT classification | ≥300 orders+cancels/sec | Higher fees, reporting | -See `references/regulatory/` for detailed rules. +See per-exchange docs (shfe.md, dce.md, etc.) for detailed regulatory thresholds. ## Settlement and Margin @@ -229,6 +278,57 @@ flowchart TD Failure to meet margin → Forced liquidation (强制平仓) +## Forced Position Reduction (强制减仓) + +Market-wide mechanism that matches losing traders' unfilled limit-price closing orders against profitable counterparties on a pro-rata basis at the limit price, after market close during consecutive limit-move days. Distinct from forced liquidation (强制平仓) which targets individual rule violators. + +### Cross-Exchange Comparison + +| Feature | CFFEX | SHFE | DCE | CZCE | +|---------|-------|------|-----|------| +| Trigger | **2** consecutive limit days | ~5 days (escalation system) | Multiple consecutive | **3** consecutive, then D4 suspended | +| Loss threshold | >=10% (stock index) | >=R1% (per product) | >=5% | >= minimum margin standard | +| Spec/hedge priority | **No distinction** | **Yes** — all spec before hedge | **Yes** — all spec before hedge | **Yes** — all spec (incl. arb) before hedge | +| Profit tiers | 3 tiers (10%/6%/0%) | 4 tiers (R1-based) | 4 tiers (6%/3%/0%/7%) | 4 tiers (price limit multiples) | +| Execution price | Limit price | Limit price | Limit price | Limit price | + +**Allocation:** Proportional within each tier, sequential tier-by-tier. If Tier 1 profitable positions exceed requested closing volume, allocation occurs proportionally within Tier 1. If insufficient, cascades to Tier 2 and beyond. + +**Commodity exchanges (SHFE, DCE, CZCE)** exhaust all profitable speculative positions before touching any hedging positions. CFFEX makes no formal spec/hedge distinction. + +### Forced Reduction vs Forced Liquidation + +| Mechanism | 强制减仓 (Forced Reduction) | 强制平仓 (Forced Liquidation) | +|-----------|---------------------------|------------------------------| +| Target | Entire market (profitable side) | Individual rule violators | +| Trigger | Consecutive limit-move days | Margin shortfall, position limit breach | +| Counterparty | Profitable traders forced to close | Exchange/broker executes close | +| Price | Limit price | Market/limit price | + +### CFFEX Profit Tiers (Stock Index Futures) + +| Tier | Condition | Priority | +|------|-----------|----------| +| Tier 1 | Profit >= 10% of contract value | First to be reduced | +| Tier 2 | Profit >= 6% but < 10% | Second | +| Tier 3 | Profit >= 0% but < 6% | Last | + +### DCE Profit Tiers + +| Tier | Condition | Priority | +|------|-----------|----------| +| Tier 1 | Profit >= 6% of contract value | First | +| Tier 2 | Profit >= 3% but < 6% | Second | +| Tier 3 | Profit >= 0% but < 3% | Third | +| Tier 4 | Profit >= 7% (arb positions) | After spec, before hedge | + +### Historical Invocations + +**Rarely invoked.** During 2015 stock crash, CFFEX did **not** formally trigger forced reduction — cumulative 20% threshold (two consecutive 10% limit days) rarely met after CFFEX narrowed limits to +/-7%. Used margin hikes (40%), volume restrictions (10 lots/day), and punitive fees instead. + +Mechanism originated from the **1996 plywood 9607 incident** at Shanghai Commodity Exchange. Notable non-invocation: 2003 CZCE hard wheat incident where exchange controversially chose alternative measures. + + ### Intraday Fee Structures | Product | Open | Close Today (平今) | @@ -248,7 +348,7 @@ Failure to meet margin → Forced liquidation (强制平仓) 5. **AveragePrice scaling** - Divide by multiplier (except CZCE) 6. **Night replay filtering** - Compare tick time to wall clock -See `references/specs/data_quality_checklist.md` for complete checklist. +See `references/specs/data_quality_checklist.md` [[futures/apac/china/references/specs/data_quality_checklist.md|data_quality_checklist.md]] for complete checklist. ### Exchange-Specific Quirks @@ -260,6 +360,56 @@ See `references/specs/data_quality_checklist.md` for complete checklist. | CZCE | **Always 0** | Correct | Direct | UPPERCASE+**YMM** | | CFFEX | 0/500 | Correct | × Multiplier | UPPERCASE+YYMM | +## L2 Data Architecture + +Standard CTP provides **1-level depth at 500ms** (2 snapshots/sec) to all users via TCP, free. L2 (5-depth) requires exchange-specific feeds or co-location with higher update rates. + +### L2 Availability by Exchange + +| Exchange | L2 Start | Update Rate | Depth | Cost | Provider | +|----------|----------|-------------|-------|------|----------| +| SHFE/INE | ~2018-19; **250ms since Jan 2024** | **250ms** (4/sec) | 5 levels | **Free** at co-location | SHFE direct (UDP multicast) | +| DCE | ~2006 (early adopter) | **250ms** (4/sec) | 5 levels | **Paid** (~CNY 600-1800/yr display) | 飞创 DFIT | +| CZCE | ~2018-2020 | **250ms** (4/sec) | 5 levels | Free on 易盛极星; **paid** elsewhere (~CNY 300-600/yr) | 易盛 Esunny | +| CFFEX | ~2010 | **500ms** (2/sec) | 5 levels | **Paid** (licensed) | 上海金融衍生品研究院 | +| GFEX | Since 2022 launch | **~250ms** (estimated) | 5 levels | **Paid** (~CNY 600/yr) | GFEX direct | + +SHFE's January 2024 upgrade from 500ms to 250ms 5-depth made SHFE/INE the fastest free L2 feed. DCE is the longest-running L2 provider among commodity exchanges. + +### CTP vs Direct Feed Comparison + +| Feature | CTP Standard (TCP) | CTP Multicast (co-lo) | Exchange Direct Feed | +|---------|--------------------|-----------------------|---------------------| +| Depth | **1 level** | **5 levels** (SHFE/INE only) | **5 levels** | +| Update rate | 500ms | 250ms (SHFE/INE) | 250ms (varies) | +| Access | Remote (internet) | Co-location only | Co-location + authorization | +| Cost | Free | Free (SHFE/INE) | Varies by exchange | + +CTP multicast (二代组播行情) config: `bIsUsingUdp=true, bIsMulticast=true` in API. Requires co-location facility. + +For DCE and CZCE L2, must use exchange proprietary DataFeed API (飞创 or 易盛) — not available through CTP. + +### Data Flow Architecture + +``` +Exchange Matching Engine (撮合引擎) — continuous, microsecond-scale + | individual order events processed immediately + v +Market Data Snapshot Generator (行情切片系统) — samples at 250ms or 500ms + | produces best bid/ask, last price, volume snapshot + v +Market Data Dissemination (行情分发系统) — UDP multicast (组播) + | + v +CTP Front-End (CTP前置) — relays snapshots to clients + | + v +Client (客户端/策略服务器) +``` + +The 500ms aggregation occurs at the exchange's snapshot generator layer, not at CTP. No order-by-order or trade-by-trade data exists from Chinese futures exchanges — contrasts with CME (full depth-of-market updates) and Shenzhen Stock Exchange (real-time order-by-order L2). + + ## Queue Position Estimation ### The 500ms Challenge @@ -282,7 +432,7 @@ flowchart LR ### Approach -With 500ms snapshots and ~5% cancellation rate (vs 30% US), use: +With 500ms snapshots and ~20-40% cancellation rate, use: ``` V(n+1) = max(V(n) + p(n) × ΔQ(n), 0) @@ -292,9 +442,9 @@ p(x) = f(V) / [f(V) + f(Q - S - V)] Where f(x) = log(1+x) (conservative) or identity. -**Key insight:** Low cancellation rate + FIFO = simpler models viable than US markets. +**Key insight:** FIFO matching + no native modify (cancel-replace) = cancellation rate inflated but queue dynamics simpler than pro-rata US products. -See `references/models/queue_position.md` for detailed models. +See `references/models/queue_position.md` [[futures/apac/china/references/models/queue_position.md|queue_position.md]] for detailed models. ### Trade Direction Inference @@ -309,7 +459,7 @@ def infer_direction(tick): return 'BUY' if tick.LastPrice > mid else 'SELL' ``` -See `references/models/trade_direction.md` for OI-based decomposition. +See `references/models/trade_direction.md` [[futures/apac/china/references/models/trade_direction.md|trade_direction.md]] for OI-based decomposition. ## Regime Changes @@ -330,9 +480,44 @@ See `references/models/trade_direction.md` for OI-based decomposition. | 2016-01-08 | Circuit breaker suspended (4 days total) | | 2019-04-22 | CFFEX restrictions relaxed (500 contracts) | | 2019-06-14 | 看穿式监管 enforced | -| 2022-08-01 | Futures Law effective | +| 2022-08-01 | Futures and Derivatives Law (期货和衍生品法) effective | +| 2022-07-22 | IM (CSI 1000) futures + options launch at CFFEX | +| 2022-09-02 | QFI access launched — 41 futures/options opened to QFII/RQFII | +| 2022-12-22 | GFEX launches Industrial Silicon (SI) — 6th exchange operational | +| 2023-03-20 | CFFEX reduces 平今 fee to 万分之2.3 (from 万分之3.45) | +| 2023-04-21 | 30Y treasury bond futures (TL) launch — completes 2Y/5Y/10Y/30Y curve | +| 2023-07-21 | GFEX Lithium Carbonate (LC) futures — global first physical lithium | +| 2023-08-18 | INE Shipping Index Europe (EC) — China's first cash-settled commodity futures | +| 2024-09-30 | State Council 国办发47号: HFT fee rebates cancelled, mandatory algo reporting | +| 2025-Q1 | QFI expansion to ~91+ products (from original 41) | +| 2025-Q1 | CSRC Programmatic Trading Rules (期货市场程序化交易管理规定, effective Oct 9, 2025) | + + +### 国办发47号 — Most Important Regime Change for Quant Firms + +The September 30, 2024 State Council document explicitly targets HFT: + +| Measure | Detail | +|---------|--------| +| Fee rebates cancelled | 取消高频交易手续费减收 | +| Mandatory algo reporting | Programme trading must be registered and reported | +| Account surveillance | Enhanced monitoring of 交易行为趋同账户 (converging behavior accounts) | +| Co-location tightened | Seat and colocation management strengthened | -See `references/regime_changes.md` for complete timeline. +Implementation via CSRC Programmatic Trading Management Rules takes effect **October 9, 2025**. Programme trading defined as >=5 instances of placing >=5 orders within 1 second on the same trading day. + +### Product Launch Acceleration Post-Futures Law + +Registration-based listing (注册制) replaced slow approval process. Result: + +| Year | New Products | Notable | +|------|-------------|---------| +| Pre-2022 | 2-4/year typical | Slow approval-based | +| 2023 | ~21 products | TL, LC, EC, AO, BR, PX, SH | +| 2024 | ~15 products | Monthly avg price futures, PS, PET chip | +| Total by end-2024 | ~150 listed | Across all 6 exchanges | + +See `references/regime_changes.md` [[futures/apac/china/references/regime_changes.md|regime_changes.md]] for complete timeline. ## Failure Modes @@ -360,7 +545,7 @@ flowchart TD | Stale data | Tick time vs wall clock | Strategy on bad data | | Limit-locked | LastPrice = Limit + one-sided | Cannot exit position | -See `references/specs/failure_modes.md` for complete catalog. +See `references/specs/failure_modes.md` [[futures/apac/china/references/specs/failure_modes.md|failure_modes.md]] for complete catalog. ## Research Agent Guidance @@ -384,7 +569,7 @@ See `references/specs/failure_modes.md` for complete catalog. - VWAP settlement ≠ close price - different EOD dynamics - Forced liquidation cascades violate independence -See `references/models/causal_analysis.md` for identification framework. +See `references/models/causal_analysis.md` [[futures/apac/china/references/models/causal_analysis.md|causal_analysis.md]] for identification framework. ### post-hoc-analyst - Always check regime change boundaries @@ -412,11 +597,11 @@ See `references/models/causal_analysis.md` for identification framework. ## File Index ### Exchange Files -- `shfe/shfe.md` - SHFE specifics -- `dce/dce.md` - DCE specifics -- `czce/czce.md` - CZCE specifics -- `cffex/cffex.md` - CFFEX specifics -- `ine/ine.md` - INE specifics +- `shfe.md` - SHFE specifics +- `dce.md` - DCE specifics +- `czce.md` - CZCE specifics +- `cffex.md` - CFFEX specifics +- `ine.md` - INE specifics ### Reference Files @@ -527,6 +712,163 @@ RQFII (RMB Qualified Foreign Institutional Investor) was merged into unified QFI | CFFEX index hedging | QFI (only option) | | Broad access | QFI | +## Empirical Parameters + +### Half-Spread Estimates + +Most liquid products trade at median quoted spread of 1 tick — "large-tick" assets where queue priority dominates. + +| Product | Exchange | Tick Size | Typical Price (CNY) | Median Spread (ticks) | Median Half-Spread (bps) | Confidence | Source | +|---------|----------|-----------|--------------------|-----------------------|--------------------------|------------|--------| +| rb (rebar) | SHFE | 1 CNY/ton | 3,500 | 1 | ~1.4 | High | Indriawan et al. 2019 | +| cu (copper) | SHFE | 10 CNY/ton | 75,000 | 1 | ~0.7 | High | Indriawan et al. 2019 | +| al (aluminum) | SHFE | 5 CNY/ton | 20,500 | 1 | ~1.2 | High | Indriawan et al. 2019 | +| i (iron ore) | DCE | 0.5 CNY/ton | 800 | 1-2 | ~3-6 | High | Indriawan et al. 2019 | +| au (gold) | SHFE | 0.02 CNY/g | 620 | 1-2 | ~0.2-0.3 | Medium | Liu et al. 2016 | +| ag (silver) | SHFE | 1 CNY/kg | 7,800 | 1 | ~0.6 | Medium | Estimate | +| IF (CSI 300) | CFFEX | 0.2 pts | 3,800 pts | 1-3 | ~0.3-0.8 | Medium | arXiv:2501.03171 | +| sc (crude oil) | INE | 0.1 CNY/bbl | 550 | 1-2 | ~0.9-1.8 | Medium | Estimate | +| TA (PTA) | CZCE | 2 CNY/ton | 5,500 | 1 | ~1.8 | Medium | Xiong & Li 2024 | +| m (soybean meal) | DCE | 1 CNY/ton | 3,200 | 1 | ~1.6 | Medium | Estimate (very liquid) | + +Half-spread in ticks is the binding parameter, not bps — most products sit at minimum tick constraint during peak liquidity. + +### Spread Percentile Distribution + +| Percentile | Liquid (rb, cu, i, m) | Moderate (ag, sc, TA) | Less Liquid (jm, MA, CF) | +|------------|----------------------|----------------------|--------------------------| +| P25 | 1 tick | 1 tick | 1-2 ticks | +| P50 | 1 tick | 1-2 ticks | 2 ticks | +| P75 | 1-2 ticks | 2 ticks | 2-3 ticks | +| P95 | 2-3 ticks | 3-5 ticks | 4-6 ticks | + +### Session Effects on Spreads + +L-shaped intraday pattern (Liu, Hua & An 2016): widest at open (2-3x normal in first 15-30 min), narrow rapidly, stable mid-session, slight widening near close. Night sessions show spreads **~10-30% wider** than daytime. Afternoon (13:30-15:00) slightly wider than late morning but tighter than opening. + + +### Market Impact + +No Chinese futures calibration exists. Universal square-root law: Impact = alpha * sigma_daily * (V/ADV)^beta, with **beta ~ 0.5** (Bouchaud 2024, Toth et al. 2011). + +| Product Group | Products | Estimated alpha | Rationale | +|---------------|----------|-----------------|-----------| +| Base metals | cu, al, zn, ni | 0.3-0.8 | Most liquid, international benchmarks | +| Precious metals | au, ag | 0.4-0.9 | High liquidity, international price linkage | +| Ferrous chain | rb, i, j, jm | 0.8-1.5 | High retail participation, higher impact per unit | +| Energy | sc | 0.5-1.0 | Moderate liquidity | +| Agricultural/chemical | m, p, TA, MA, SR, CF | 1.0-2.0 | Less liquid, fragmented | +| Financial | IF, T | 0.3-0.6 | Deep order books, institutional | + +Permanent fraction: ~2/3 of peak impact remains (Brokmann et al. 2015). Retail-dominated products (rb, i) may be lower (~50-60% permanent). Night session alpha expected 1.5-3x higher due to reduced liquidity. + + +### Cancel Rate Correction + +The ~5% aggregate cancel rate is **incorrect**. Actual rates: **20-40%**. Shanghai Stock Exchange reported ~23%, Shenzhen ~29% for equities (2018). 开源证券 (2024) found ~30% full cancel + ~10% partial cancel for A-share orders. Chinese futures likely comparable or higher — no native order modification means every price/quantity change is a cancel+replace. + +### Exchange Abnormal Trading Thresholds + +| Exchange | Frequent Cancel Threshold | Large Cancel Threshold | Self-Trade Limit | +|----------|--------------------------|----------------------|-----------------| +| SHFE/INE | >=500 cancels/contract/day | >=50 large cancels (>=300 lots each) | >=5/contract/day | +| DCE | >=500 cancels/contract/day | >=50 large cancels (>=80% max order size) | >=5/contract/day | +| CZCE | >=500 cancels/contract/day | >=50 large cancels (>=800 lots each) | >=5/contract/day | +| CFFEX (index) | >=400 cancels/contract/day | >=100 large cancels (>=80% max size) | >=5/contract/day | +| CFFEX (bond) | >=500 cancels/contract/day | Per published rules | >=5/contract/day | + +FOK/FAK auto-cancellations do **not** count toward thresholds at any exchange. Market orders, stop-loss, spread orders, hedging, and market maker activity are all exempt. Since May 2024, all exchanges implemented 申报费 (order submission fees) with tiered pricing based on OTR. + +### Cancel-to-Trade Ratio Evolution + +| Period | Cancel Rate | Driver | +|--------|------------|--------| +| 2013-2015 | Peak | Pre-regulation; foreign HFT firms (incl. Jump Trading) active | +| 2015-2016 | Sharp drop | 2015 crash; CFFEX restrictions (10 lots/day); regulatory crackdown | +| 2017-2025 | Gradual rise | Domestic quant/algorithmic trading expansion | + +CSRC Programmatic Trading definition (June 2025): >=5 instances of placing >=5 orders within 1 second on same trading day. + +### Enforcement Escalation + +| Violation | Consequence | +|-----------|-------------| +| First | Phone warning to FCM's Chief Risk Officer | +| Second | Client placed on priority monitoring list | +| Third | Position-opening restrictions for >=1 month | +| First (CFFEX index) | Immediate restrictions (post-2015 sensitivity) | + + +### CST Model Parameter Estimates + +No published calibration for Chinese futures. Scaled from Cont-Stoikov-Talreja (2010, Tokyo SE) and Huang/Lehalle/Rosenbaum (2015, Euronext Paris) using observable Chinese futures characteristics. + +| Parameter | rb (Rebar) | cu (Copper) | i (Iron Ore) | IF (CSI 300) | sc (Crude Oil) | TA (PTA) | +|-----------|-----------|-------------|--------------|-------------|---------------|----------| +| theta(1) limit orders/sec at L1 | 5-15 | 2-6 | 4-12 | 3-8 | 2-5 | 3-10 | +| mu market orders/sec | 2-6 | 0.5-2 | 1.5-5 | 1-3 | 0.5-1.5 | 1-4 | +| alpha(1) cancel rate/order/sec | 0.05-0.15 | 0.03-0.10 | 0.05-0.12 | 0.05-0.15 | 0.03-0.08 | 0.04-0.10 | +| lambda/theta at L1 | 0.2-0.5 | 0.15-0.35 | 0.2-0.45 | 0.2-0.4 | 0.15-0.30 | 0.2-0.4 | + +lambda/theta < 1 required for non-degenerate book formation. + +### Rigtorp Model: L1 Queue Depth and Turnover + +| Product | Typical L1 Queue (lots) | L1 Queue (CNY notional, approx.) | Trade Freq (trades/sec) | Est. Queue Half-Life (sec) | +|---------|------------------------|--------------------------------|------------------------|---------------------------| +| rb | 100-500 | CNY 0.3-2.0M | 2-6 | 5-15 | +| cu | 20-80 | CNY 7-32M | 0.5-2 | 10-30 | +| i | 50-300 | CNY 3.5-27M | 1.5-5 | 5-15 | +| IF | 10-50 | CNY 10.5-60M | 1-3 | 3-10 | +| sc | 10-50 | CNY 5-30M | 0.5-1.5 | 15-45 | +| TA | 50-200 | CNY 0.25-1.2M | 1-4 | 5-15 | + +### Volatility Regime Sensitivity + +| Condition | Queue Depth | Trade Arrival | Cancel Rate | Queue Half-Life | +|-----------|-------------|---------------|-------------|-----------------| +| High vol (>1.5x 20d avg) | -30% to -50% | +50% to +100% | Spikes | 2-5 sec | +| Normal | Baseline | Baseline | Baseline | 5-30 sec | +| Low vol (<0.7x avg) | +20% to +40% | -30% to -50% | Stable | 15-60 sec | + +### Snapshot Estimation Methodology + +Given 500ms CTP constraint, parameters estimated indirectly: +- **theta (limit order arrival)**: From positive queue changes — DeltaQ+ = max(Q(t) - Q(t-1) + trades_consumed, 0) / dt +- **mu (market order arrival)**: From trade volume per interval — trades ~ sum(trade_volume) / avg_trade_size / dt +- **alpha (cancel intensity)**: As residual — cancels ~ (theta*dt - net_queue_change - mu*dt) / Q +- **Standard errors**: Bootstrap across 500ms intervals within each day; report cross-day variation + +Fundamental aliasing challenge: queue transitioning 100->120->90->110 between snapshots appears as single +10 change. For rb with ~3 trades/sec, each 500ms window contains 1-2 trades — deconvolution feasible but noisy. Products with >5 events per 500ms require EM algorithms or moment-matching. + + +### Matching Engine Latency + +Exchange matching engines operate at **microsecond scale** (~500us co-location order-to-ack). The 500ms CTP snapshot is deliberate downsampling at the exchange's snapshot generator layer, not a CTP limitation — a 3-4 order of magnitude reduction in temporal granularity. + +| Exchange | Matching Latency | Evidence | L1/L2 Data Rate | +|----------|-----------------|----------|-----------------| +| SHFE/INE | ~500us-2ms | Direct HFT practitioner measurement | 500ms / 250ms (since Jan 2024) | +| CFFEX | Sub-millisecond; +30us added Jul 2024 | Direct measurement | 500ms / 500ms | +| DCE | ~1-2ms | Inferred from co-lo + L2 rates | 500ms / **250ms** | +| CZCE | ~1-2ms | Inferred from co-lo + L2 rates | 500ms / **250ms** | +| GFEX | ~1-2ms (estimated) | Industry norms | 500ms / ~250ms | + +No order-by-order or trade-by-trade data available from Chinese futures exchanges. DCE/CZCE L2 at 250ms provides 2x temporal resolution vs SHFE/CFFEX. + +### International Comparison + +| Exchange | Matching Latency | Market Data Granularity | Co-lo RTT | +|----------|-----------------|------------------------|-----------| +| Chinese futures (SHFE) | ~500us-2ms | **500ms snapshots only** | ~500-800us | +| CME Globex | Sub-millisecond | Real-time order-by-order | ~1-5us | +| Nasdaq | Sub-80us | Real-time full depth | <10us | + +Chinese exchanges have **competitive matching engine speeds** but **dramatically coarser market data dissemination** — a deliberate regulatory choice constraining market-data-dependent strategies. + +In July 2024, exchanges deliberately added latency via fiber extensions: co-located HFT practitioner reported order ack time increased from ~500us to ~800us. CFFEX added only ~30us — meaningless if engine operated at 500ms scale. + + ## Gotchas ### Data Gotchas diff --git a/venue-expert/futures/apac/china/gfex.md b/venue-expert/futures/apac/china/gfex.md new file mode 100644 index 0000000..fd6ba0f --- /dev/null +++ b/venue-expert/futures/apac/china/gfex.md @@ -0,0 +1,225 @@ +# GFEX - Guangzhou Futures Exchange (广州期货交易所) + +China's 6th futures exchange, first mixed-ownership (混合所有制). Green development focus (绿色发展), serving Greater Bay Area (粤港澳大湾区). Assumes familiarity with `futures_china.md`. + +## 1. Identity & Products + +| Attribute | Value | +|-----------|-------| +| Timezone | **CST (UTC+8)** | +| Focus | Green/strategic materials | +| Night session | **No** | +| Ownership | Mixed (混合所有制) — HKEX stake | +| Established | **2021-04-19** | +| CTP close direction | Generic Close (不区分平今/平昨) | + +### Products + +| Code | Product | Unit | Tick Size | Margin | Night | Launch | +|------|---------|------|-----------|--------|-------|--------| +| SI | Industrial Silicon (工业硅) | 5 t/lot | 5 CNY/ton | 10% spec / 9% hedge | No | 2022-12-22 | +| LC | Lithium Carbonate (碳酸锂) | 1 t/lot | 20 CNY/ton | ~8-12% (varies) | No | 2023-07-21 | +| PS | Polysilicon (多晶硅) | 3 t/lot | 5 CNY/ton | 15% | No | 2024-12-26 | +| PT | Platinum (铂) | 1000 g/lot | 0.05 CNY/g | 22% (elevated) | No | 2025-11-27 | +| PD | Palladium (钯) | 1000 g/lot | 0.05 CNY/g | 22% (elevated) | No | 2025-11-27 | + +All products have corresponding **American-style options**. LC designated as **境内特定品种** (specified domestic product) on January 26, 2026 -- open to overseas traders. Pipeline: **carbon emission futures** (碳排放期货), lithium hydroxide (氢氧化锂). + + +## 2. Data Characteristics + +| Field | Behavior | +|-------|----------| +| L2 availability | Since 2022 launch | +| L2 update rate | **~250ms** (estimated) | +| L2 depth | 5 levels | +| L2 cost | **Paid** (~600 CNY/yr) | +| L1 (CTP) | Standard 500ms snapshots | +| Contract format | Lowercase + YYMM (e.g., `si2501`) | +| DBL_MAX sentinel | Fields not yet populated use `DBL_MAX` (~1.7976e+308) | + +CTP timestamp provenance identical to other exchanges -- exchange-generated, CTP passthrough. UpdateMillisec behavior not independently characterized due to short operating history; likely follows SHFE/CFFEX binary pattern (0/500) given shared CTP infrastructure. + + +## 3. Data Validation Checklist + +| Check | Rule | Failure indicates | +|-------|------|-------------------| +| DBL_MAX sentinel | Filter fields ~1.7976e+308 | Field not yet populated for session | +| CTP close direction | Generic Close -- position tracking must account | SHFE/INE logic will mismatch | +| No night session | TradingDay always equals ActionDay | Night-session date anomalies N/A | +| Contract code | Lowercase letters + 4-digit YYMM | Wrong exchange or format error | +| Price vs tick | `(price - basePrice) % tickSize == 0` | Off-tick price, data corruption | +| Margin parameters | Cross-check against exchange notices frequently | Parameters change multiple times/month | + +No night session simplifies TradingDay logic -- no ActionDay/TradingDay divergence to handle. + +## 4. Order Book Mechanics + +### Call Auction Schedule + +| Session | Time | Behavior | +|---------|------|----------| +| Opening auction | **08:55-09:00** | Full call auction (same as commodity exchanges) | +| Night opening | **N/A** | No night session | +| Closing auction | **None** | No closing call auction | + +Price-time priority. Maximum Volume Principle (最大成交量原则) for auction price determination -- identical algorithm to all other Chinese futures exchanges. Market orders excluded from auction. + + +### Close Position Handling + +**Generic Close** (不区分平今/平昨) -- same as DCE, CZCE, CFFEX. Unlike SHFE/INE, GFEX accepts `THOST_FTDC_OF_Close` for all closing regardless of position vintage. CTP reports all closes as generic Close in OnRtnTrade regardless of what was specified. Position tracking systems designed for SHFE/INE must adapt. + +### Order Types + +All orders are limit orders. FOK (Fill-or-Kill) and FAK (Fill-and-Kill / IOC) supported. No native order modification -- cancel + reinsert required. + +## 5. Transaction Costs + +### Fee Structure + +All GFEX fees are **per-turnover** (按成交额/万分之X) -- unlike SHFE/INE which use primarily per-lot. + +| Code | Product | Open/Close | Close-Today | Notes | +|------|---------|-----------|-------------|-------| +| SI | Industrial Silicon | 万分之一 (0.01%) | **Free** (general months) | Close-today free for non-delivery months | +| LC | Lithium Carbonate | 万分之三点二 (0.032%) | Same rate | No close-today discount | +| PS | Polysilicon | 万分之五 (0.05%) | Varies | Higher rate reflecting newer product | + +Per-turnover fees scale with price level. During LC's extreme volatility periods, absolute fee costs varied significantly despite constant percentage rate. + + +## 6. Position Limits & Margin + +### Daily Opening Limits + +GFEX uses **tight daily opening limits** (单日开仓量限制) as primary anti-speculation tool -- notably more aggressive than other exchanges. + +| Product | General Month Position Limit | Daily Opening Limit (Speculative) | Notes | +|---------|----------------------------|----------------------------------|-------| +| SI | 30,000 lots | 2,000-5,000 lots/day | — | +| LC | Similar scale | **400 lots/day** | Extremely tight for an actively traded contract | +| PS | — | 50-500 lots/day | Minimum opening: **10 lots** | + +Limits adjusted **frequently** -- sometimes weekly during volatile periods. Hedging and market making exempt. PS requires **10 lots minimum opening** -- rare among Chinese exchanges. + +### Margin Rates + +| Product | Current Effective | Note | +|---------|-------------------|------| +| SI | 10% spec / 9% hedge | Standard | +| LC | 8-12% | Varies frequently | +| PS | 15% | Higher for newer product | +| PT | **22%** | Elevated -- high uncertainty, new product | +| PD | **22%** | Elevated -- high uncertainty, new product | + +Delivery month margin escalation follows commodity exchange standard pattern. Holiday escalation applies (+5-10% before Spring Festival). Typical broker margins add 3-5% above exchange rates. + + +## 7. Regulatory Framework + +### Ownership Structure + +| Shareholder | Stake | +|-------------|-------| +| SHFE | 15% | +| DCE | 15% | +| CZCE | 15% | +| CFFEX | 15% | +| Ping An Insurance | Minority | +| Guangzhou Financial Holdings | Minority | +| Guangdong Pearl River Investment | Minority | +| **HKEX** | Minority | + +HKEX is the **only non-mainland shareholder** of any Chinese futures exchange. Under CSRC supervision with same regulatory framework as other exchanges. + +### Abnormal Trading Thresholds + +Same framework as other commodity exchanges. Specific thresholds published in GFEX trading rules. Frequent quote/cancel by designated market makers exempt. + +### Programme Trading + +Subject to CSRC Programmatic Trading Management Rules (effective Oct 9, 2025). Same mandatory registration/reporting requirements as all other exchanges. + + +## 8. Regime Change Database + +| Date | Event | Impact | +|------|-------|--------| +| **2021-04-19** | GFEX established | 6th Chinese futures exchange created | +| **2022-12-22** | SI (Industrial Silicon) + options launch | GFEX becomes operational; new data feed required | +| **2023-07-21** | LC (Lithium Carbonate) launch | Global first physically-delivered lithium futures; extreme volatility | +| **2024-07** | LC options launch | Options chain added | +| **2024-12-26** | PS (Polysilicon) + options launch | 3rd GFEX product; no night session | +| **2025-01** | QFI access | First GFEX products opened to foreign investors | +| **2025-11-27** | PT/PD (Platinum/Palladium) launch | Industrial-form delivery (sponge/powder) -- global first | +| **2026-01-26** | LC designated 境内特定品种 | Overseas trader access via QFI/QFII | +| Pipeline | Carbon emission futures (碳排放期货) | Under development; not yet launched | + + +## 9. Failure Modes & Gotchas + +| Issue | Detail | +|-------|--------| +| No night session | No overnight gap management from Asian sessions; miss moves in correlated international markets | +| Parameter change frequency | **Extremely high** -- margins/fees/limits adjusted multiple times per month | +| Daily opening limits | LC at 400 lots/day can block strategy scaling; PS at 50-500 lots/day | +| Generic close direction | Position tracking from SHFE/INE must adapt; CTP reports all closes as generic Close | +| PT/PD elevated margins | 22% -- newer products with high uncertainty; capital requirements 2x typical | +| PS minimum order size | 10 lots minimum opening -- unusual among Chinese exchanges | +| LC extreme volatility | Price swings of 50%+ observed; combined with tight daily limits, can trap positions | +| Regime change frequency | New exchange with frequent rule updates -- monitor GFEX notices daily | +| No closing auction | Final price is last continuous trade, not auction-determined | +| Trading hours | Day session only: 09:00-10:15, 10:30-11:30, 13:30-15:00 | + +GFEX trading rules framework *supports* night sessions ("开展夜盘交易的品种由交易所另行公布") but no products designated yet. Night session launch would be a major regime change. + +## 10. Market Maker Programs + +GFEX market maker rules published **June 2022**. Every new product launched with market maker programs from inception. + +| Dimension | Requirement | +|-----------|-------------| +| Net asset | >= RMB 50M | +| Futures MM products | 5 (SI, LC, PS, PT, PD) | +| Options MM products | 3+ (SI, LC, PS options) | +| Quoting mode | Continuous + response quoting | + +### Market Maker Benefits + +| Benefit | Detail | +|---------|--------| +| Fee discounts | Reduced or waived exchange fees on MM activity | +| Position limit exemptions | Exempt from daily opening limits | +| Cancel threshold exemptions | Frequent quote/cancel not counted as abnormal trading | +| Tiered management | Performance-based tier assignment | + + +## 11. Empirical Parameters + +Limited data -- GFEX products are new (oldest SI launched Dec 2022). + +| Product | Tick Size | Typical Price (CNY) | Spread Estimate | Confidence | Notes | +|---------|-----------|--------------------|--------------------|------------|-------| +| SI | 5 CNY/ton | ~12,000 | 1-2 ticks | Low | Newer MM programs, lower liquidity than mature exchanges | +| LC | 20 CNY/ton | ~70,000-100,000 | 1-3 ticks | Low | Extreme volatility observed (50%+ swings) | +| PS | 5 CNY/ton | ~40,000 | Unknown | Very Low | Launched Dec 2024 | +| PT | 0.05 CNY/g | ~230-280 | Unknown | Very Low | Launched Nov 2025 | +| PD | 0.05 CNY/g | ~200-300 | Unknown | Very Low | Launched Nov 2025 | + +LC exhibited extreme volatility -- noted in research alongside EC (1000->3600) and AO (+77%). No published academic calibrations for any GFEX product. Spreads likely wider than mature exchange products given lower liquidity and newer MM programs. + +Session effects: day-only trading means no night-session spread widening to model, but L-shaped intraday pattern likely applies (widest at 09:00 open, narrowing through session). + + +## 12. Primary Sources + +| Resource | URL | +|----------|-----| +| Rules | http://www.gfex.com.cn | +| Products | http://www.gfex.com.cn | +| Historical data | Available for download (basic, depth, delayed) | +| Market maker rules | GFEX Notice [2022]/6 | +| Fee schedules | Published on GFEX website; updated frequently | +| CSRC supervision | Same framework as all Chinese futures exchanges | diff --git a/venue-expert/futures/apac/china/ine.md b/venue-expert/futures/apac/china/ine.md new file mode 100644 index 0000000..d7691fc --- /dev/null +++ b/venue-expert/futures/apac/china/ine.md @@ -0,0 +1,277 @@ +# INE - Shanghai International Energy Exchange (上海国际能源交易中心) + +Internationalized products for foreign participation. SHFE subsidiary using same SFIT infrastructure. Assumes familiarity with `futures_china.md`. + +## 1. Identity & Products + +| Attribute | Value | +|-----------|-------| +| Timezone | **CST (UTC+8)** | +| Parent | **SHFE subsidiary** (same SFIT/CTP infrastructure) | +| Focus | Internationalized commodities | +| Foreign access | **Direct** (no QFII required for INE products) | +| Pricing | **Net-of-tax** (不含税价格) | +| Night session | Yes (varies by product) | +| Close position | Must specify CloseToday/CloseYesterday (same as SHFE) | +| Contract format | Lowercase + YYMM (e.g., `sc2501`) | + +### Products + +| Code | Product | Launch Date | Multiplier | Tick | Night End | Notes | +|------|---------|-------------|------------|------|-----------|-------| +| sc | Crude Oil (原油) | **2018-03-26** | 1000 bbl | 0.1 CNY | 02:30 | Launched with night session | +| nr | TSR 20 Rubber (20号胶) | **2019-08-12** | 10 t | 5 CNY | 23:00 | Launched with night session | +| lu | Low Sulfur Fuel Oil (低硫燃料油) | **2020-06-22** | 10 t | 1 CNY | 23:00 | Launched with night session | +| bc | Bonded Copper (国际铜) | **2020-11-19** | 5 t | 10 CNY | 01:00 | Launched with night session | +| ec | Shipping Index Europe (集运指数欧线) | **2023-08-18** | 50 CNY | 0.1 pt | None | First cash-settled commodity futures in China | + + +### Foreign Participation + +```mermaid +flowchart TD + subgraph Foreign["Foreign Investor"] + FI[Foreign Institution] + end + subgraph Access["Access Routes"] + OI["Overseas Intermediary
(Recommended)"] + QFI["QFI Route
(Slower)"] + end + subgraph INE["INE Products"] + SC[Crude Oil] + LU[LSFO] + BC[Bonded Copper] + NR[Rubber] + end + FI --> OI + FI --> QFI + OI --> INE + QFI --> INE + style OI fill:#9f9 +``` + +**Overseas Intermediary advantages:** No QFII license required; USD/CNH funding; tax-free trading profits; guaranteed repatriation; setup 1-4 weeks. + +### Cross-Product Relationships + +| INE Product | International Benchmark | Spread Drivers | +|-------------|------------------------|----------------| +| SC | Brent, WTI | Freight, quality, FX | +| BC | LME Copper | Tariff, logistics | +| LU | Singapore LSFO | Shipping demand | + +## 2. Data Characteristics + +Same CTP interface as SHFE (both operated by SFIT). L2 feed identical to SHFE. + +| Feature | Value | +|---------|-------| +| L1 update rate | 500ms (2/sec) via CTP TCP | +| L2 update rate | **250ms (4/sec) since Jan 2024** | +| L2 depth | 5 levels | +| L2 cost | **Free** at co-location (UDP multicast) | +| L2 access | CTP multicast: `bIsUsingUdp=true, bIsMulticast=true` | +| UpdateMillisec | **0 or 500 only** (same as SHFE) | +| AveragePrice | x Multiplier (must divide to get per-unit) | +| ActionDay | Correct (follows SHFE convention, not DCE) | +| TradingDay (night) | Next trading day (correct) | + + +## 3. Data Validation Checklist + +Same validation rules as SHFE: + +| Check | Rule | +|-------|------| +| UpdateMillisec | Must be 0 or 500; reject other values | +| AveragePrice | Divide by contract multiplier to get per-unit average | +| ActionDay | Should equal actual calendar date (correct on INE) | +| DBL_MAX sentinel | Filter fields containing `1.7976931348623157e+308` | +| Price range | Reject prices outside daily limit range | +| Volume monotonicity | Volume must be non-decreasing within session | + +## 4. Order Book Mechanics + +### Close Position Requirement + +Same as SHFE — must specify: +- `'3'` (CloseToday 平今) +- `'4'` (CloseYesterday 平昨) + +Generic Close (`'1'`) is **not supported**. Sending wrong direction causes rejection. + +### Call Auction + +| Session | Time | Notes | +|---------|------|-------| +| Night auction | **20:55-21:00** | Order entry 20:55-20:59, match at 21:00 | +| Day auction | **08:55-09:00** | Full day-session auction since **May 2023** | + +Day-session auction for night-session products added May 2023 (same as SHFE, DCE, GFEX). Maximum Volume Principle (最大成交量原则) with tie-break to previous settlement. Market orders not supported in auction. + + +### Night Session Schedule + +| Band | Products | Hours | +|------|----------|-------| +| 21:00-23:00 | lu, nr | 2h | +| 21:00-01:00 | bc | 4h | +| 21:00-02:30 | sc | 5.5h | + +## 5. Transaction Costs + +| Product | Fee Type | Open | Close | Close-Today | Notes | +|---------|----------|------|-------|-------------|-------| +| sc (Crude Oil) | Per-turnover | 万分之0.05 | 万分之0.05 | 万分之0.05 | Same rate all directions | +| bc (Bonded Copper) | Per-turnover | 万分之0.05 | 万分之0.05 | 万分之0.05 | Same rate all directions | +| nr (TSR 20 Rubber) | Per-lot | 3元/手 | 3元/手 | **0元** | Close-today free | +| lu (LSFO) | Per-lot | 5 CNY | 5 CNY | 5 CNY | | +| ec (Shipping Index) | Per-lot | Varies | Varies | Varies | Check exchange notices | + +Fees are exchange-level minimums. Brokers add surcharges (typically 1-3x exchange rate). Exchange actively adjusts fees on specific contract months — check INE notices before backtesting. + + +## 6. Position Limits & Margin + +### Position Limits + +| Product | Speculative Limit | Notes | +|---------|-------------------|-------| +| sc (Crude Oil) | 500 (general month) | Tightens near delivery | +| bc (Bonded Copper) | 8,000 | Same structure as SHFE | +| lu (LSFO) | 5,000 | | +| nr (TSR 20 Rubber) | 5,000 | | + +### Margin + +| Product | Contract Min | Current Effective | Notes | +|---------|-------------|-------------------|-------| +| sc (Crude Oil) | 5-7% | **10-12%** | Elevated | +| bc (Bonded Copper) | 5% | 8-10% | Standard | +| lu (LSFO) | 5% | 7-10% | Standard | +| nr (TSR 20 Rubber) | 5% | 7-9% | Standard | + +Margins escalate near delivery month (same SHFE pattern: 10% at D-1 month, 15% at delivery month, 20% near last trading day). Holiday surcharges apply (Spring Festival +5-10%). + + +## 7. Regulatory Framework + +### Foreign Access Framework + +INE designed specifically for international participation. Two access routes: + +| Route | Overseas Intermediary | QFI | +|-------|----------------------|-----| +| License required | No | Yes (QFII/RQFII) | +| Funding | USD/CNH | CNY (onshore) | +| Tax on trading profits | Exempt | Subject to withholding | +| Repatriation | Guaranteed | Regulated | +| Setup time | 1-4 weeks | Months | + +### Net-of-Tax Pricing + +INE products priced **excluding VAT**: + +| Aspect | Domestic (SHFE) | International (INE) | +|--------|-----------------|---------------------| +| Price basis | Tax-inclusive | **Net-of-tax** | +| VAT | Included in price | Exempt for bonded delivery | +| Arbitrage | Requires tax adjustment | Direct comparison to global | + +### Bonded Delivery + +```mermaid +flowchart LR + subgraph Bonded["Bonded Zone"] + WH["Bonded Warehouse
(Shanghai/Ningbo)"] + end + subgraph Domestic + DOM["Domestic Market"] + end + subgraph International + INTL["International Market"] + end + WH <-->|"No customs
No VAT"| INTL + WH -->|"Customs + VAT
on withdrawal"| DOM +``` + +Physical delivery in bonded zones enables international arbitrage without customs friction. + +### Abnormal Trading Thresholds + +Same as SHFE: + +| Type | Threshold | +|------|-----------| +| Frequent cancels | >=500 cancels/contract/day | +| Large cancels | >=50 large cancels (>=300 lots each) | +| Self-trades | >=5/contract/day | + +Market maker activity, FOK/FAK auto-cancellations, and hedging trades are exempt. + + +## 8. Regime Change Database + +| Date | Event | Category | Impact | +|------|-------|----------|--------| +| **2018-03-26** | SC crude oil launches (first INE product) | product | China's first internationalized futures | +| **2019-08-12** | NR TSR 20 rubber launches | product | Second INE product | +| **2020-02-03** | Night sessions suspended (COVID-19) | session | All exchanges; restored ~May 6, 2020 | +| **2020-06-22** | LU low sulfur fuel oil launches | product | Third INE product | +| **2020-11-19** | BC bonded copper launches | product | Fourth INE product | +| **2023-05** | Day-session call auction added for night products | structure | Aligns with SHFE/DCE/GFEX change | +| **2023-08-18** | EC shipping index launches | product | First cash-settled commodity futures in China | +| **2024-01** | L2 upgraded to 250ms (with SHFE) | data | From 500ms; free at co-location | +| **2024-09-30** | State Council 国办发47号 | regulation | HFT fee rebates cancelled; programmatic trading reporting | + + +## 9. Failure Modes & Gotchas + +| Issue | Description | Mitigation | +|-------|-------------|------------| +| CloseToday/CloseYesterday | Must specify direction; generic Close rejected | Track position vintage; always send `'3'` or `'4'` | +| SC-Brent arb pricing | INE SC is net-of-tax; direct comparison valid vs Brent but not vs tax-inclusive domestic products | No tax adjustment needed for international arb; adjust for domestic comparisons | +| Net-of-tax vs tax-inclusive | Comparing INE prices to SHFE prices requires VAT adjustment | Apply current VAT rate (13%) when crossing INE/SHFE | +| Night session hours vary | SC ends 02:30, bc 01:00, lu/nr 23:00 | Per-product session management required | +| EC is cash-settled | No physical delivery; different margin/settlement mechanics | Do not apply physical delivery assumptions | +| ActionDay correct | Unlike DCE, INE ActionDay = actual calendar date | Safe to use directly; no DCE-style workaround needed | +| Holiday night session closures | Night session before public holiday is cancelled | Monitor exchange calendar; no pre-holiday night session | + +## 10. Market Maker Programs + +Operates under SHFE framework (same rules published 2018/10, revised 2024/4). + +| Attribute | Value | +|-----------|-------| +| Net asset requirement | >= RMB 50M | +| Futures MM products | sc, lu, EC | +| Options MM products | Crude oil options | +| Quoting mode | Continuous + response | +| Fee incentive | Discounted exchange fees | +| Position limit | Exemption from speculative limits | +| Cancel exemption | Exempt from abnormal trading designation for MM activity | + + +## 11. Empirical Parameters + +Informed priors only — no rigorous Chinese futures microstructure calibrations exist. + +| Parameter | sc (Crude Oil) | Confidence | +|-----------|---------------|------------| +| Tick size | 0.1 CNY/bbl | - | +| Typical price | ~550 CNY | - | +| Median spread | 1-2 ticks (~0.9-1.8 bps) | Medium | +| L1 queue depth | 10-50 lots | Medium | +| Trade frequency | 0.5-1.5 trades/sec | Medium | +| Queue half-life | 15-45 sec | Low | +| Weibull k (fill-time) | 0.80-0.90 | Low | + +Night sessions: 30-60% lower volume, queue depths ~50-70% of daytime, spreads +10-30%. + + +## 12. Primary Sources + +- INE Rules: https://www.ine.cn/bourseService/rules/ +- INE Products: https://www.ine.cn/products/ +- INE Notices: https://www.ine.cn/news/notice/ +- Cross-product analysis: See `references/models/cross_product_analysis.md` [[futures/apac/china/references/models/cross_product_analysis.md|cross_product_analysis.md]] for arbitrage framework diff --git a/venue-expert/futures/apac/china/ine/ine.md b/venue-expert/futures/apac/china/ine/ine.md deleted file mode 100644 index df69341..0000000 --- a/venue-expert/futures/apac/china/ine/ine.md +++ /dev/null @@ -1,161 +0,0 @@ -# INE - Shanghai International Energy Exchange (上海国际能源交易中心) - -Internationalized products for foreign participation. Assumes familiarity with `futures_china.md`. - -## Key Characteristics - -| Attribute | Value | -|-----------|-------| -| Timezone | **CST (UTC+8)** | -| Focus | Internationalized commodities | -| Foreign access | **Direct** (no QFII required) | -| Pricing | **Net-of-tax** (不含税价格) | -| Night session | Yes (varies by product) | -| Close position | Must specify CloseToday/CloseYesterday (like SHFE) | - -## Products - -| Code | Product | Multiplier | Tick | Night End | -|------|---------|------------|------|-----------| -| sc | Crude Oil | 1000 bbl | 0.1 CNY | 02:30 | -| lu | Low Sulfur Fuel Oil | 10 t | 1 CNY | 23:00 | -| bc | Bonded Copper | 5 t | 10 CNY | 01:00 | -| nr | TSR 20 Rubber | 10 t | 5 CNY | 23:00 | -| ec | Shipping Index | 50 CNY | 0.1 pt | None | - -## Foreign Participation - -```mermaid -flowchart TD - subgraph Foreign["Foreign Investor"] - FI[Foreign Institution] - end - - subgraph Access["Access Routes"] - OI["Overseas Intermediary
(Recommended)"] - QFI["QFI Route
(Slower)"] - end - - subgraph INE["INE Products"] - SC[Crude Oil] - LU[LSFO] - BC[Bonded Copper] - NR[Rubber] - end - - FI --> OI - FI --> QFI - OI --> INE - QFI --> INE - - style OI fill:#9f9 -``` - -**Overseas Intermediary advantages:** -- No QFII license required -- USD/CNH funding accepted -- Tax-free trading profits -- Guaranteed repatriation -- Setup: 1-4 weeks - -## Net-of-Tax Pricing - -INE products are priced **excluding VAT**: - -| Aspect | Domestic (SHFE) | International (INE) | -|--------|-----------------|---------------------| -| Price basis | Tax-inclusive | **Net-of-tax** | -| VAT | Included in price | Exempt for bonded delivery | -| Arbitrage | Requires tax adjustment | Direct comparison to global | - -**Implication for SC-Brent arb:** INE crude directly comparable to international benchmarks. - -## Bonded Delivery - -INE products use bonded warehouse delivery: - -```mermaid -flowchart LR - subgraph Bonded["Bonded Zone"] - WH["Bonded Warehouse
(Shanghai/Ningbo)"] - end - - subgraph Domestic - DOM["Domestic Market"] - end - - subgraph International - INTL["International Market"] - end - - WH <-->|"No customs
No VAT"| INTL - WH -->|"Customs + VAT
on withdrawal"| DOM -``` - -Physical delivery occurs in bonded zones, enabling international arbitrage without customs friction. - -## Cross-Product Relationships - -| INE Product | International Benchmark | Spread Drivers | -|-------------|------------------------|----------------| -| SC | Brent, WTI | Freight, quality, FX | -| BC | LME Copper | Tariff, logistics | -| LU | Singapore LSFO | Shipping demand | - -See `references/models/cross_product_analysis.md` for arbitrage framework. - -## Position Limits - -| Product | Speculative | Notes | -|---------|-------------|-------| -| Crude Oil (SC) | 500 (general) | Tightens near delivery | -| Bonded Copper (BC) | 8,000 | Same structure as SHFE | -| LSFO (LU) | 5,000 | | - -## Fee Structure - -| Product | Open | Close | -|---------|------|-------| -| Crude Oil | 20 CNY | 20 CNY | -| LSFO | 5 CNY | 5 CNY | -| Bonded Copper | 0.5/10000 | 0.5/10000 | - -## Close Position Requirement - -Same as SHFE - must specify: -- `'3'` (CloseToday 平今) -- `'4'` (CloseYesterday 平昨) - -## Night Session Schedule - -```mermaid -gantt - title INE Night Session - dateFormat HH:mm - axisFormat %H:%M - - section 23:00 End - LSFO, Rubber :21:00, 2h - - section 01:00 End - Bonded Copper :21:00, 4h - - section 02:30 End - Crude Oil :21:00, 5h30m -``` - -## Data Quirks - -| Field | Behavior | -|-------|----------| -| UpdateMillisec | 0 or 500 | -| AveragePrice | × Multiplier | -| ActionDay | Correct | -| Contract format | Lowercase + YYMM (e.g., `sc2501`) | - -Same CTP interface as SHFE (both operated by SFIT). - -## Primary Source - -- Rules: https://www.ine.cn/bourseService/rules/ -- Products: https://www.ine.cn/products/ diff --git a/venue-expert/futures/apac/china/references/models/causal_analysis.md b/venue-expert/futures/apac/china/references/models/causal_analysis.md index eee253f..93c06c4 100644 --- a/venue-expert/futures/apac/china/references/models/causal_analysis.md +++ b/venue-expert/futures/apac/china/references/models/causal_analysis.md @@ -387,36 +387,9 @@ Every causal claim MUST include: | Time period | Rolling window estimates | Structural break detection | | Measurement error | Bounds from aggregation uncertainty | [β_min, β_max] | -### Oster (2019) Coefficient Stability +### Confounder Sensitivity -For any regression Y = αX + βControls + ε: - -1. Run restricted regression (no controls): Get β̃, R̃² -2. Run full regression (with controls): Get β*, R*² -3. Compute δ: The relative importance of unobservables vs observables needed to explain away β* - -``` -δ = (β* - 0) / (β̃ - β*) × (R_max - R*²) / (R*² - R̃²) -``` - -**Interpretation**: -- δ > 1: Unobservables would need to be more important than observables to explain result -- δ < 1: Moderate unobservables could explain result -- δ < 0: Selection on unobservables likely opposite to observables (strengthens result) - -**Report**: "For the result to be explained by unobserved confounding, unobservables would need to be [δ] times as important as observed controls in explaining variation in [treatment]." - -### E-Value for Treatment Effect Bounds - -For any estimated effect RR (risk ratio or transformed coefficient): - -``` -E-value = RR + sqrt(RR × (RR - 1)) -``` - -**Interpretation**: An unmeasured confounder would need to be associated with both treatment and outcome by a factor of at least E-value to explain away the observed effect. - -**Report**: "An unmeasured confounder would need RR ≥ [E-value] with both [treatment] and [outcome] to reduce the effect to null." +Apply Oster (2019) δ with R_max = min(1, 1.3 × R*²) and E-value (VanderWeele & Ding, 2017) for both point estimate and CI lower bound. See original papers for formulas. ### Aggregation-Specific Sensitivity @@ -474,82 +447,6 @@ Return for more work if: --- -## 8. Common Rejected Claims - -### Claim: "Order flow imbalance predicts returns" - -**Rejection Reason**: Simultaneity. Order flow and returns are jointly determined by information arrival. Without instrument for order flow, this is correlation, not causation. - -```mermaid -flowchart LR - INFO[Information Arrival] --> OFI[Order Flow Imbalance] - INFO --> RET[Returns] - OFI -.->|"Spurious"| RET -``` - -**What Would Change Verdict**: -- IV for order flow that is plausibly exogenous to information -- Natural experiment that shifts order flow without affecting expectations - -### Claim: "High-frequency trading improves price discovery" - -**Rejection Reason**: Selection. HFT enters when prices are most informative. Confounded by information availability. - -```mermaid -flowchart TD - IA[Information Availability] --> HFT[HFT Activity] - IA --> PD[Price Discovery] - HFT -.->|"Spurious?"| PD -``` - -**What Would Change Verdict**: -- Exogenous shock to HFT presence (technology failure, regulatory change) -- RDD at speed threshold - -### Claim: "Large orders have permanent price impact" - -**Rejection Reason**: Aggregation + Information. In 500ms data: -1. "Large order" is sum of many orders (aggregation masks mechanism) -2. Large orders correlate with information (confounded) -3. Cannot distinguish permanent impact from information arrival - -```mermaid -flowchart TD - subgraph Unobserved - O1[Order 1] - O2[Order 2] - On[Order n] - end - - subgraph Observed - LO["'Large Order'
(Aggregated)"] - end - - INFO[Information] --> O1 - INFO --> O2 - INFO --> On - INFO --> PI[Price Impact] - - O1 --> LO - O2 --> LO - On --> LO - LO -.->|"Spurious"| PI -``` - -**What Would Change Verdict**: -- Message-level data (does not exist in China) -- Exogenous large order (e.g., forced liquidation at random threshold) - -### Claim: "Queue position affects fill probability" - -**Rejection Reason**: Cannot observe queue position with snapshot data. Any claim is model-dependent, not identified from data. - -**What Would Change Verdict**: -- Order-by-order data (does not exist in China) -- Natural experiment that randomizes queue position (implausible) - ---- - ## Appendix: Reference DAGs for Common Analyses ### A. Price Impact Analysis @@ -600,10 +497,3 @@ flowchart TD **Identification Approach**: Foreign price can instrument for domestic price if exclusion holds (foreign doesn't directly affect domestic market conditions beyond price). ---- - -**Last Updated**: 2026-01-26 - -**Maintained By**: Causal Analyst - -**Review Required**: Before any mechanism claim is accepted into production strategy diff --git a/venue-expert/futures/apac/china/references/models/cross_product_analysis.md b/venue-expert/futures/apac/china/references/models/cross_product_analysis.md index df44bbf..d164b21 100644 --- a/venue-expert/futures/apac/china/references/models/cross_product_analysis.md +++ b/venue-expert/futures/apac/china/references/models/cross_product_analysis.md @@ -13,7 +13,7 @@ Chinese futures differ fundamentally from US equities (16+ venues, NBBO arbitrag | Copper CU | SHFE | None domestic | | Crude Oil SC | INE | International Brent/WTI (time zone, currency barriers) | | Iron Ore I | DCE | None domestic | -| Stock Index IF | CFFEX | None (no ETF arbitrage due to T+1 stocks) | +| Stock Index IF | CFFEX | Impaired (T+1 underlying stocks, position limits, 10x intraday fees) | **Implications for Research**: 1. No venue fragmentation = no SIP/direct feed latency arb @@ -48,7 +48,7 @@ Economic mechanism: [why this relationship exists] | SC (INE crude) ↔ Brent/WTI | Global crude price discovery | Brent leads SC (time zone) | Yes | | BC (INE bonded copper) ↔ CU (SHFE domestic) | Same underlying, different tax treatment | Cointegrated, basis = tariff + logistics | Yes | | RB (rebar) ↔ I (iron ore) + J (coke) | Production cost relationship | Iron ore/coke lead rebar | Yes | -| IF (index futures) ↔ CSI 300 constituent stocks | Arbitrage relationship | Futures should lead (T+0 vs T+1) | Yes, but friction | +| IF (index futures) ↔ CSI 300 ETF (510300/159919) | Impaired arbitrage (T+1 stocks, position limits, fees) | Futures lead (lower costs, leverage, no short-sale constraint) | Yes, but friction | | Night session ↔ Day session | Information accumulation | Night first 30min predicts | Ma et al. (2022) | ### Statistical Methodology for Basis Trading @@ -156,7 +156,7 @@ Structural breaks: Test at known regulatory change dates ### Lead-Lag with Friction -Standard lead-lag tests (Granger causality) assume frictionless trading. +Economic interpretation of lead-lag tests (Granger causality) as information leadership assumes frictionless arbitrage. With T+1 stocks and T+0 futures: ``` @@ -358,85 +358,7 @@ Requirement: OOS Sharpe > 2.8 to claim real edge --- -## Escalation Protocol - -### When to Invoke Causal Analyst - -Statistical relationship found → STOP → Escalate before claiming tradeable. - -``` -REQUIRED BEFORE TRADING CLAIM: - -1. Statistical validation (this document): - - Pre-registered hypothesis - - Multiple testing correction applied - - OOS validation passed - - Effect size above minimum threshold - -2. Causal validation (causal-analyst): - - Mechanism identified - - Alternative explanations ruled out - - Persistence argument made - - Regime change risk assessed - -Only after BOTH: Claim tradeable to strategist -``` - -### Information to Provide Causal Analyst - -``` -Statistical Handoff Document: - -Relationship: [A] leads [B] by [N] ticks/minutes -Statistical evidence: - - Granger F-stat: X (p = Y, adjusted) - - Information share: Z% - - OOS R²: W% - - Effect magnitude: V bps - -NOT ESTABLISHED: - - Why this relationship exists - - Whether it will persist - - Causal direction - - Alternative explanations - -REQUESTED: Mechanism validation before trading implementation -``` - ---- - -## Research Hypotheses Registry - -### Template for Pre-Registration - -``` -Date: [YYYY-MM-DD] -Researcher: [name] -Hypothesis ID: [CHN-FUTURES-001] - -Statement: -[Exact, falsifiable hypothesis] - -Specification: -- Model: [regression/cointegration/Granger] -- Variables: [list with exact definitions] -- Sample: [date range, products] -- Frequency: [500ms/1min/daily] - -Statistical Design: -- α: [0.01/0.05] -- Correction: [Bonferroni/BH-FDR/Romano-Wolf] -- OOS method: [time-split/walk-forward/CV] -- Minimum effect: [X bps] - -Power Analysis: -- Sample size: [N] -- Detectable effect: [at 80% power] - -Registered before data access: [YES/NO] -``` - -### Active Hypotheses (Examples) +## Active Research Hypotheses | ID | Hypothesis | Status | |----|------------|--------| @@ -462,8 +384,3 @@ Registered before data access: [YES/NO] | Night session | 夜盘 | yèpán | | Day session | 日盘 | rìpán | ---- - -**Document Version**: 1.0 -**Last Updated**: 2025-01-26 -**Requires Approval**: User sign-off on statistical methodology before execution diff --git a/venue-expert/futures/apac/china/references/models/queue_position.md b/venue-expert/futures/apac/china/references/models/queue_position.md index 5569c2a..0973494 100644 --- a/venue-expert/futures/apac/china/references/models/queue_position.md +++ b/venue-expert/futures/apac/china/references/models/queue_position.md @@ -2,6 +2,8 @@ Structural approaches under 500ms snapshot constraints. FIFO matching assumed throughout. +**Causal status**: All estimates below are model-dependent, not identified from data. No order-by-order data exists for Chinese futures. Use pessimistic parameters for execution planning, median for capacity estimation. + --- ## 1. Problem Statement @@ -26,7 +28,7 @@ Probability function (volume decrease affects orders ahead): p = log(1 + V) / log(1 + Q) ``` -**Chinese adaptation** (~5% cancel rate): Attribute ΔQ < 0 primarily to fills (front of queue), not cancels (back of queue). +**Chinese adaptation**: The ~5% aggregate cancel rate cited in earlier versions does not match authoritative sources. Available evidence: SSE ~23%, SZSE ~29% (ScienceDirect 2021), 开源证券 ~30% full + ~10% partial. Chinese futures likely 20-40% due to no native order modification (cancel-replace inflates rate). With r ≈ 0.20-0.40, a larger fraction of ΔQ < 0 must be attributed to cancellations, reducing estimated fill progression. --- @@ -57,9 +59,9 @@ E[e^(-sτ) | Q_0] = (r₁/r₂)^Q₀ Where r₁, r₂ solve: λ_a r² - (λ_a + λ_c + λ_m + s)r + λ_m = 0 -**Chinese simplification** (λ_c ≈ 0.05 × total rate): +**Chinese simplification** (λ_c ≈ 0.20-0.40 × total rate; see research-4.1 Q7): ``` -dQ ≈ λ_a dt - dN(t) (M/M/1 approximation) +dQ ≈ λ_a dt - λ_c dt - dN(t) (cancellation term non-negligible) ``` --- @@ -88,7 +90,7 @@ Position update (per snapshot): ``` V ← max(V - p × (1-r) × |ΔQ|, 0) when ΔQ < 0 ``` -Where r ≈ 0.05 (cancel rate), p = log(1+V)/log(1+Q). +Where r ≈ 0.20-0.40 (cancel rate; see research-4.1 Q7), p = log(1+V)/log(1+Q). Fill probability: ``` @@ -96,6 +98,60 @@ P(fill | V, T) ≈ [1 - exp(-λμT/V)] × k ``` Where λ = trade rate, μ = mean size, k = Weibull shape (adjustment for non-Poisson). +The higher cancel rate (vs previously assumed ~5%) materially reduces estimated fill progression per snapshot. + +--- + +## 6a. Per-Product CST Parameters + +Scaled from Cont-Stoikov-Talreja (2010) benchmarks using observable Chinese futures characteristics. No direct calibration exists. + +| Parameter | rb (Rebar) | cu (Copper) | i (Iron Ore) | IF (CSI 300) | sc (Crude Oil) | TA (PTA) | +|-----------|-----------|-------------|--------------|-------------|---------------|----------| +| θ(1) limit orders/sec at L1 | 5-15 | 2-6 | 4-12 | 3-8 | 2-5 | 3-10 | +| μ market orders/sec | 2-6 | 0.5-2 | 1.5-5 | 1-3 | 0.5-1.5 | 1-4 | +| α(1) cancel rate/order/sec | 0.05-0.15 | 0.03-0.10 | 0.05-0.12 | 0.05-0.15 | 0.03-0.08 | 0.04-0.10 | +| λ/θ at L1 | 0.2-0.5 | 0.15-0.35 | 0.2-0.45 | 0.2-0.4 | 0.15-0.30 | 0.2-0.4 | + +λ/θ < 1 required for non-degenerate book formation. All estimates from international proxies scaled to Chinese market characteristics. + +--- + +## 6b. Fill Probability by Queue Position + +| Queue Position | Estimated Fill Probability | Adverse Selection Cost | +|----------------|--------------------------|----------------------| +| Front 10% | 70-90% (conditional on price not moving away) | Highest | +| Middle 10-50% | 30-60% | Moderate | +| Back 50-100% | 5-25% | Lowest | + +**L1 queue depth and turnover**: + +| Product | Typical L1 Queue (lots) | L1 Queue (CNY notional) | Trade Freq (trades/sec) | Est. Queue Half-Life (sec) | +|---------|------------------------|------------------------|------------------------|---------------------------| +| rb | 100-500 | ¥0.3-2.0M | 2-6 | 5-15 | +| cu | 20-80 | ¥7-32M | 0.5-2 | 10-30 | +| i | 50-300 | ¥3.5-27M | 1.5-5 | 5-15 | +| IF | 10-50 | ¥10.5-60M | 1-3 | 3-10 | +| sc | 10-50 | ¥5-30M | 0.5-1.5 | 15-45 | +| TA | 50-200 | ¥0.25-1.2M | 1-4 | 5-15 | + +Queue depths from practitioner estimates consistent with BBO volume in CTP snapshots. + +--- + +## 6c. Volatility Regime Sensitivity + +Parameters shift materially between regimes. + +| Regime | Queue Depth | Trade Rate | Queue Half-Life | +|--------|------------|-----------|-----------------| +| High vol (realized > 1.5× 20-day avg) | -30-50% | +50-100% | 2-5s | +| Low vol (realized < 0.7× avg) | +20-40% | -30-50% | 15-60s | +| Night session | ~50-70% of daytime | -30-60% volume | Proportionally longer | + +Night session (21:00-23:00/01:00/02:30): volume -30-60%, queue depths ~50-70% of daytime. Cancel rates may be proportionally higher at night due to more aggressive quote management with thinner books. + --- ## 7. Calibration Notes @@ -104,7 +160,7 @@ Where λ = trade rate, μ = mean size, k = Weibull shape (adjustment for non-Poi |-----------|------------| | μ (trade size) | Mean of volume deltas when ΔV > 0 | | λ (trade rate) | Fraction of snapshots with ΔV > 0 | -| r (cancel rate) | ~0.05 (market-wide), or fit residual | +| r (cancel rate) | ~0.20-0.40 (research-4.1 Q7), or fit residual | | k (Weibull) | Fit to inter-trade intervals, expect k ∈ (0.7, 0.9) | **Session effects**: Models invalid during auctions, lock-limit, thin markets. diff --git a/venue-expert/futures/apac/china/references/specs/ctp_versions.md b/venue-expert/futures/apac/china/references/specs/ctp_versions.md new file mode 100644 index 0000000..8f0c979 --- /dev/null +++ b/venue-expert/futures/apac/china/references/specs/ctp_versions.md @@ -0,0 +1,95 @@ +# CTP SDK Version History + +CTP (综合交易平台) developed by SFIT (上海期货信息技术有限公司). No public changelog — reconstructed from community sources (openctp, CSDN, vnpy, PyPI). + +--- + +## Version Table + +| Version | Date (approx) | Key Changes | Breaking? | 看穿式 Status | SimNow | +|---------|--------------|-------------|-----------|--------------|--------| +| 6.3.11 | 2018-01-09 | Pre-穿透式 baseline | N/A | Not supported | Dead after 2019-06-14 | +| 6.3.13 | 2018-11-19 | 穿透式评测版; adds ReqAuthenticate for AppID/AuthCode | Yes (new auth flow) | Evaluation only | Eval only | +| **6.3.15** | **2019-02-20** | **穿透式生产版**; InstrumentID = char[31] | Yes from 6.3.11 | Mandatory | Yes (_se suffix) | +| 6.3.19_P1 | ~2020-04-23 | Fixed Windows采集库 memory leak; CTP_GetDataCollectApiVersion; new error codes | Minor | Full | Yes | +| **6.5.1** | **2020-09-08** | **InstrumentID char[31] to char[81]**; IPv6; ReqQryClassifiedInstrument; UnSubscribeMarketData | **CRITICAL** | Full | Yes | +| 6.6.1_P1 | ~2021 | 8 new SPBM (郑商所组保) query interfaces | Moderate | Full | Yes | +| 6.6.7 | ~2022 early | SPBM updates; OpenSSL optimization; ExchangeID encoding fix | Minor | Full | Yes | +| 6.6.9 | 2022-08-20 | Further SPBM/combination margin updates | Minor | Full | Yes | +| **6.7.0** | ~2023 early | **LZ4 query compression** (~30% bandwidth); 12 new RCAMS/SPBM interfaces | Yes (protocol) | Full | Depends | +| 6.7.1 | ~2023 | Incremental | Minor | Full | Yes | +| 6.7.2 | 2023-09-13 | SHFE SPMM新组保; 4 new query interfaces | Minor | Full | Yes | +| 6.7.7 | ~2024 | Available on PyPI as ctp_python-6.7.7 | Likely minor | Full | Yes | +| 6.7.8 | ~2024 | Incremental | Unknown | Full | Yes | +| 6.7.9 | 2025-02-25 eval / 2025-03-19 prod | Latest confirmed production | Unknown | Full | Yes | +| 6.7.10 | ~2025 | Listed in openctp | Unknown | Full | Yes | +| 6.7.11 | ~2025 | Latest known | Unknown | Full | Yes | + +Versions 6.7.3-6.7.6 appear skipped in public numbering. + +--- + +## The InstrumentID Breaking Change (v6.5.1) + +Single most important struct change in CTP history for binary compatibility. + +| Attribute | Old (v6.3.x) | New (v6.5.1+) | +|-----------|-------------|---------------| +| Typedef | `char TThostFtdcInstrumentIDType[31]` | `char TThostFtdcInstrumentIDType[81]` | +| Build tag | N/A | `6.5.1_20200908` | +| Purpose | Standard instrument codes | DCE long combination option contract codes (组合合约代码) | + +Impact: +- +50 bytes per InstrumentID across dozens of structs +- `CThostFtdcDepthMarketDataField` contains both InstrumentID and ExchangeInstID (both changed), adding ~100 bytes +- Struct sizes: ~440-480 bytes (v6.3.x) to ~540-580 bytes (v6.5.1+) +- Code compiled against v6.3.x headers CANNOT work with v6.5.1+ DLLs +- Evidence: CTPIIMini API V1.5.8 manual from SFIT states "TFtdcInstrumentIDType 由31扩展到81,支持组合合约代码" + +--- + +## API Compatibility Matrix + +| API Version | Min Backend | Max Backend | IPv6 | DCE Long Combo | LZ4 | +|-------------|-----------|-------------|------|---------------|-----| +| v6.3.X | 6.3.X | 6.6.X+ | No | No | No | +| v6.5.X/6.6.X | 6.5.X | 6.7.X+ | Yes | Yes | No | +| v6.7.X | 6.7.X | Current | Yes | Yes | Yes | + +v6.3.X APIs can connect to newer backends but lose newer features. +v6.5.X+ CANNOT connect to v6.3.X backends. + +--- + +## 看穿式监管 Authentication Timeline + +Mandatory enforcement: **June 14, 2019**. + +| Step | Detail | +|------|--------| +| Cutoff date | 2019-06-14 | +| Effect | All non-穿透式 frontends (v6.3.11 and older) taken offline | +| Required flow | `ReqAuthenticate(AppID, AuthCode)` then `ReqUserLogin` | +| SimNow AppID | `simnow_client_test` | +| SimNow AuthCode | `0000000000000000` | + +Skipping ReqAuthenticate results in immediate disconnect on all production frontends post-cutoff. + +--- + +## Three Major Breaking Upgrades + +| Transition | Required Action | Severity | +|-----------|----------------|----------| +| 6.3.11 to 6.3.15 | Add ReqAuthenticate call; use _se suffix DLLs | High | +| 6.3.x to 6.5.1 | Full recompilation; all struct sizes change due to InstrumentID expansion | Critical | +| 6.6.x to 6.7.0 | LZ4 compression protocol; requires broker backend upgrade to 6.7.X | High | + +--- + +## Sources + +| Tag | File | +|-----|------| +| research-5.1 Q5 | research/research-5.1-completed.md | +| research-2 Q9 | research/research-2-completed.md | diff --git a/venue-expert/futures/apac/china/references/specs/failure_modes.md b/venue-expert/futures/apac/china/references/specs/failure_modes.md index 56d8edc..e78af37 100644 --- a/venue-expert/futures/apac/china/references/specs/failure_modes.md +++ b/venue-expert/futures/apac/china/references/specs/failure_modes.md @@ -808,274 +808,4 @@ flowchart TD style K fill:#ccffcc ``` ---- - -## 7. Monitoring Checklist - -### Pre-Session (by 20:30 for night, 08:30 for day) - -- [ ] CTP connection established -- [ ] Authentication successful -- [ ] Settlement confirmed -- [ ] All instruments subscribed -- [ ] Position reconciliation complete -- [ ] Margin adequate (>30% buffer) -- [ ] No contracts entering delivery month without plan -- [ ] AuthCode expiration >30 days away - -### During Session (continuous) - -- [ ] Tick freshness <3s for all subscribed -- [ ] No instruments with 60s+ silence -- [ ] Connection state = connected -- [ ] Order latency <5s P99 -- [ ] Cancel count <400/day/contract (80% of 500 limit) -- [ ] Self-trade count <4/day/contract (80% of 5 limit) -- [ ] Margin utilization <80% -- [ ] No consecutive limit days >1 - -### Post-Session (by 17:00) - -- [ ] All orders filled or cancelled -- [ ] Position reconciliation with broker -- [ ] P&L matches expected (using settlement price) -- [ ] No margin calls pending -- [ ] No regulatory flags from exchange -- [ ] Data gaps documented -- [ ] Auth/subscription state logged - -### Weekly - -- [ ] AuthCode expiration check (>30 days remaining) -- [ ] Review cancel rate trends -- [ ] Review data quality metrics -- [ ] Backup system test -- [ ] Front server latency comparison -- [ ] Exchange notice review (margin changes, rule changes) - -### Monthly - -- [ ] Full disaster recovery test -- [ ] Backup broker connectivity test -- [ ] Position limit compliance audit -- [ ] Abnormal trading pattern review - ---- - -## 8. System Architecture for Resilience - -### 8.1 Recommended Data Flow - -```mermaid -flowchart LR - subgraph Exchanges - SHFE[(SHFE)] - DCE[(DCE)] - CZCE[(CZCE)] - CFFEX[(CFFEX)] - INE[(INE)] - end - - subgraph Primary["Primary CTP Path"] - CTP1[CTP Front 1] - CTP2[CTP Front 2] - CTP3[CTP Front 3] - end - - subgraph Backup["Backup Data Sources"] - TQ[TqSdk] - OC[OpenCTP] - end - - subgraph Processing - MUX[Data Multiplexer] - DEDUP[Deduplication] - VALID[Validation] - STORE[(Time Series DB)] - end - - subgraph Strategy - STRAT[Strategy Engine] - RISK[Risk Manager] - OMS[Order Manager] - end - - Exchanges --> CTP1 & CTP2 & CTP3 - Exchanges --> TQ - CTP1 & CTP2 & CTP3 --> MUX - TQ --> MUX - OC --> MUX - MUX --> DEDUP --> VALID --> STORE - VALID --> STRAT - STRAT <--> RISK - RISK <--> OMS - OMS --> CTP1 -``` - -### 8.2 Failure Detection Points - -```mermaid -flowchart TD - subgraph Detection["Detection Layer"] - CONN[Connection Monitor] - TICK[Tick Freshness] - SUB[Subscription Audit] - MARG[Margin Monitor] - LIMIT[Limit Monitor] - CANCEL[Cancel Rate] - end - - subgraph Thresholds - T1[">3s stale"] - T2["Disconnected"] - T3["80% utilized"] - T5["At limit price"] - T6[">400/day"] - end - - subgraph Actions - A1[Alert] - A2[Pause Trading] - A3[Re-subscribe] - A4[Reduce Position] - A5[Monitor Queue] - A6[Throttle Orders] - end - - TICK --> T1 --> A1 - TICK --> |">30s"| A2 - CONN --> T2 --> A1 - SUB --> T3 --> A3 - MARG --> T4 --> A1 - MARG --> |">95%"| A4 - LIMIT --> T5 --> A5 - CANCEL --> T6 --> A6 -``` - ---- - -## Appendix A: CTP Error Code Quick Reference - -| ErrorID | Constant | Meaning | Severity | -|---------|----------|---------|----------| -| 0 | SUCCESS | No error | Info | -| 3 | INVALID_USER | User ID invalid | Critical | -| 15 | INVALID_BROKER | Broker ID invalid | Critical | -| 22 | DUPLICATE_ORDER_REF | Duplicate order reference | High | -| 25 | ORDER_NOT_FOUND | Cancel target not found | Medium | -| 26 | INSUITABLE_ORDER_STATUS | Already filled/cancelled | Medium | -| 30 | OVER_CLOSE_POSITION | Close exceeds position | High | -| 31 | INSUFFICIENT_MONEY | Insufficient margin | High | -| 53 | SETTLEMENT_NOT_CONFIRMED | Must confirm settlement | High | -| 63 | AUTH_FAILED | Authentication failed | Critical | -| 116 | ORDER_FREQ_LIMIT | Order frequency exceeded | High | - ---- - -## Appendix B: Exchange-Specific Quirks - -### SHFE/INE -- Requires explicit 平今 (close today) vs 平昨 (close yesterday) -- Night session products: 21:00-01:00 or 21:00-02:30 -- Level-2 free via 2nd-gen platform (colo required) - -### DCE -- ActionDay may equal TradingDay during night session (wrong) -- Only exchange with native stop orders -- FIFO close by default - -### CZCE -- UpdateMillisec always 0 - requires interpolation -- 3-digit year codes (CF501 not CF2501) -- TradingDay = same calendar date (different from others) -- Cancellation window 08:55-08:59 for night orders - -### CFFEX -- No night session -- Last hour VWAP for settlement (not full day) -- 15x intraday fee premium on stock index futures -- Self-trade prevention available (since Jan 2024) - ---- - -## Appendix C: Trading Day Boundary - -```mermaid -gantt - title Trading Day Boundary (TradingDay = Monday) - dateFormat HH:mm - axisFormat %H:%M - - section Friday Night - Night Session Start (T-1): milestone, 21:00, 0m - Night Trading: active, 21:00, 330m - - section Saturday - Night End (varies): milestone, 02:30, 0m - - section Monday - Pre-market: 08:55, 5m - Call Auction: 08:59, 1m - AM-1: active, 09:00, 75m - Break: 10:15, 15m - AM-2: active, 10:30, 60m - Lunch: 11:30, 120m - PM: active, 13:30, 90m - Day Close: milestone, 15:00, 0m -``` - -**TradingDay resets at 21:00 Shanghai time (13:00 UTC)** - -Example (Friday): -- Friday 21:00 -> Monday 02:30: TradingDay = Monday -- Monday 09:00 -> Monday 15:00: TradingDay = Monday - -This affects: -- Position limit aggregation -- Cancel rate counting -- Settlement assignment -- Fee calculation - ---- - -## Appendix D: Incident Response Decision Tree - -```mermaid -flowchart TD - START[Incident Detected] --> TYPE{What type?} - - TYPE -->|Connection| CONN{Can reconnect?} - CONN -->|Yes| RESUB[Re-subscribe all] - CONN -->|No| AUTH{Auth issue?} - AUTH -->|Yes| BACKUP[Switch to backup broker] - AUTH -->|No| WAIT[Wait + exponential backoff] - - TYPE -->|Data| DATA{Scope?} - DATA -->|Single instrument| RESUB1[Re-subscribe one] - DATA -->|Exchange-wide| CHECK[Check exchange status] - DATA -->|All| FULL[Full reconnect] - - TYPE -->|Market| MKT{Type?} - MKT -->|Limit lock| MARGIN{Margin OK?} - MARGIN -->|Yes| QUEUE[Queue at limit] - MARGIN -->|No| ADD[Add margin or close] - MKT -->|Halt| WAIT2[Wait for resume] - - TYPE -->|Regulatory| REG[Reduce activity immediately] - - RESUB --> VERIFY[Verify subscription count] - RESUB1 --> VERIFY - FULL --> VERIFY - VERIFY --> RESUME[Resume if OK] - - style START fill:#ffcccc - style RESUME fill:#ccffcc - style BACKUP fill:#ffffcc -``` - ---- -**Document Version**: 1.0 -**Last Updated**: 2026-01-26 -**Based on**: CTP API v6.3.15+, 2022 Futures and Derivatives Law, Exchange rulebooks (SHFE/DCE/CZCE/CFFEX/INE) diff --git a/venue-expert/futures/apac/china/shfe.md b/venue-expert/futures/apac/china/shfe.md new file mode 100644 index 0000000..d0ae3d2 --- /dev/null +++ b/venue-expert/futures/apac/china/shfe.md @@ -0,0 +1,321 @@ +# SHFE - Shanghai Futures Exchange (上海期货交易所) + +Base metals, precious metals, energy, rubber. Assumes familiarity with `futures_china.md`. + +## 1. Identity & Products + +| Attribute | Value | +|-----------|-------| +| Timezone | **CST (UTC+8)** | +| Focus | Metals, energy, rubber | +| Night session | Yes (varies by product) | +| L2 data | Free via UDP multicast (colocation) | +| Close position | **Must specify CloseToday/CloseYesterday** | +| Night trading since | **2013-07-05** (au/ag first) | + +### Products + +| Code | Product | Multiplier | Tick | Night End | Night Start Date | +|------|---------|------------|------|-----------|------------------| +| cu | Copper | 5 t | 10 CNY | 01:00 | 2013-12-30 | +| al | Aluminum | 5 t | 5 CNY | 01:00 | 2013-12-30 | +| zn | Zinc | 5 t | 5 CNY | 01:00 | 2013-12-30 | +| pb | Lead | 5 t | 5 CNY | 01:00 | 2013-12-30 | +| ni | Nickel | 1 t | 10 CNY | 01:00 | 2015-03-27 | +| sn | Tin | 1 t | 10 CNY | 01:00 | 2015-03-27 | +| au | Gold | 1000 g | 0.02 CNY | 02:30 | 2013-07-05 | +| ag | Silver | 15 kg | 1 CNY | 02:30 | 2013-07-05 | +| rb | Rebar | 10 t | 1 CNY | 23:00 | 2014-12-26 | +| hc | Hot Coil | 10 t | 1 CNY | 23:00 | 2014-12-26 | +| ru | Rubber | 10 t | 5 CNY | 23:00 | 2014-12-26 | +| bu | Bitumen | 10 t | 1 CNY | 23:00 | 2014-12-26 | +| fu | Fuel Oil | 10 t | 1 CNY | 23:00 | 2018-07-16 | +| sp | Pulp | 10 t | 2 CNY | 23:00 | 2018-11-27 | +| ss | Stainless | 5 t | 5 CNY | 01:00 | 2019-09-25 | +| AO | Alumina | 20 t | 1 CNY | 01:00 | 2023-06-19 | +| BR | Butadiene Rubber | 5 t | 5 CNY | 23:00 | 2023-07-28 | +| wr | Wire Rod | 10 t | 1 CNY | None | — | + +## 2. Data Characteristics + +| Field | Behavior | +|-------|----------| +| UpdateMillisec | **0 or 500 only** (binary, exchange-generated) | +| AveragePrice | Stored as price × multiplier (divide to get true VWAP) | +| ActionDay | Correct actual calendar day (unlike DCE) | +| Contract format | Lowercase + YYMM (e.g., `cu2501`) | +| DBL_MAX sentinel | Fields not yet populated use `DBL_MAX` (~1.7976e+308) | + +### Level-2 Data Access + +SHFE provides free L2 via UDP multicast to colocated clients. Upgraded from 500ms to **250ms in January 2024**. + +| Feature | L1 (CTP) | L2 (UDP Multicast) | +|---------|----------|-------------------| +| Depth levels | 1 | 5 | +| Update rate | 500ms | **250ms** (since Jan 2024) | +| Access | Any CTP client | Colocation only | +| Cost | Included | Free (colo fee only) | +| CTP config | Default | `bIsUsingUdp=true, bIsMulticast=true` | + +For DCE/CZCE L2, developers must use exchange-proprietary APIs (飞创/易盛). SHFE L2 is the only free 250ms feed among Chinese commodity exchanges. + +## 3. Data Validation Checklist + +| Check | Rule | Failure indicates | +|-------|------|-------------------| +| UpdateMillisec | Must be exactly 0 or 500 | Corrupted/non-SHFE data | +| AveragePrice | Divide by contract multiplier before use | Raw field is price × multiplier | +| ActionDay | Should equal actual calendar date (not TradingDay at night) | Data pipeline error | +| DBL_MAX sentinel | Filter fields ≈ 1.7976e+308 | Field not yet populated for session | +| Contract code | Lowercase letters + 4-digit YYMM | Wrong exchange or format error | +| Price vs tick | `(price - basePrice) % tickSize == 0` | Off-tick price, data corruption | + +## 4. Order Book Mechanics + +### Close Position Requirement + +**Critical:** SHFE requires explicit specification: + +```mermaid +flowchart TD + CLOSE[Close Position Request] --> CHECK{Position Opened Today?} + CHECK -->|Yes| TODAY["CombOffsetFlag = '3'
(CloseToday 平今)"] + CHECK -->|No| YESTERDAY["CombOffsetFlag = '4'
(CloseYesterday 平昨)"] + TODAY --> SUBMIT[Submit Order] + YESTERDAY --> SUBMIT +``` + +Wrong flag → Order rejected (ErrorID 31: "CTP:平今仓位不足" or "CTP:平昨仓位不足") + +### Call Auction Schedule + +| Session | Time | Behavior | +|---------|------|----------| +| Night opening (night products) | **20:55-21:00** | Full call auction | +| Day opening (day-only products) | **08:55-09:00** | Full call auction | +| Day opening (night products) | **08:55-09:00** | Full call auction (since **May 2023**) | +| Closing auction | **None** | SHFE has no closing call auction | + +Pre-May 2023, night-session products had no day-session auction — only cancel-only window. Since May 2023, SHFE (along with DCE, INE, GFEX) added full day-session auctions for night products. CZCE remains cancel-only. + +Market orders are **not supported** in SHFE call auctions. + +### Order Types + +All orders are limit orders. SHFE supports FOK (Fill-or-Kill) and FAK (Fill-and-Kill / IOC). No native order modification — every change requires cancel + re-insert. + +## 5. Transaction Costs + +### Fee Structure + +| Code | Product | Fee Type | Open/Close | Close-Today | Notes | +|------|---------|----------|-----------|-------------|-------| +| au | Gold | Per-lot | 10-20 CNY | **Free** | Active months 20 CNY | +| ag | Silver | Per-turnover | 万分之0.5 | 万分之0.5-2.5 | Active months close-today **5x** | +| cu | Copper | Per-turnover | 万分之0.5 | 万分之0.5 | — | +| al | Aluminum | Per-lot | 3 CNY | **Free** | Close-today free | +| zn | Zinc | Per-lot | 3 CNY | **Free** | Close-today free | +| rb | Rebar | Per-turnover | 万分之1 | 万分之1 | Non-active months 万分之0.2 | +| ni | Nickel | Per-lot | 3 CNY | Varies | Historically elevated surcharges | +| ru | Rubber | Per-lot | 3 CNY | **Free** | Close-today free | + +### Fee Regime Details + +**Non-active month discounts**: rb at 万分之0.2 in non-active months (vs 万分之1 active). Exchanges actively adjust fees on specific contracts to discourage speculation. + +**Close-today free products**: al, zn, ru, au — designed to encourage intraday liquidity without penalizing day-trading. + +**Fee type split**: Base metals mostly per-lot; precious metals and ferrous products mostly per-turnover. Per-turnover fees scale with price level, creating higher absolute costs during rallies. + +## 6. Position Limits & Margin + +### Position Limits (Representative) + +| Product | General | Near-Delivery | Delivery Month | +|---------|---------|---------------|----------------| +| Copper | 8,000 (or 10% OI if OI>=80K) | 3,000 | 1,000 | +| Gold | OI-dependent | 9,000 (client) | 900 | +| Rebar | 90,000 (or 10% OI if OI>=900K) | 4,500 | 900 | +| Rubber | 500 | 150 | 50 | + +### Current Effective Exchange Margins + +| Product | Contract Min | Current Effective | Note | +|---------|-------------|-------------------|------| +| rb | 5% | 7-8% | Standard | +| cu | 5% | 8% | Standard | +| au | 4% | **12-14%** | Elevated due to 2024-25 gold volatility | +| ag | 4% | ~8-10% | — | +| ni | 5% | **12%** | Elevated since 2022 nickel crisis | +| al | 5% | ~7% | Standard | + +Typical broker margins add **3-5%** above exchange rates. + +### Delivery Month Margin Escalation (SHFE Standard Pattern) + +| Period | Margin Rate | +|--------|------------| +| Listing to delivery month -1 month | Contract minimum (4-8%) | +| Delivery month -1 month, 1st trading day | 10% | +| Delivery month, 1st trading day | 15% | +| Last trading day -2 days | 20% | + +### Holiday Margin Escalation + +All exchanges raise margins before major holidays. Spring Festival sees largest increases (typically +5-10% across the board). January 2025: SHFE gold raised to 21%, silver to 22% before Spring Festival. Margins revert after first post-holiday trading day with no limit moves. + +### 2024 Daily Opening Trading Limits + +SHFE imposed **daily opening trading limits** (交易限额) on gold and copper in **April 2024** during price surges. These are distinct from position limits — they cap how many lots a single account can open per day, similar to GFEX's aggressive daily limit mechanism. + +## 7. Regulatory Framework + +### Abnormal Trading Thresholds + +| Metric | Threshold | +|--------|-----------| +| Frequent cancels | **>=500 cancels/contract/day** | +| Large cancels | **>=50 large cancels (>=300 lots each)/day** | +| Self-trades | **>=5/contract/day** | + +**Exemptions**: FOK and FAK auto-cancellations do **not** count toward thresholds. Market maker activity, hedging trades, and spread orders also exempt. + +### Enforcement Escalation + +1. First violation: phone warning to FCM Chief Risk Officer +2. Second: priority monitoring list +3. Third: position-opening restrictions >= 1 month + +### Programme Trading (effective Oct 9, 2025) + +CSRC definition: >=5 instances of placing >=5 orders within 1 second on the same trading day. Mandatory registration and reporting required. HFT fee rebates cancelled per State Council 国办发47号 (Sep 30, 2024). + +## 8. Regime Change Database + +### Night Session Rollout (SHFE) + +| Date | Products Added | +|------|---------------| +| **2013-07-05** | au, ag (first Chinese night session) | +| **2013-12-30** | cu, al, zn, pb | +| **2014-12-26** | rb, hc, bu, ru | +| **2015-03-27** | ni, sn | +| **2018-07-16** | fu | +| **2018-11-27** | sp | +| **2019-09-25** | ss | + +rb/hc/bu launched at 21:00-01:00, later shortened to 21:00-23:00. + +### Key Structural Changes + +| Date | Event | Impact | +|------|-------|--------| +| 2013-07-05 | Night session launch (au/ag) | First Chinese night trading | +| 2020-02-03 to 2020-05-06 | COVID-19 night session suspension | All night sessions halted | +| 2023-05-xx | Day-session auction added for night products | Full 08:55-09:00 auction | +| **2023-06-19** | Alumina (AO) futures launch | Night 21:00-01:00; became highly volatile in 2024 (+77%) | +| **2023-07-28** | Butadiene Rubber (BR) futures + options launch | Night 21:00-23:00 | +| **2024-04** | Daily opening trading limits on gold/copper | New intraday position-opening caps | +| 2024-09-02 | Lead, Nickel, Tin, Alumina options launch | Completes non-ferrous options coverage | +| 2024-09-30 | State Council 国办发47号 | HFT fee rebates cancelled; programmatic trading reporting mandatory | +| 2024-01 | L2 data upgrade to 250ms | Free UDP multicast doubled in frequency | + +## 9. Failure Modes & Gotchas + +### Night Session Schedule + +```mermaid +gantt + title SHFE Night Session End Times + dateFormat HH:mm + axisFormat %H:%M + + section 23:00 + Rubber, Rebar, HotCoil, Bitumen :21:00, 2h + + section 01:00 + Base Metals (Cu,Al,Zn,Pb,Ni,Sn) :21:00, 4h + + section 02:30 + Precious Metals (Au,Ag) :21:00, 5h30m +``` + +### CloseToday/CloseYesterday Wrong Flag + +Most common SHFE-specific error. Wrong CombOffsetFlag produces immediate reject: +- ErrorID 31: `CTP:平今仓位不足` (insufficient close-today position) +- ErrorID 31: `CTP:平昨仓位不足` (insufficient close-yesterday position) + +Systems must track intraday vs historical position separately. Other exchanges (DCE, CZCE, CFFEX, GFEX) accept generic Close flag. + +### Other Gotchas + +| Issue | Detail | +|-------|--------| +| AveragePrice scaling | Raw value is price x multiplier — forgetting to divide gives absurd VWAP | +| DBL_MAX fields | Uninitialized fields appear as ~1.7976e+308; must filter before calculations | +| Night session date logic | TradingDay = next business day; ActionDay = actual calendar date | +| rb/hc night hours changed | Originally 21:00-01:00 at launch (2014-12-26), later shortened to 23:00 | +| No order modification | Every change = cancel + reinsert, inflating cancel counts toward 500/day threshold | +| Contract code case | Always lowercase (cu2501, not CU2501) | + +## 10. Market Maker Programs + +SHFE market maker rules published **October 2018**, revised **April 2024**. + +| Dimension | Requirement | +|-----------|-------------| +| Net asset | >= RMB 50M | +| Futures MM products | ~12 (ni, au, ag, sn, ss, rb, hc, bu, ru, sp, fu, BR) | +| Options MM products | ~9 (cu, al, zn, ni, sn, au, ru, BR, rb) | +| Quoting mode | Continuous + response quoting | + +### Market Maker Benefits + +| Benefit | Detail | +|---------|--------| +| Fee discounts | Reduced or waived exchange fees on MM activity | +| Position limit exemptions | Higher limits for designated products | +| Cancel threshold exemptions | Frequent quote/cancel not counted as abnormal trading | +| Tiered management | Performance-based tier assignment | + +Programs credited with improving non-main-month liquidity and supporting "active contract continuity" (活跃合约连续化) policy. INE products (sc, lu, EC) operate under the same SHFE framework with identical net asset requirements. + +## 11. Empirical Parameters + +### Median Half-Spread Estimates + +| Product | Tick Size | Typical Price (CNY) | Median Spread (ticks) | Half-Spread (bps) | Confidence | Source | +|---------|-----------|--------------------|-----------------------|-------------------|------------|--------| +| cu | 10 CNY/ton | 75,000 | 1 | ~0.7 | High | Indriawan et al. 2019 | +| rb | 1 CNY/ton | 3,500 | 1 | ~1.4 | High | Indriawan et al. 2019 | +| al | 5 CNY/ton | 20,500 | 1 | ~1.2 | High | Indriawan et al. 2019 | +| au | 0.02 CNY/g | 620 | 1-2 | ~0.2-0.3 | Medium | Liu et al. 2016 | +| ag | 1 CNY/kg | 7,800 | 1 | ~0.6 | Medium | Estimate | +| ni | 10 CNY/ton | 130,000 | 1-2 | ~0.4-0.8 | Low | Estimate | + +Most liquid products sit at 1-tick spread during peak sessions — "large-tick" regime where queue priority dominates. + +### L1 Queue Depth Estimates + +| Product | Typical L1 Queue (lots) | Trade Frequency (trades/sec) | Est. Queue Half-Life (sec) | +|---------|------------------------|-----------------------------|-----------------------------| +| rb | 100-500 | 2-6 | 5-15 | +| cu | 20-80 | 0.5-2 | 10-30 | + +### Session Effects + +Night sessions show spreads approximately **10-30% wider** than daytime due to lower participation. L-shaped intraday pattern: widest at open (2-3x normal in first 15-30 min), narrow rapidly, tight through mid-session, slight widening near close. 21:00-21:15 opening window shows largest night-session spreads. + +Night session volume is **30-60% lower** than day session; queue depths approximately **50-70% of daytime levels**. + +## 12. Primary Sources + +- Rules: https://www.shfe.com.cn/regulation/ +- Products: https://www.shfe.com.cn/products/ +- Fee schedules: https://www.shfe.com.cn/bourseService/businessdata/summaryinquiry/ +- Market maker rules: SHFE Notice [2018] (rev. 2024/4) +- Abnormal trading management: SHFE Abnormal Trading Monitoring Guidelines +- Indriawan, Liu & Tse (2019) — spread estimates for cu, rb, al +- Liu, Hua & An (2016) — intraday spread patterns for SHFE metals diff --git a/venue-expert/futures/apac/china/shfe/shfe.md b/venue-expert/futures/apac/china/shfe/shfe.md deleted file mode 100644 index a0bda35..0000000 --- a/venue-expert/futures/apac/china/shfe/shfe.md +++ /dev/null @@ -1,110 +0,0 @@ -# SHFE - Shanghai Futures Exchange (上海期货交易所) - -Base metals, precious metals, energy, rubber. Assumes familiarity with `futures_china.md`. - -## Key Characteristics - -| Attribute | Value | -|-----------|-------| -| Timezone | **CST (UTC+8)** | -| Focus | Metals, energy, rubber | -| Night session | Yes (varies by product) | -| L2 data | Free via UDP multicast (colocation) | -| Close position | **Must specify CloseToday/CloseYesterday** | - -## Products - -| Code | Product | Multiplier | Tick | Night End | -|------|---------|------------|------|-----------| -| cu | Copper | 5 t | 10 CNY | 01:00 | -| al | Aluminum | 5 t | 5 CNY | 01:00 | -| zn | Zinc | 5 t | 5 CNY | 01:00 | -| pb | Lead | 5 t | 5 CNY | 01:00 | -| ni | Nickel | 1 t | 10 CNY | 01:00 | -| sn | Tin | 1 t | 10 CNY | 01:00 | -| au | Gold | 1000 g | 0.02 CNY | 02:30 | -| ag | Silver | 15 kg | 1 CNY | 02:30 | -| rb | Rebar | 10 t | 1 CNY | 23:00 | -| hc | Hot Coil | 10 t | 1 CNY | 23:00 | -| ru | Rubber | 10 t | 5 CNY | 23:00 | -| bu | Bitumen | 10 t | 1 CNY | 23:00 | -| fu | Fuel Oil | 10 t | 1 CNY | 23:00 | -| sp | Pulp | 10 t | 2 CNY | 23:00 | -| ss | Stainless | 5 t | 5 CNY | 01:00 | -| wr | Wire Rod | 10 t | 1 CNY | None | - -## Night Session Schedule - -```mermaid -gantt - title SHFE Night Session End Times - dateFormat HH:mm - axisFormat %H:%M - - section 23:00 - Rubber, Rebar, HotCoil, Bitumen :21:00, 2h - - section 01:00 - Base Metals (Cu,Al,Zn,Pb,Ni,Sn) :21:00, 4h - - section 02:30 - Precious Metals (Au,Ag) :21:00, 5h30m -``` - -## Close Position Requirement - -**Critical:** SHFE requires explicit specification: - -```mermaid -flowchart TD - CLOSE[Close Position Request] --> CHECK{Position Opened Today?} - CHECK -->|Yes| TODAY["CombOffsetFlag = '3'
(CloseToday 平今)"] - CHECK -->|No| YESTERDAY["CombOffsetFlag = '4'
(CloseYesterday 平昨)"] - TODAY --> SUBMIT[Submit Order] - YESTERDAY --> SUBMIT -``` - -Wrong flag → Order rejected (ErrorID 31: "CTP:平今仓位不足" or "CTP:平昨仓位不足") - -## Level-2 Data Access - -SHFE provides free L2 via UDP multicast to colocated clients: - -| Feature | L1 (CTP) | L2 (UDP Multicast) | -|---------|----------|-------------------| -| Depth levels | 5 | 5 | -| Update rate | 500ms | 250ms | -| Access | Any CTP client | Colocation only | -| Cost | Included | Free (colo fee) | - -## Position Limits (Representative) - -| Product | General | Near-Delivery | Delivery Month | -|---------|---------|---------------|----------------| -| Copper | 8,000 (or 10% OI if OI≥80K) | 3,000 | 1,000 | -| Gold | 9,000 | 2,700 | 900 | -| Rebar | 90,000 (or 10% OI if OI≥900K) | 4,500 | 900 | -| Rubber | 500 | 150 | 50 | - -## Fee Structure - -| Product | Open | Close Today | Close Yesterday | -|---------|------|-------------|-----------------| -| Gold | 10 CNY | **Free** | 10 CNY | -| Silver | 0.5/10000 | **1/10000** | 0.5/10000 | -| Copper | 0.5/10000 | varies | 0.5/10000 | -| Rebar | 1/10000 | 1/10000 | 1/10000 | - -## Data Quirks - -| Field | Behavior | -|-------|----------| -| UpdateMillisec | 0 or 500 (binary) | -| AveragePrice | × Multiplier (divide to get true VWAP) | -| ActionDay | Correct (actual calendar day) | -| Contract format | Lowercase + YYMM (e.g., `cu2501`) | - -## Primary Source - -- Rules: https://www.shfe.com.cn/regulation/ -- Products: https://www.shfe.com.cn/products/ diff --git a/venue-expert/futures/apac/futures_apac.md b/venue-expert/futures/apac/futures_apac.md index 56de77f..c1141b4 100644 --- a/venue-expert/futures/apac/futures_apac.md +++ b/venue-expert/futures/apac/futures_apac.md @@ -11,6 +11,7 @@ | CZCE | Agricultural, chemical | Cotton, sugar, methanol, PTA | | CFFEX | Financial | Stock index, treasury futures | | INE | International | Crude oil (Yuan-denominated) | +| GFEX | Industrial materials | Industrial silicon, lithium carbonate | **Note:** China operates separate domestic (CNY) and international (INE) markets with different access rules. diff --git a/venue-expert/futures/apac/sgx.md b/venue-expert/futures/apac/sgx.md new file mode 100644 index 0000000..627a3ba --- /dev/null +++ b/venue-expert/futures/apac/sgx.md @@ -0,0 +1,154 @@ +# SGX Exchange Mechanics + +Assumes familiarity with DCE iron ore from [[futures/apac/china/dce.md|dce.md]]. + +Iron ore derivatives #2 globally (DCE #1 at ~18× volume). International seaborne benchmark for BHP, Rio Tinto, Vale physical pricing. + +## 1. Identity + +| Attribute | Value | +|-----------|-------| +| MIC | **XSES** | +| Location | Singapore | +| Platform | **TITAN** (Nasdaq Genium INET technology) | +| Matching | **Price-time priority** | +| Market data | **ITCH** (MoldUDP64 multicast) | +| Order entry | **OUCH** protocol | +| Co-location | **25 Serangoon North Ave 5, Singapore** | + +## 2. Iron Ore Contract Specifications (FEF) + +| Field | Value | +|-------|-------| +| Symbol | **FEF** (TSI Iron Ore CFR China 62% Fe Fines) | +| Contract size | **100 metric tonnes** | +| Tick size | **$0.01/dmt** ($1.00/contract) | +| Currency | USD | +| Contract months | Up to **36 consecutive months** | +| Settlement | **Cash-settled** against Platts IODEX 62% Fe CFR China | +| Index transition | TSI → **Platts IODEX** (January 2026) | + +### Settlement Index + +| Attribute | Value | +|-----------|-------| +| Index | Platts IODEX 62% Fe CFR China | +| Prior index | TSI Iron Ore (transitioned Jan 2026) | +| Methodology | Daily assessment of seaborne iron ore fines | +| Grade | 62% Fe content | +| Delivery basis | CFR China (cost + freight to Chinese port) | + +## 3. Session Hours (SGT, UTC+8) + +| Session | Hours | Duration | +|---------|-------|----------| +| T Session (Day) | **07:25–19:55** | 12.5 hrs | +| Break | 19:55–20:15 | 20 min | +| T+1 Session (Night) | **20:15–05:15** | 9 hrs | +| **Total** | | **~21.5 hrs/day** | + +### Session vs DCE + +| Attribute | SGX | DCE | +|-----------|-----|-----| +| Total hours | ~21.5 hrs | ~7.5 hrs | +| Night session | 20:15–05:15 SGT | 21:00–23:00 CST | +| Overlap with European trading | Full | Minimal | +| Overlap with US trading | Partial | None | + +## 4. TITAN Platform + +### Technology Stack + +| Component | Technology | +|-----------|-----------| +| Matching engine | **Nasdaq Genium INET** | +| Market data | **ITCH** protocol (MoldUDP64 multicast) | +| Order entry | **OUCH** protocol | +| Book depth | **Full order-by-order** | +| Timestamp precision | **Nanosecond** | + +### Recovery Architecture + +| Method | Transport | Use Case | +|--------|-----------|----------| +| **Rewinder** | UDP unicast | Small gaps (recent missed packets) | +| **GLIMPSE** | TCP snapshot | Full book recovery (join mid-session) | + +### Co-Location Latency + +| Metric | Value | +|--------|-------| +| Exchange-stated round-trip | **<100 μs** | +| Tier-1 firm wire-to-wire | **Sub-15 μs** | +| Location | 25 Serangoon North Ave 5, Singapore | + +### ITCH Compatibility + +SGX ITCH uses MoldUDP64 framing — structurally similar to Nasdaq ITCH but different message types and product definitions. Firms with Nasdaq ITCH parsers can adapt with moderate effort. Key differences: + +| Aspect | SGX ITCH | Nasdaq ITCH 5.0 | +|--------|----------|-----------------| +| Transport | MoldUDP64 | MoldUDP64 | +| Products | Futures, options | Equities | +| Timestamps | Nanosecond | Nanosecond | +| Order entry | OUCH | OUCH | +| Recovery | Rewinder + GLIMPSE | MoldUDP64 retransmit | + +## 5. SGX vs DCE Iron Ore Comparison + +| Metric | SGX FEF | DCE Iron Ore (i) | +|--------|---------|-------------------| +| Daily volume | ~100K–120K contracts | **~2 million contracts** (~18× SGX) | +| Contract size | 100 mt | 100 t | +| Currency | **USD** | CNY | +| Settlement | **Cash** (Platts IODEX) | **Physical delivery** | +| Daily price limit | **None** | **±4%** | +| Trading hours | ~21.5 hrs | ~7.5 hrs | +| Foreign access | **Fully open** | QFII/intermediary required (since May 2018) | +| Position limits | Less restrictive | Aggressive (frequently 500 lots/day near-month) | +| Tick value | $1.00 | ~7 CNY | +| Benchmark role | **International seaborne** | **Chinese domestic** | + +### Price Discovery Dynamics + +| Period | Leader | Mechanism | +|--------|--------|-----------| +| Chinese trading hours (09:00–15:00 CST) | **DCE** | Dominates on volume (~18×) | +| Non-Chinese hours | **SGX** | Only liquid iron ore venue | +| Expiry convergence | Both | Prices converge after adjustments | + +### Adjusted Spread + +Persistent arbitrage opportunity exists between SGX and DCE after adjusting for: + +| Adjustment | Typical Value | +|------------|---------------| +| China VAT | **~13%** | +| Port charges | Variable by port | +| USD/CNY exchange rate | Spot rate | + +The adjusted spread reflects structural differences (cash vs physical, currency, access) rather than pure mispricing. + +## 6. Other Key Products + +| Product | Description | +|---------|-------------| +| Nikkei 225 | Japanese equity index futures | +| MSCI Asia | Asian equity index suite | +| Rubber (RSS3) | Physical delivery | +| Freight | Dry bulk freight derivatives | + +SGX's primary HFT-relevant product is iron ore (FEF). Equity index products are significant but lower-frequency. + +## 7. Gotchas Checklist + +1. **DCE dominates volume (~18×)** but SGX sets the international seaborne benchmark price +2. **Platts IODEX transition from TSI** completed January 2026 — verify settlement index in production +3. **Cash-settled vs DCE physical delivery** — fundamentally different dynamics at expiry +4. **No daily price limits** (vs DCE ±4%) — SGX can gap freely on overnight news +5. **ITCH protocol** — similar parser to Nasdaq but different product definitions and message types +6. **21.5-hour trading** — captures European/US hours where DCE is closed +7. **USD-denominated** — FX risk for CNY-based traders; basis to DCE includes FX component +8. **Rewinder vs GLIMPSE** — use Rewinder for small gaps, GLIMPSE for full recovery; do not mix +9. **Sub-15 μs Tier-1 latency** — exchange quotes <100 μs but best firms achieve much less diff --git a/venue-expert/futures/emea/eurex.md b/venue-expert/futures/emea/eurex.md new file mode 100644 index 0000000..94eabf6 --- /dev/null +++ b/venue-expert/futures/emea/eurex.md @@ -0,0 +1,226 @@ +# Eurex Exchange Mechanics + +T7 platform. Fixed income and equity index futures. EOBI co-location only. Assumes familiarity with CME matching concepts. + +## 1. Identity + +| Attribute | Value | +|-----------|-------| +| Platform | **T7** | +| MIC | **XEUR** | +| Co-location | **Equinix FR2, Frankfurt** | +| Matching | Price-time (FIFO) for most products; Pro-Rata for rates | + +### Product Universe + +| Category | Products | Codes | +|----------|----------|-------| +| FI futures | Euro-Bund, Euro-Bobl, Euro-Schatz, Euro-Buxl, Euro-OAT, Euro-BTP | FGBL, FGBM, FGBS, FGBX, FOAT, FBTP | +| Equity index futures | Euro Stoxx 50, DAX, Mini-DAX | FESX, FDAX, FDXM | +| Rate futures | 3-Month Euribor, Euro STR | FEU3, FST3 | +| Equity/index options | Options on above + ETF options | Various | + +## 2. Market Data: EOBI + +Enhanced Order Book Interface — full Level 3 order-by-order feed. + +### Feed Characteristics + +| Attribute | Value | +|-----------|-------| +| Depth | **No limit** — every visible order at every price level | +| Granularity | Individual order level (L3) | +| Timestamp precision | **Nanosecond** | +| Transport | UDP multicast | +| Availability | **Co-location only (10 Gbit/s)** — NOT available remotely | + +### Message Types + +| Message | Template ID | Description | +|---------|-------------|-------------| +| Order Add | 13100 | New visible order | +| Order Modify | 13101 | Modification with priority loss | +| Order Modify Same Priority | 13106 | Quantity decrease, priority retained | +| Order Delete | 13102 | Order removed | +| Partial Order Execution | 13105 | Individual resting order partial fill | +| Full Order Execution | 13104 | Individual resting order full fill | +| Execution Summary | 13202 | Aggregated match info (sent first) | +| Auction Best Bid/Offer | 13500 | Uncrossed book during auction | +| Auction Clearing Price | 13501 | Crossed book during auction | +| Product State Change | 13300 | Product-level trading phase transition | +| Instrument State Change | 13301 | Instrument-level trading phase transition | + +### Product Coverage + +EOBI available for select benchmark derivatives: +- **FI futures**: FGBL, FGBM, FGBS, FGBX, FOAT, FBTP +- **Equity index**: FESX, FDAX, FDXM +- **All Xetra cash products** + +### Auction Depth Limitation + +During auctions (opening, closing, volatility), EOBI publishes **only**: +- Auction BBO (Template 13500) — uncrossed book +- Auction Clearing Price (Template 13501) — crossed book + +**No depth information during auctions.** Full order-by-order depth resumes only when continuous trading begins. + +### Alternative Feeds + +| Feed | Content | Availability | +|------|---------|-------------| +| EOBI | Full L3, no depth limit, ns timestamps | Co-lo only (10 Gbit/s) | +| EMDI | Aggregated depth + "Top Of Book Implied" | Wider availability | +| MDI | Basic market data | Remote access | + +EMDI separately publishes implied/synthetic top-of-book for IPS matching opportunities — information not available in EOBI. + +## 3. Matching Algorithms + +### Per-Product Algorithm Table + +| Product | Code | Algorithm | Notes | +|---------|------|-----------|-------| +| Euro-Bund | FGBL | **Time (FIFO)** | | +| Euro-Bobl | FGBM | **Time (FIFO)** | | +| Euro-Schatz | FGBS | **Time (FIFO)** | | +| Euro-Buxl | FGBX | **Time (FIFO)** | | +| Euro-OAT | FOAT | **Time (FIFO)** | | +| Euro-BTP | FBTP | **Time (FIFO)** | | +| Euro Stoxx 50 | FESX | **Time (FIFO)** | | +| DAX | FDAX | **Time (FIFO)** | | +| Mini-DAX | FDXM | **Time (FIFO)** | | +| 3-Month Euribor | FEU3 | **Pro-Rata** | Key difference from FI/equity | +| Euro STR | FST3 | **Pro-Rata** | | +| Most equity/index options | — | **Time (FIFO)** | Default | +| Select ETF options (iShares) | — | **Pro-Rata** | | + +### Modify Semantics + +| Action | Queue Position | +|--------|---------------| +| Decrease quantity (price unchanged) | **Retained** (Template 13106) | +| Increase quantity | **Lost** (Template 13101) | +| Change price | **Lost** (Template 13101) | +| Change account | **Lost** | + +Same pattern as CME FIFO and ICE FIFO. + +## 4. Volatility Interruptions + +Dynamic circuit breaker mechanism — triggers when potential execution price exceeds configured thresholds. + +### Trigger Mechanism + +| Parameter | Description | +|-----------|-------------| +| Reference price | Last traded price or auction price | +| Max deviation | Exchange-configured per product | +| Lookback window | Exchange-configured per product | +| Trigger condition | Potential execution price exceeds reference ± max deviation within lookback | + +### Sequence of Events + +1. Triggering order enters the **auction book** (not executed) +2. Prior executions in the same matching cycle **remain valid** (not rolled back) +3. **Non-persistent orders and quotes deleted** from the book +4. **Persistent orders preserved** in the book +5. Instrument moves to **Volatility Auction** state +6. Call phase ends **randomly** after a minimum duration (anti-gaming) +7. If price remains outside extended range: **Market Supervision manually terminates** + +### Order Handling During Volatility Interruption + +| Order Type | Behavior | +|------------|----------| +| Non-persistent orders | **Deleted** | +| Non-persistent quotes | **Deleted** | +| Persistent orders | **Preserved** in auction book | +| New orders during auction | Accepted into auction book | + +## 5. Self-Trade Prevention + +Available since **T7 Release 12.1**. + +### STP Modes + +| Mode | Behavior | +|------|----------| +| Cancel Resting | Cancel the resting order; incoming executes | +| Cancel Incoming | Cancel the incoming order; resting preserved | +| Cancel Both | Cancel both orders; no execution | + +### Restrictions + +| Restriction | Detail | +|-------------|--------| +| Trading phase | **Continuous trading only** — NOT active during auctions | +| Pro-rata products | **Cancel Resting only** — Cancel Incoming and Cancel Both not accepted | +| Matching unit | STP operates within a single matching unit | + +## 6. Session Schedule + +### Trading Hours (CET) + +| Phase | Time | Notes | +|-------|------|-------| +| Pre-trading | **01:00** | Order entry begins | +| Continuous trading start | **01:15** | Asian hours session (since Dec 2018) | +| Continuous trading end | **22:00** | | +| Closing auction | After 22:00 | **≥3 min call with random end** | +| Total continuous | ~20 hrs 45 min | | + +### Timeline + +| Date | Change | +|------|--------| +| Dec 2018 | Asian hours session introduced (01:15 start vs previous ~08:00) | + +## 7. Implied Pricing + +T7 supports synthetic matching between calendar spreads and outright legs. + +### Mechanics + +| Concept | Description | +|---------|-------------| +| Implied-in | Outright order legs fill as part of a spread execution | +| Implied-out | Spread order creates synthetic outright liquidity | +| Direction | Both implied-in and implied-out supported | + +### Key Changes + +| Date | Change | +|------|--------| +| Dec 2020 | **FDAX/FDXM synthetic matching decoupled** | + +### Feed Visibility + +| Feed | Implied Visibility | +|------|-------------------| +| EOBI | **NOT labeled** — implied/synthetic orders indistinguishable from direct; must reconstruct from visible orders | +| EMDI | Separately publishes **"Top Of Book Implied"** for IPS matching | + +This is a critical difference from CME MDP 3.0, where implied entries use distinct MDEntryType values (E/F). + +## 8. Designated Market Makers + +| Attribute | Description | +|-----------|-------------| +| Incentive | Fee discounts | +| Obligations | Continuous quoting requirements | +| Structure | Product-specific bilateral agreements with Eurex | +| Coverage | Selected products (not all) | + +## 9. Gotchas Checklist + +1. **EOBI co-lo only (10 Gbit/s)** — no remote access; must be in Equinix FR2 Frankfurt +2. **Implied prices NOT labeled in EOBI** — must reconstruct from visible orders; use EMDI for implied TOB +3. **Auction depth invisible** — only BBO (13500) or clearing price (13501) published during auctions +4. **Volatility auction random end** — minimum duration + random extension; cannot predict exact timing +5. **Non-persistent orders deleted on volatility interruption** — only persistent orders survive +6. **STP not active during auctions** — self-trades possible during opening/closing/volatility auctions +7. **FDAX/FDXM synthetic decoupled since Dec 2020** — no implied matching between FDAX and FDXM +8. **Pro-rata products: only Cancel Resting STP** — Cancel Incoming and Cancel Both rejected +9. **Asian hours since Dec 2018** — 01:15 CET start captures Asian trading; pre-2018 data has different session structure +10. **EOBI Template IDs are fixed** — unlike CME where template IDs shift between schema versions diff --git a/venue-expert/futures/emea/ice.md b/venue-expert/futures/emea/ice.md new file mode 100644 index 0000000..edd1812 --- /dev/null +++ b/venue-expert/futures/emea/ice.md @@ -0,0 +1,202 @@ +# ICE Futures Europe Mechanics + +Brent crude flagship, softs, European utilities. Matching engine at Basildon, NOT LD4. + +## 1. Identity + +| Attribute | Value | +|-----------|-------| +| Operator | Intercontinental Exchange | +| MIC | **IFEU** | +| Matching engine | **Basildon, Essex — European Liquidity Centre** | +| Flagship | Brent Crude (B) | +| Other products | Gasoil, UK Natural Gas, Dutch TTF, European Power, Robusta Coffee, Cocoa, Sugar | +| Matching | **Pure price-time priority (FIFO)** | + +## 2. Brent Crude Contract Specifications + +| Field | Value | +|-------|-------| +| Symbol | **B** | +| Contract size | **1,000 barrels** | +| Tick size | **$0.01/barrel** ($10/contract/tick) | +| Currency | USD | +| Contract months | Up to **96 consecutive months** (~8 years) | +| Settlement type | EFP-deliverable with option to **cash settle** against ICE Brent Index | +| Position limit | 7,000 contracts in last 5 business days | +| Trading hours | **01:00–23:00 London time** (~22 hrs) | + +### Key Differentiators vs CME WTI + +| Attribute | ICE Brent (B) | CME WTI (CL) | +|-----------|---------------|---------------| +| Contract size | 1,000 bbl | 1,000 bbl | +| Settlement | Cash (ICE Brent Index) | Physical (Cushing, OK) | +| Forward curve | 96 months | 9 years (~108 months) | +| Matching engine | Basildon, Essex | Aurora, IL | +| Matching algorithm | FIFO | FIFO | +| Trading hours | ~22 hrs | ~23 hrs | +| Benchmark role | International seaborne crude | North American crude | + +## 3. Order Book Mechanics + +Pure price-time priority (FIFO) for all products. + +### Modify Semantics + +| Action | Queue Position | +|--------|---------------| +| Decrease quantity (price unchanged) | **Retained** | +| Increase quantity | **Lost** (re-queued to back) | +| Change price | **Lost** (re-queued to back) | + +Same pattern as CME FIFO and Eurex Time matching. + +## 4. Market Data: iMpact Protocol + +Proprietary binary multicast protocol. + +### Book Types + +| Type | Depth | Granularity | Use Case | +|------|-------|-------------|----------| +| **FOD** (Full Order Depth) | **Unlimited** | Individual order level | Full book reconstruction | +| **Price Level** | **Top 5** | Aggregated per price | Lightweight BBO + near depth | + +### Timestamp Precision + +| Component | Precision | Notes | +|-----------|-----------|-------| +| Primary timestamp | **Millisecond** | Not nanosecond — major difference from CME/Eurex | +| `SequenceWithinMillis` | Sub-ms ordering | Integer counter for ordering within same millisecond | +| MiFID II compliance | **Microsecond** granularity | For regulated market obligations | + +### Recovery Architecture + +| Mechanism | Description | +|-----------|-------------| +| Snapshot channels | Dedicated multicast feeds for full book state | +| Bundle markers | Message type **'T'** delineates atomic update boundaries | + +Bundle markers (Type 'T') define atomic update boundaries — all messages between two Type T markers must be applied together. Partial application produces inconsistent book state. + +## 5. Settlement Methodology + +### Daily Settlement + +VWAP during a **2-minute window: 19:28:00–19:30:00 London time**. + +### Final Settlement: ICE Brent Index + +| Component | Description | +|-----------|-------------| +| Methodology | Average of three components across **5 intraday sampling points** | +| Sampling times | 10:30, 12:30, 14:30, 16:30, 19:30 London | +| Components | Trade-based + assessment-based + cash cargo | +| Reference crude | **BFOETM** (Brent-Forties-Oseberg-Ekofisk-Troll-Midland) | +| Minimum cargo size | **700,000 barrels** (full cargo only) | +| PRA data source | **ICIS** (since 2015) | + +### Settlement vs CME + +| Attribute | ICE Brent | CME WTI | +|-----------|-----------|---------| +| Daily method | VWAP 19:28-19:30 London | VWAP 13:28-13:30 CT | +| Final | Cash (ICE Brent Index) | Physical delivery at Cushing | +| Index complexity | 5-point sampling, 3 components | N/A (physical) | +| Expiry basis | BFOETM basket | WTI at Cushing | + +## 6. Co-Location + +| Attribute | Value | +|-----------|-------| +| Location | **Basildon, Essex — European Liquidity Centre** | +| Round-trip latency | **<1 ms** average | +| FPGA wire-to-wire | **~6 μs** tick-to-trade | +| Network topology | **Spine-and-leaf** (LCN) for consistent latency | +| Time sync | **PTP IEEE 1588** sub-1μs precision | +| Connection speed | **10 Gbps** | + +### Routing Implications + +The matching engine is at Basildon, NOT Equinix LD4 in Slough. Firms co-located at LD4 for Eurex/LME must route to Basildon for ICE — adds latency vs direct Basildon co-location. This is a common architectural mistake for multi-venue European trading systems. + +## 7. Cross-Venue Latency Context + +### Basildon Connectivity + +| Route | Distance | Estimated One-Way | +|-------|----------|-------------------| +| Basildon ↔ LD4 (Slough) | ~60 km | ~300–500 μs fiber | +| Basildon ↔ FR2 (Frankfurt) | ~600 km | ~4–5 ms fiber; **~2.3 ms microwave** | +| Basildon ↔ Aurora (CME) | ~6,300 km | ~33–35 ms (hybrid MW+subsea) | + +For multi-venue energy trading (ICE Brent + CME WTI), the Basildon–Aurora path is critical. McKay Brothers provides microwave for LD4–FR2 at ~2.3 ms one-way; the transatlantic leg uses Hibernia Express subsea. + +### Latency Architecture Decision + +| Strategy | Co-lo Location | Tradeoff | +|----------|---------------|----------| +| ICE-first | Basildon | Best ICE latency; worse CME + Eurex | +| Eurex-first | FR2 Frankfurt | Best Eurex latency; ~300–500 μs penalty to ICE | +| CME-first | Aurora, IL | Best CME latency; ~33 ms to ICE | +| Multi-venue (UK hub) | LD4 Slough | Compromise; ~300–500 μs to ICE, ~4 ms to Eurex | + +## 8. iMpact Protocol Details + +### Message Structure + +iMpact uses a proprietary binary encoding (not SBE like CME, not EOBI like Eurex). Key characteristics: + +| Attribute | Value | +|-----------|-------| +| Transport | UDP multicast | +| Encoding | Proprietary binary | +| Byte order | Little-endian | +| Book update model | Incremental updates + snapshot recovery | + +### Book Update Types + +| Update | Description | +|--------|-------------| +| Add | New order added to book | +| Modify | Order quantity/price changed | +| Delete | Order removed | +| Trade | Execution occurred | + +### FOD vs Price Level Selection Guide + +| Requirement | Recommended Feed | +|-------------|-----------------| +| Full book reconstruction | **FOD** (unlimited depth, per-order) | +| BBO monitoring | **Price Level** (top 5, lighter bandwidth) | +| Queue position tracking | **FOD** (per-order detail required) | +| Multi-instrument monitoring | **Price Level** (lower bandwidth per instrument) | + +## 9. Session Schedule + +### Trading Hours (London Time) + +| Product | Open | Close | Duration | +|---------|------|-------|----------| +| Brent Crude (B) | **01:00** | **23:00** | ~22 hrs | +| Gasoil (G) | 01:00 | 23:00 | ~22 hrs | +| UK Nat Gas (M) | 07:00 | 17:00 | 10 hrs | +| Dutch TTF (TFM) | 07:00 | 17:00 | 10 hrs | +| Robusta Coffee (RC) | 09:00 | 17:30 | 8.5 hrs | +| Cocoa (C) | 09:30 | 16:50 | 7.3 hrs | +| Sugar #5 (W) | 08:45 | 17:55 | 9.2 hrs | + +Energy products trade nearly 24 hours; softs and power follow European business hours. + +## 10. Gotchas Checklist + +1. **Matching engine at Basildon, NOT LD4** — routing via LD4 adds unnecessary latency for ICE +2. **iMpact timestamps are millisecond primary** — not nanosecond like CME MDP 3.0 or Eurex EOBI +3. **FOD vs Price Level** — different depth and granularity; choose based on use case +4. **Bundle markers (Type T)** define atomic update boundaries — partial application corrupts book state +5. **96-month forward curve** — very long-dated liquidity; most volume in front months +6. **Settlement via 5-point sampling** — not a simple closing price or single VWAP +7. **BFOETM basket** — six crudes, not just Brent; quality differentials affect index +8. **EFP settlement** — deliverable via Exchange of Futures for Physical, not pure cash +9. **MiFID II microsecond requirement** — feed provides ms primary, compliance timestamps are μs diff --git a/venue-expert/futures/futures.md b/venue-expert/futures/futures.md index 2a7544b..7facad6 100644 --- a/venue-expert/futures/futures.md +++ b/venue-expert/futures/futures.md @@ -2,82 +2,7 @@ ## Overview -Futures are standardized derivative contracts obligating counterparties to transact an underlying asset at a predetermined price on a future date. Exchanges provide standardization, central clearing, and price discovery. - -## Futures vs Forwards - -| Attribute | Futures | Forwards | -|-----------|---------|----------| -| Standardization | Exchange-defined terms | Customizable | -| Trading venue | Exchange | OTC bilateral | -| Counterparty risk | CCP-cleared | Direct exposure | -| Margin | Daily mark-to-market | Typically at maturity | -| Liquidity | Centralized, transparent | Fragmented | -| Regulation | Exchange/CFTC/local | Varies | - -**Key insight:** Standardization sacrifices flexibility for liquidity and credit risk mitigation. - -## Settlement Types - -### Physical Delivery - -Contract holder takes/makes delivery of underlying asset: -- Agricultural commodities (grain, livestock) -- Energy (crude oil, natural gas) -- Metals (gold, copper) - -Delivery involves warehouse receipts, quality grades, delivery points. - -### Cash Settlement - -Final settlement by cash difference: -- Index futures (S&P 500, equity indices) -- Interest rate futures -- Most financial futures - -Settlement price typically derived from spot market reference. - -**Gotcha:** Physical delivery contracts require careful position management near expiry to avoid unintended delivery. - -## Margin Mechanics - -### Initial Margin - -Collateral posted when opening position: -- Set by exchange/CCP -- Typically 3-15% of notional value -- Based on historical volatility and stress scenarios -- Higher for concentrated positions - -### Maintenance Margin - -Minimum margin level to keep position open: -- Usually 75-80% of initial margin -- Breach triggers margin call - -### Variation Margin - -Daily profit/loss settlement: -- Calculated from daily settlement price -- Cash flows daily between counterparties via CCP -- Realized immediately, not accrued - -**Mark-to-market example:** -``` -Day 1: Buy 1 contract at 100 -Day 2: Settlement price = 102 -> Receive (102-100) x multiplier -Day 3: Settlement price = 99 -> Pay (102-99) x multiplier -``` - -## Daily Settlement - -Futures P&L is realized daily: -1. Exchange determines settlement price (various methods) -2. CCP calculates net position value change -3. Cash transfers occur before next session -4. This eliminates credit risk accumulation - -**Quant implication:** Daily settlement creates cash flow drag/benefit vs forward pricing. The difference is the convexity adjustment. +Standardized, CCP-cleared derivatives. Daily mark-to-market creates cash flow drag/benefit vs forward pricing (convexity adjustment). See venue-specific docs for margin rates and settlement methods. ## Contract Specifications @@ -175,7 +100,7 @@ Flow is **potentially directional** when ALL conditions met: | OI↓ + Price↑ | Short covering | | OI↓ + Price↓ | Long liquidation | -See `references/flow_interpretation.md` for decision tree and thresholds. +See `references/flow_interpretation.md` [[futures/references/flow_interpretation.md|flow_interpretation.md]] for decision tree and thresholds. ## Liquid Hours @@ -230,5 +155,5 @@ See `references/flow_interpretation.md` for decision tree and thresholds. 10. **Liquid hours ≠ open hours** - Weight signals by session; Asian 0.3-0.5x vs RTH 1.0x See geography-specific files for detailed coverage. -See `references/spreads.md` for spread mechanics. -See `references/flow_interpretation.md` for flow analysis framework. +See `references/spreads.md` [[futures/references/spreads.md|spreads.md]] for spread mechanics. +See `references/flow_interpretation.md` [[futures/references/flow_interpretation.md|flow_interpretation.md]] for flow analysis framework. diff --git a/venue-expert/futures/references/flow_interpretation.md b/venue-expert/futures/references/flow_interpretation.md index 2a38808..1d009c1 100644 --- a/venue-expert/futures/references/flow_interpretation.md +++ b/venue-expert/futures/references/flow_interpretation.md @@ -231,20 +231,3 @@ OI-price aligned? --> YES --> POTENTIALLY INFORMATIVE (verify no news, check COT 6. **Evolving patterns.** Roll front-running, session characteristics adapt as participants learn. ---- - -## Quick Reference Checklist - -**Informative flow requires ALL:** -- [ ] Not in roll window -- [ ] Spread ratio <15% -- [ ] >15 days to expiry -- [ ] Persistence >60 min -- [ ] Multi-session accumulation -- [ ] OI-price aligned -- [ ] No OpEx gamma -- [ ] No visible paired activity - -**When all boxes checked:** Investigate further. - -**When any box fails:** Default non-directional. diff --git a/venue-expert/futures/references/spreads.md b/venue-expert/futures/references/spreads.md index 19996e2..20da9d0 100644 --- a/venue-expert/futures/references/spreads.md +++ b/venue-expert/futures/references/spreads.md @@ -87,12 +87,13 @@ No leg risk on any path. Spread price guaranteed per fill. ### CME SPAN Methodology -SPAN calculates spread margin via: +SPAN calculates margin via: ``` -Net Margin = max(Long Scan Risk, Short Scan Risk) - - Intra-Commodity Spread Credit - - Inter-Commodity Spread Credit - + Delivery Month Charge +Total = Scanning Risk (max loss across 16 scenarios) + + Intra-Commodity Spread Charge (basis risk between months) + - Inter-Commodity Spread Credit (correlated offset) + + Delivery Month Charge + + max(Short Option Minimum - above, 0) ``` **Spread credit is NOT a fixed percentage.** It's a dollar amount based on spread volatility vs outright volatility. @@ -226,7 +227,7 @@ Detailed coverage in `apac/china/references/`. Key differences: **Cross-exchange (e.g., i-j-rb steel chain):** NO margin offset. -**Index futures (CFFEX):** Intraday close fee = 100x base rate. Day trading spreads cost-prohibitive; use T+1. +**Index futures (CFFEX):** Intraday close fee = 10x base rate (万分之2.3 vs 万分之0.23, as of Mar 2023). Day trading spreads cost-elevated; consider T+1. ## Common Gotchas diff --git a/venue-expert/matrices/data_characteristics.md b/venue-expert/matrices/data_characteristics.md new file mode 100644 index 0000000..a266b91 --- /dev/null +++ b/venue-expert/matrices/data_characteristics.md @@ -0,0 +1,64 @@ +# Data Characteristics — Cross-Venue Matrix + +## Feed Comparison + +| Venue | Protocol | Encoding | Depth | Timestamp | Update Freq | Recovery | +|-------|----------|----------|-------|-----------|------------|----------| +| CME | MDP 3.0 | SBE (fixed-length, little-endian) | 10 outright / **2 implied** | uint64 ns (UTC) | Real-time incremental (UDP multicast) | Feed A/B arb → UDP snapshot loop → TCP Replay (max 2K pkt, 24h) | +| Nasdaq | ITCH 5.0 | Binary (fixed-length) | Full order-by-order (unlimited) | ns | Real-time per-order | MoldUDP64 + Glimpse (TCP snapshot) | +| NYSE | XDP | Binary | Full order-by-order | ns | Real-time per-order | XDP retransmission | +| Cboe | PITCH | Binary | Full order-by-order | ns | Real-time per-order | PITCH retransmission | +| ICE | iMpact | Binary (proprietary multicast) | FOD (full order depth) + PL (top 5) | ms + MiFID μs | Real-time per-order | Snapshot channels + bundle markers (Type 'T') | +| Eurex | EOBI | Binary (T7) | Full L3 order-by-order, no depth limit | ns | Real-time per-order | Snapshot channels; co-lo only (10 Gbit/s) | +| SGX | ITCH (MoldUDP64) | Binary | Full order-by-order | ns | Real-time per-order | Rewinder (UDP unicast) + GLIMPSE (TCP snapshot) | +| CTA/UTP SIP | SIP | Binary | NBBO only (L1) | μs | Consolidated, conflated | N/A (consolidated output) | +| Chinese CTP (standard) | CTP TCP | Struct-based (440–580 bytes) | **1 level** | HH:MM:SS + ms (exchange-generated) | **500ms snapshots** | **No replay; reconnection gaps are permanent data loss** | +| Chinese CTP (co-lo L2) | CTP multicast / exchange direct | Struct-based | **5 levels** | Same | **250ms** (SHFE/INE/DCE/CZCE/GFEX); 500ms (CFFEX) | No replay | +| HKEX OMD-C (SS) | OMD-C | Binary | BBO + broker queue (up to 40/side) | Conflated (~2,000 spu/s) | Conflated | OMD-C recovery | +| HKEX OMD-C (SF) | OMD-C | Binary | Full order-by-order | Streaming | Real-time | OMD-C recovery | + +## Data Quirks + +| Venue | Quirk | Impact | +|-------|-------|--------| +| Chinese CTP | **No replay mechanism** | Reconnection gaps = permanent data loss; no way to recover missed snapshots | +| CZCE | **UpdateMillisec always = 0** | Cannot order events within same second; must interpolate (000, 500, 750, 875ms) | +| DCE | **ActionDay = TradingDay during night session** (wrong) | Night session ActionDay shows next business day, not actual calendar date; never trust DCE ActionDay | +| CZCE | **TradingDay = current date during night session** (wrong) | Does not advance to next trading day at night; never trust CZCE TradingDay at night | +| CZCE | **3-digit contract codes** (YMM not YYMM) | CF501 = 2025 or 2015? Disambiguate by context; CTP passes through as-is | +| CME MDP 3.0 | **Implied depth = 2 levels, NOT 10** | Book builders assuming 10-level implied are wrong; implied uses MDEntryType E/F | +| CME MDP 3.0 | NumberOfOrders = NULL for implied entries | Cannot count orders at implied price levels | +| ICE | Matching engine at **Basildon, not LD4** | Routing via LD4 adds unnecessary latency for ICE energy trading | +| HKEX | **Broker queue visibility** (unique globally) | 4-digit broker IDs per order; up to 40/side; equities only (not derivatives) | +| HKEX | Broker queue is **conflated, not streaming** | Multiple changes within interval merged; real-time but not tick-by-tick | +| SHFE/INE | UpdateMillisec only 0 or 500 | Binary pattern confirms exchange-generated timestamps, not CTP-generated | +| CFFEX | UpdateMillisec only 0 or 500 | Same binary pattern as SHFE | +| DCE | UpdateMillisec has variable real ms values | Different from SHFE/CFFEX pattern; confirms per-exchange timestamp generation | +| Eurex EOBI | No implied price labels | Implied/synthetic prices must be reconstructed from visible orders; EMDI publishes implied separately | +| Eurex EOBI | Auction: only BBO or clearing price, no depth | Depth information not published during volatility auctions | +| GFEX | Close flag always generic Close ('1') | Like DCE/CZCE/CFFEX; does NOT preserve CloseToday/CloseYesterday (unlike SHFE/INE) | +| Chinese CTP | AveragePrice scaling inconsistent | Divide by multiplier for SHFE/INE/DCE/CFFEX; CZCE AveragePrice is direct | +| Chinese CTP | Volume is cumulative | Must compute delta: Volume[t] - Volume[t-1]; decreases only at session boundaries | +| Chinese CTP | Night replay on reconnect | Duplicate/old data on reconnect; filter by comparing tick time to wall clock | +| CTP v6.5.1 | InstrumentID char[31]→char[81] | Binary-breaking struct change (Sep 2020); all code must recompile | +| Nasdaq ITCH | Stateless across days | All orders cancelled overnight; no persistent IDs; no corporate action messages | +| Bloomberg | Bar timestamps = bar open time (not close) | Off-by-one-period errors if not adjusted | +| Wind (万得) | A-share "tick" data = 3-second snapshots | Not true tick-by-tick; intra-snapshot dynamics invisible | +| VNPY | Truncates UpdateMillisec to 100ms precision | Deliberate loss of precision in `int(data['UpdateMillisec']/100)` | + +## Timestamp Reliability by Exchange (Chinese Futures) + +| Exchange | UpdateTime | UpdateMillisec | ActionDay (Night) | TradingDay (Night) | +|----------|-----------|---------------|-------------------|-------------------| +| SHFE | Reliable | 0 or 500 only | Correct (actual date) | Correct (next trading day) | +| INE | Reliable | 0 or 500 only | Correct | Correct | +| DCE | Reliable | Variable real ms | **Wrong** (= TradingDay) | Correct | +| CZCE | Reliable | **Always 0** | Correct | **Wrong** (= current date) | +| CFFEX | Reliable | 0 or 500 only | N/A (no night) | N/A | +| GFEX | Reliable | Variable (DCE pattern) | N/A (no night) | N/A | + +## Per-Venue Details +- [[equity/amer/nasdaq/references/specs/itch_protocol.md|itch_protocol.md]] ITCH 5.0 Specification +- [[futures/amer/cme.md|cme.md]] §2 MDP 3.0 +- [[futures/emea/eurex.md|eurex.md]] §2 EOBI +- [[equity/apac/hkex.md|hkex.md]] §3 Feed Products diff --git a/venue-expert/matrices/latency.md b/venue-expert/matrices/latency.md new file mode 100644 index 0000000..76bc52d --- /dev/null +++ b/venue-expert/matrices/latency.md @@ -0,0 +1,57 @@ +# Latency — Cross-Venue Matrix + +## Cross-Venue Latency + +| Route | Distance (km GC) | Fiber OW (ms) | Microwave OW (ms) | Source | +|-------|-------------------|---------------|-------------------|--------| +| Carteret NJ ↔ Aurora IL | ~1,180 | 6.49 (Spread Networks) | **3.982** | McKay/Quincy 2016 | +| Mahwah NJ ↔ Aurora IL | ~1,190 | ~6.5 | **3.986** | McKay/Quincy 2016 | +| Secaucus NJ ↔ Aurora IL | ~1,170 | ~6.5 | **4.015** | McKay/Quincy 2016 | +| Mahwah ↔ Carteret NJ | ~48 | ~0.25–0.35 | ~0.17–0.20 | mmWave estimates | +| Secaucus ↔ Carteret NJ | ~32 | ~0.20 | **0.091** | McKay 2016 (182 μs RTT) | +| London LD4 ↔ Aurora IL | ~6,300 | ~36 (Hibernia) | ~33–35 (hybrid) | Quincy 2014: 35.39 ms | +| London LD4 ↔ Frankfurt FR2 | ~600 | ~4–5 | **2.32** | McKay 2015 (4.64 ms RTT) | +| Tokyo ↔ Singapore SGX | ~5,300 | ~32.5 | ~32.5 (hybrid) | NTT ASE: 65 ms RTD | +| Tokyo ↔ Shanghai | ~1,760 | ~15–18 | **11.43** | McKay 2022 (22.86 ms RTT) | +| Shanghai ↔ Singapore | ~3,800 | ~25–35 | est. 22–30 | Limited data | + +## Within-DC Latency + +| Location | Latency | Notes | +|----------|---------|-------| +| Aurora CyrusOne rack-to-rack | ~5 μs one-way | McKay 2014 | +| Aurora Equinix CH4 → CyrusOne | **287 μs** one-way | Databento; inter-building same campus | +| Aurora → 350 E. Cermak (Chicago) | **185 μs** one-way | McKay/Quincy 2013 | +| NJ cross-connect same building | 1–5 μs | Industry standard | +| Per meter of fiber | ~4–5 ns | Physics (refractive index ~1.47) | + +## Exchange Matching Latency + +| Exchange | Matching Latency | Wire-to-Wire | Notes | +|----------|-----------------|-------------|-------| +| CME Globex | Sub-millisecond (~1 μs order book) | ~1–5 μs (co-lo rack-to-rack) | Aurora IL; ns timestamps | +| ICE Futures Europe | <1 ms average | **~6 μs** (FPGA optimized) | Basildon, Essex (NOT LD4) | +| Eurex (T7) | Sub-millisecond | — | FR2 Frankfurt; ns timestamps | +| SGX (TITAN) | <100 μs (exchange-stated) | Sub-15 μs (Tier-1 co-lo) | 25 Serangoon North, Singapore | +| Nasdaq | Sub-80 μs | <10 μs (co-lo) | Carteret NJ | +| NYSE | Sub-millisecond | — | Mahwah NJ | +| Chinese futures (SHFE/INE) | ~500 μs order-to-ack | — | +300 μs added Jul 2024 (fiber extension) | +| Chinese futures (CFFEX) | Sub-millisecond | — | +30 μs added Jul 2024 | +| Chinese futures (DCE/CZCE) | ~1–2 ms (co-lo) | — | Inferred from co-lo data | +| Chinese futures (GFEX) | ~1–2 ms (estimated) | — | Limited data | + +## Key Providers + +| Provider | Coverage | Notes | +|----------|----------|-------| +| McKay Brothers / Quincy Data | US, EU, Asia routes | Carteret–Aurora: 3.982 ms (1.1% above speed-of-light) | +| Anova Financial Networks | US (expanding) | Competing microwave network | +| New Line Networks | US | Jump/Virtu JV | +| DRW / Vigilant Global | US, EU | Proprietary microwave infra | +| Hibernia Express | Transatlantic subsea | NJ–London LD4: 29.28 ms one-way | + +## Per-Venue Details +- [[futures/amer/cme.md|cme.md]] §8 Session Schedule / §1 Co-Location +- [[futures/emea/ice.md|ice.md]] §6 Co-Location +- [[futures/apac/sgx.md|sgx.md]] §4 TITAN Platform +- [[futures/apac/china/futures_china.md|futures_china.md]] §10 Matching Engine Latency diff --git a/venue-expert/matrices/matching_algorithms.md b/venue-expert/matrices/matching_algorithms.md new file mode 100644 index 0000000..ea69736 --- /dev/null +++ b/venue-expert/matrices/matching_algorithms.md @@ -0,0 +1,55 @@ +# Matching Algorithms — Cross-Venue Matrix + +## Main Matrix + +| Venue | Product | Default Algo | Spread Algo | Options Algo | Modify: Qty Down | Modify: Qty Up/Price | +|-------|---------|-------------|-------------|-------------|-------------------|---------------------| +| CME | ES (E-mini S&P) | FIFO (F) | FIFO (F) | FIFO (F) | Retain | Lose | +| CME | NQ (E-mini Nasdaq) | FIFO (F) | FIFO (F) | FIFO (F) | Retain | Lose | +| CME | CL (WTI Crude) | FIFO (F) | FIFO (F) | Threshold (Q) or FIFO | Retain | Lose | +| CME | GC (Gold) | FIFO (F) | FIFO (F) | Threshold (Q) or FIFO | Retain | Lose | +| CME | ZN (10Y T-Note) | FIFO (F) | Configurable (20/80) | Threshold + LMM (Q) | Retain | Lose | +| CME | ZB (Treasury Bond) | FIFO (F) | Configurable (K) | Threshold + LMM (Q) | Retain | Lose | +| CME | ZT (2Y T-Note) | Configurable (K) | Configurable (20/80) | Threshold + LMM (Q) | Retain | Lose | +| CME | ZC (Corn) | Configurable (40/60) | Configurable (40/60) | Threshold (O) | Retain | Lose | +| CME | SR3 (3M SOFR) | Allocation (A): TOP→PR→FIFO | FIFO (packs/bundles) | Threshold + LMM (Q) | Retain | Lose | +| CME | 6E (Euro FX) | FIFO (F) | Pro-Rata (C) | Threshold (Q) or (O) | Retain | Lose | +| ICE | B (Brent Crude) | Price-time (FIFO) | — | — | Retain | Lose | +| Eurex | FGBL/FESX/FDAX | Time (FIFO) | — | Time (FIFO, default) | Retain | Lose | +| Eurex | FEU3 (Euribor) | Pro-Rata | — | Pro-Rata (select) | — | — | +| SGX | FEF (Iron Ore) | Price-time | — | — | Retain (assumed) | Lose (assumed) | +| HKEX | Equities | Price-time | — | — | — | — | +| SHFE | All products (rb, cu, au, etc.) | Price-time (价格优先、时间优先) | — | — | N/A (no modify) | N/A (cancel-replace only; always lose) | +| DCE | All products (i, m, j, etc.) | Price-time | — | — | N/A (no modify) | N/A (cancel-replace only; always lose) | +| CZCE | All products (TA, MA, SR, etc.) | Price-time | — | — | N/A (no modify) | N/A (cancel-replace only; always lose) | +| CFFEX | All products (IF, IH, IC, IM, T) | Price-time | — | Closing call auction (options only, 14:57–15:00) | N/A (no modify) | N/A (cancel-replace only; always lose) | +| INE | All products (sc, lu, bc) | Price-time | — | — | N/A (no modify) | N/A (cancel-replace only; always lose) | +| GFEX | All products (SI, LC, PS, PT, PD) | Price-time | — | — | N/A (no modify) | N/A (cancel-replace only; always lose) | +| NYSE | Equities | Price-time + **parity allocation** (DMMs, floor brokers share at same price) | — | — | Retain | Lose | +| Nasdaq | Equities | Price-time (strict FIFO) | — | — | Retain | Lose | + +## Call Auction Algorithms (Chinese Exchanges) + +| Feature | SHFE/INE | DCE | CZCE | CFFEX | GFEX | +|---------|----------|-----|------|-------|------| +| Core algorithm | Maximum Volume Principle | Maximum Volume Principle | Maximum Volume Principle | Maximum Volume Principle | Maximum Volume Principle | +| Tie-breaking | Closest to prev settlement | Closest to prev settlement | Closest to prev settlement | Closest to prev settlement | Closest to prev settlement | +| Day auction for night products | Yes (since 2023/5) | Yes (since 2023/5) | **Cancel only** (no new matching) | N/A | Yes (since 2023/5) | +| Closing call auction | No | No | No | **Yes** (options only) | No | +| Market orders in auction | Not supported | Excluded | Excluded | Auto-cancelled | Excluded | + +## LMM / DMM Allocation + +| Venue | Market Maker Type | Allocation % | Applies To | +|-------|-------------------|-------------|------------| +| CME | LMM (Lead Market Maker) | <50% total (proprietary per product) | Options only (not futures) | +| NYSE | DMM (Designated Market Maker) | Parity allocation at same price | Listed equities | +| NYSE Arca | LMM | Enhanced allocation | ETFs | +| Eurex | Designated MM | Fee discounts, obligation-based | Select products | +| Chinese exchanges (all 6) | 做市商 (Market Maker) | Fee discounts, position limit exemption | Bilateral agreements; obligations not public | + +## Per-Venue Details +- [[futures/amer/cme.md|cme.md]] §4 Matching Algorithms +- [[futures/emea/eurex.md|eurex.md]] §3 Matching Algorithms +- [[futures/emea/ice.md|ice.md]] §3 Order Book Mechanics +- [[equity/amer/nyse/nyse.md|nyse.md]] Parity Allocation Model diff --git a/venue-expert/matrices/session_overlaps.md b/venue-expert/matrices/session_overlaps.md new file mode 100644 index 0000000..5b0b333 --- /dev/null +++ b/venue-expert/matrices/session_overlaps.md @@ -0,0 +1,50 @@ +# Session Overlaps — Cross-Venue Matrix + +## Session Hours (UTC) + +| Exchange | Pre-Open | Main Session | Break | Evening/Night | Notes | +|----------|----------|-------------|-------|---------------|-------| +| CME Globex (ES/NQ) | — | 13:30–20:15 (RTH) | 21:00–22:00 (maintenance) | 22:00–13:30+1 (overnight) | Sunday open 22:00 UTC | +| CME Globex (CL) | — | 13:00–18:30 (RTH) | — | 22:00–13:00+1 | — | +| CME Globex (ZN/ZB) | — | 12:00–19:00 (RTH) | — | 22:00–12:00+1 | — | +| ICE (Brent B) | — | 01:00–23:00 London (00:00–22:00 UTC) | — | — | ~22 hrs continuous | +| Eurex (FGBL/FESX) | 00:00 | 00:15–21:00 | — | — | Asian hours since Dec 2018 | +| SGX (FEF) | — | 23:25–11:55 (T session) | 11:55–12:15 | 12:15–21:15 (T+1) | ~21.5 hrs total | +| HKEX (equities) | 01:00 | 01:30–04:00 / 05:00–08:00 | 04:00–05:00 (lunch) | — | CAS 08:00–08:10 | +| SHFE/INE (night tier 3) | 12:55 | 01:00–02:15 / 02:30–03:30 / 05:30–07:00 | 02:15–02:30 / 03:30–05:30 | 13:00–18:30 (au,ag,sc) | Night = 21:00–02:30 Beijing | +| SHFE/INE (night tier 2) | 12:55 | Same day session | Same | 13:00–17:00 (cu,al,zn) | Night = 21:00–01:00 Beijing | +| SHFE/DCE/CZCE (night tier 1) | 12:55 | Same day session | Same | 13:00–15:00 (rb,i,TA,m) | Night = 21:00–23:00 Beijing | +| CFFEX (index) | 01:25 | 01:30–03:30 / 05:00–07:00 | 03:30–05:00 | — | No night session, no mid-morning break | +| CFFEX (treasury) | 01:10 | 01:15–03:30 / 05:00–07:15 | 03:30–05:00 | — | No night session | +| GFEX | 00:55 | 01:00–02:15 / 02:30–03:30 / 05:30–07:00 | 02:15–02:30 / 03:30–05:30 | — | No night session | + +## Overlap Windows + +| Window (UTC) | Active Venues | Significance | +|-------------|---------------|-------------| +| 00:00–01:00 | Eurex, ICE, CME Globex, SGX T+1 | Europe opens; Asia T+1 still active | +| 01:00–04:00 | Eurex, ICE, CME Globex, HKEX, Chinese day (01:00–07:00), SGX | Full Asia-Europe overlap; Chinese day session active | +| 05:30–07:00 | Chinese afternoon, HKEX (post-lunch), Eurex, ICE, CME Globex, SGX | Chinese PM + Europe continuous | +| 12:00–15:00 | CME RTH, ICE, Eurex, Chinese night (tier 1) | US open + Europe close + China night open (21:00–23:00 Beijing) | +| 13:00–17:00 | CME RTH, ICE, Chinese night (tier 2 metals) | US session + China metals night | +| 13:00–18:30 | CME RTH, ICE, Chinese night (tier 3 au/ag/sc) | US session + China precious metals/crude night | +| 13:30–20:15 | CME RTH (ES/NQ), ICE | US equity index RTH; peak global liquidity | +| 20:15–22:00 | CME pre-maintenance, ICE (until 22:00) | US post-RTH wind-down | +| 22:00–23:25 | CME Globex resumes | Gap: SGX not yet open; thin liquidity | +| 23:25–00:00 | CME Globex, SGX T session opens | Asia-US overnight overlap begins | + +## Key Cross-Venue Arbitrage Windows + +| Pair | Overlap Window (UTC) | Duration | +|------|---------------------|----------| +| DCE iron ore ↔ SGX FEF | 01:00–07:00 (Chinese day) + 13:00–15:00 (Chinese night / SGX T+1) | ~8 hrs | +| SHFE metals ↔ LME | 01:00–07:00 (Chinese day) + 13:00–17:00 (Chinese night) | ~10 hrs | +| SHFE au ↔ COMEX GC | 01:00–07:00 (Chinese day) + 12:00–18:30 (Chinese night + CME RTH) | ~12.5 hrs | +| INE sc ↔ ICE Brent | 01:00–07:00 (Chinese day) + 13:00–18:30 (Chinese night) | ~11.5 hrs | +| Eurex FGBL ↔ CME ZN | 00:15–19:00 (Eurex) overlaps 12:00–19:00 (CME RTH) | 7 hrs | +| ES/NQ ↔ FESX/FDAX | 13:30–20:15 (CME RTH) overlaps 00:15–21:00 (Eurex) | 6.75 hrs | + +## Per-Venue Details +- [[futures/amer/cme.md|cme.md]] §8 Session Schedule +- [[futures/emea/ice.md|ice.md]] §9 Session Schedule +- [[futures/emea/eurex.md|eurex.md]] §6 Session Schedule diff --git a/venue-expert/matrices/tcost_comparison.md b/venue-expert/matrices/tcost_comparison.md new file mode 100644 index 0000000..3f67037 --- /dev/null +++ b/venue-expert/matrices/tcost_comparison.md @@ -0,0 +1,81 @@ +# Transaction Cost — Cross-Venue Matrix + +## Spread Comparison + +| Product/Venue | Tick Size | Median Spread (ticks) | Half-Spread (bps) | Source | +|---------------|-----------|----------------------|-------------------|--------| +| rb (rebar) / SHFE | 1 CNY/ton | 1 | ~1.4 | Indriawan et al. 2019 | +| cu (copper) / SHFE | 10 CNY/ton | 1 | ~0.7 | Indriawan et al. 2019 | +| al (aluminum) / SHFE | 5 CNY/ton | 1 | ~1.2 | Indriawan et al. 2019 | +| au (gold) / SHFE | 0.02 CNY/g | 1–2 | ~0.2–0.3 | Liu et al. 2016 | +| i (iron ore) / DCE | 0.5 CNY/ton | 1–2 | ~3–6 | Indriawan et al. 2019 | +| m (soybean meal) / DCE | 1 CNY/ton | 1 | ~1.6 | Estimate (very liquid) | +| TA (PTA) / CZCE | 2 CNY/ton | 1 | ~1.8 | Xiong & Li 2024 | +| IF (CSI 300) / CFFEX | 0.2 pts | 1–3 | ~0.3–0.8 | arXiv:2501.03171 | +| sc (crude oil) / INE | 0.1 CNY/bbl | 1–2 | ~0.9–1.8 | Estimate | +| Mega-cap US equity (top 50) | $0.01 | 1 | 1–3 | SEC MIDAS, Hagstromer 2021 | +| Large-cap US equity (S&P 500) | $0.01 | 1 | 2–7 | Hagstromer 2021: mean 3.2 bps | +| Mid-cap US equity (S&P 400) | $0.01 | 1–3 | 5–15 | SEC MIDAS | +| Small-cap US equity (R2000) | $0.01 | 2–5+ | 10–30 | Tick Pilot data | +| ES (E-mini S&P) / CME | 0.25 pts ($12.50) | 1 | ~0.3–0.5 | Practitioner estimates | +| B (Brent Crude) / ICE | $0.01/bbl ($10) | 1 | ~0.5–1.0 | Practitioner estimates | + +## Market Impact + +| Venue/Asset | Model | Key Parameters | Source | +|-------------|-------|---------------|--------| +| Universal (all) | Square-root law: G = sigma * sqrt(Q/V) * theta | theta ~ 1; beta ~ 0.5 | Toth et al. 2011; Bouchaud 2024 | +| US equity (S&P 500) | Almgren-Chriss calibration | gamma=0.314 (permanent), eta=0.142 (temporary), beta=0.6 | Almgren et al. 2005 (Citigroup data) | +| US equity large-cap <1% ADV | Implementation shortfall | 3–8 bps one-way | ITG/Virtu ACE | +| US equity large-cap 1–5% ADV | Implementation shortfall | 8–20 bps one-way | Frazzini et al.: mean 11.2 bps | +| US equity small-cap >5% ADV | Implementation shortfall | 50–110+ bps one-way | ITG estimates | +| CME ES ($33M, COVID 2020) | CME sqrt model | ~10 bps | CME analysis | +| CME ES ($59M, Apr 2025) | CME sqrt model | ~5.4 bps | CME analysis | +| Chinese base metals (cu, al) | Sqrt law (no calibration) | Estimated alpha: 0.3–0.8 | Proxy from international | +| Chinese ferrous (rb, i, j, jm) | Sqrt law (no calibration) | Estimated alpha: 0.8–1.5 | Higher retail participation | +| Chinese financial (IF, T) | Sqrt law (no calibration) | Estimated alpha: 0.3–0.6 | Higher institutional, deeper books | + +## Fill Rate Comparison + +| Venue | Back-of-Queue 1s | Back-of-Queue 1min | Front-of-Queue | Source | +|-------|-------------------|--------------------|--------------------|--------| +| US equity (large-tick) | ~1–5% | ~10–30% | >90% within seconds | Moallemi & Yuan 2017; Maglaras et al. 2022 | +| CME ES | Low (queue 500–2,000+ contracts) | 10s often insufficient | >90% | BestEx Research | +| Chinese futures (rb) | — (no published data) | Est. 2–10 min back-of-queue | — | Practitioner estimates; CTP snapshot limits study | +| Chinese futures (cu) | — | Est. 1–5 min back-of-queue | — | Practitioner estimates | +| Chinese futures (IF) | — | Est. 0.5–3 min back-of-queue | — | Practitioner estimates | + +## Impact Decay Profile + +| Horizon | Behavior | Mechanism | Source | +|---------|----------|-----------|--------| +| 1 second | Largely persistent | Single-trade bare impact | Eisler et al. 2012 | +| 5 seconds | Mild continuation | Book refilling, information absorption | Bonart & Gould 2015 | +| 30 seconds | Inflection point | Uninformed sweeps revert; informed continue | — | +| 5 minutes | Significant reversion signal | 31% of extreme 1-min returns reverse in next minute | Nasdaq100 data | +| End of day | ~2/3 of peak retained | Standard decay | Bucci et al. 2019 (8M+ metaorders) | +| ~50 days | ~1/2 of day-1 impact | Power-law convergence | Bucci et al. 2019 | + +## Cancel Rate + +| Venue | Cancel Rate | Regulatory Threshold | Source | +|-------|------------|---------------------|--------| +| Chinese exchanges (SHFE/INE) | Est. 20–40% | ≥500 cancels/contract/day; ≥50 large cancels (≥300 lots) | KaiYuan Securities 2024; SHFE rules | +| Chinese exchanges (DCE) | Est. 20–40% | ≥500 cancels/contract/day; ≥50 large cancels (≥80% max size) | DCE Abnormal Trading Rules | +| Chinese exchanges (CZCE) | Est. 20–40% | ≥500 cancels/contract/day; ≥50 large cancels (≥800 lots) | CZCE rules | +| Chinese exchanges (CFFEX index) | Est. 20–40% | ≥400 cancels/contract/day; ≥100 large cancels | CFFEX Monitoring Guidelines | +| US equity | ~94% | No hard limit; SEC scrutiny for spoofing | Moallemi & Yuan 2017 | +| CME | High (no published rate) | No explicit cancel threshold; self-match prevention available | CME rules | + +## Post-Sweep Recovery + +| Venue | 50% Depth Recovery | Full Recovery | Spread Normalization | Source | +|-------|-------------------|--------------|---------------------|--------| +| US equity (liquid) | ~2–5 seconds | ~5–10 seconds | 5–10 seconds (but intensity: ~30 min) | Bonart & Gould 2015; Xu et al. 2016 | +| CME ES (RTH) | Fast (10K–20K contract depth) | Seconds for normal orders | — | BestEx Research | +| CME ES (Asian session) | Slow (500–800 contracts/side) | Minutes | — | Practitioner estimates | +| Chinese futures | Est. 2–5x slower than US | — | — | Lower HFT participation, regulatory constraints | + +## Per-Venue Details +- [[futures/apac/china/references/models/queue_position.md|queue_position.md]] Queue Position Model +- [[futures/apac/china/references/models/spreads.md|spreads.md]] Spread Model