Algorithmic Order Execution Function Schema Matrix
Define parameter schemas, validation rules, and recovery behaviors for trade execution agent tools.
Use this template when building function-calling definitions for algorithmic trading agents. It creates a complete schema specification matrix covering order creation, order modification, price checks, and cancellations.
Role: Principal Quantitative Trading Systems Architect specializing in automated execution interfaces and smart order routing.
Context
- Brokerage Firm: {{trading_firm}}
- Asset Class: {{instrument_type}}
- Execution Venue: {{execution_venue}}
- Settlement Rules: {{settlement_framework}}
- Max Slippage: {{max_slippage_bps}} bps
- Risk Gateway API: {{risk_gateway_api}}
Task
Design an exhaustive parameter validation and error recovery matrix for tool-calling interfaces utilized by automated execution agents trading {{instrument_type}} across {{execution_venue}}.
Method
- Define the complete toolset required for trade lifecycle management (quote, validate, submit, modify, cancel, status).
- Specify strict JSON schema types, required fields, and boundary ranges for every parameter.
- Integrate pre-trade risk validation calls against {{risk_gateway_api}} as mandatory prerequisites for order dispatch.
- Embed slippage constraints enforcing the {{max_slippage_bps}} ceiling directly into price calculation functions.
- Map exact error codes returned by {{execution_venue}} to automated agent recovery functions.
- Align all post-trade reporting payloads with {{settlement_framework}} parameters.
- Compile the schema, validation rules, and error recovery steps into a centralized technical matrix.
Constraints
- MUST reject any tool call parameter that omits strict type enforcement, positive floating bounds, or client order IDs.
- MUST NOT allow market orders to bypass the {{max_slippage_bps}} validation check.
- Tool schemas must enforce idempotency keys on all submission and cancellation functions.
- Pre-trade risk checks via {{risk_gateway_api}} cannot be bypassed by any execution tool.
Output format
1. Interface Specification Summary
A technical summary defining JSON schema compliance and type-checking rules (under 150 words).
2. Parameter Schema & Recovery Matrix
A Markdown table containing the following columns: | Tool Name | Operation Type | Required Schema Parameters | Validation Bounds | API Error Code | Recovery Action | (Define 6 distinct functions: GetQuote, ValidateRisk, SubmitOrder, ModifyOrder, CancelOrder, GetOrderStatus).
3. Circuit Breaker Invariants
A numbered list of 4 non-negotiable failure states that trigger immediate execution shutdown.
Self-review
- Confirm every function schema includes explicit validation bounds and types.
- Verify that slippage checks strictly adhere to the {{max_slippage_bps}} threshold.
- Ensure error handling covers dropped connections and rejection codes from {{execution_venue}}.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.