exchange-gateway-engineering
Skill13 starsChanged 5 days agoApache-2.0View on GitHub
Design, audit, or troubleshoot exchange connectivity and order-entry state machines, including protocol parsing, sequence handling, acknowledgements, rejects, cancel/replace, throttles, disconnect recovery, and session controls. Use for FIX, OUCH-like, or binary gateway work.
In this repository19 other files it gives its agents.
- agent-based-market-simulationSkill
- code-understandingSkill
- etf-arbitrageSkill
- execution-analysisSkill
- hft-market-replaySkill
- interview-simulatorSkill
- lob-microstructureSkill
- low-latency-performanceSkill
- market-makingSkill
- mathematical-reasoningSkill
- order-book-reconstructionSkill
- pre-trade-risk-controlsSkill
- production-trading-operationsSkill
- quant-research-validationSkill
- queue-position-modelingSkill
- research-paper-tutorSkill
- socratic-tutorSkill
- tick-data-engineeringSkill
- volatility-market-makingSkill
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 7
Treat an exchange gateway as a correctness-critical distributed state machine.
- Distinctive: line 17
Test with a simulator or certification environment: Use deterministic message transcripts, malformed messages, timeout injection, …
- Distinctive: line 22
Never infer order state solely from a local timeout.
- Distinctive: line 23
Never retry a non-idempotent order blindly after a disconnect.
- Distinctive: line 24
Do not ignore unknown messages or unexpected state transitions.
- Distinctive: line 25
Do not log secrets, session keys, private certificates, or account credentials.
- Very specific: line 26
Do not place/cancel/replace live orders without explicit user authorization and the required operational approvals.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Exchange Gateway and Order-State Engineering
Treat an exchange gateway as a correctness-critical distributed state machine. A local send is not an exchange acknowledgement; a timeout is not proof that an order was rejected or cancelled.
Workflow
- Use the exact venue specification. Record protocol/version, session type, framing, field encoding, order types/TIF, price and quantity scales, sequence rules, heartbeat, throttle, cancel/replace semantics, and business-day changes.
- Model order states explicitly. Define accepted, pending new, working, partially filled, pending cancel, pending replace, filled, cancelled, rejected, expired, and unknown/reconciliation-required states as applicable. Map every inbound/outbound message and legal transition.
- Separate request IDs from venue order IDs. Persist client order ID, venue order ID, session sequence, original/replace chain, parent strategy ID, and idempotency key. Never reuse identifiers outside protocol rules.
- Handle asynchronous races. Design for fill-during-cancel, partial-fill-during-replace, duplicate acknowledgements, late rejects, cancel reject, disconnect during send, and reconnect before reconciliation. Keep state monotone only where the protocol allows it.
- Implement sequencing and recovery. Detect gaps and duplicates. Follow venue-defined retransmission, recovery, session reset, and open-order reconcilation. Do not resume order flow on an uncertain state.
- Enforce backpressure and throttles. Bound outbound queues, prioritize risk-reducing cancels where policy allows, monitor rate limits, and define behavior when the exchange or network stalls.
- Test with a simulator or certification environment. Use deterministic message transcripts, malformed messages, timeout injection, reconnects, sequence resets, partial fills, and recovery tests. Do not test on a live venue without explicit authorization.
- Audit every transition. Persist raw inbound/outbound messages, timestamps, state transitions, decision source, and error path with sensitive credentials redacted.
Guardrails
- Never infer order state solely from a local timeout.
- Never retry a non-idempotent order blindly after a disconnect.
- Do not ignore unknown messages or unexpected state transitions.
- Do not log secrets, session keys, private certificates, or account credentials.
- Do not place/cancel/replace live orders without explicit user authorization and the required operational approvals.
Deliverable
Return protocol/version references, state diagram, transition table, recovery plan, throttle/backpressure design, fault-injection test matrix, audit fields, and unresolved edge cases.
Further reading
- Nasdaq OUCH: https://nasdaqtrader.com/Trader.aspx?id=OUCH
- Nasdaq OUCH 5.0 specification: https://www.nasdaqtrader.com/content/technicalsupport/specifications/TradingProducts/OUCH5.0.pdf
- NYSE pillar specifications: https://www.nyse.com/trade/pillar
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

