What you will accomplish
- Separate the model from credentials and order submission
- Keep credentials and risk rules outside the prompt
- Tie each approval to one exact order
- Check uncertain results and keep an audit log
Before you begin
- A development environment and secure secret manager
- Quote.Trade MCP and REST documentation
- A test account with strict limits
- A way to disable credentials and stop trading quickly
Separate the model from credentials and execution
The model may read market data and propose an order, but it should never receive the API secret or direct permission to send an unrestricted request. Keep credentials, risk checks, and submission in a separate server-side service.
User / operator
↓
AI client (no secrets)
↓ proposed order
Risk checks + order preview
↓ approved order snapshot
Execution service (server-side credentials)
↓
Quote.Trade MCP / REST
↓
Confirmed result + audit logThe model cannot read the API secret or bypass the server-side rules.
Block everything by default, then add explicit limits
Start with every symbol and action blocked. Explicitly allow the accounts, symbols, maximum order size, daily notional, leverage, payment currencies, and order types the agent may use.
The server rejects any order that fails a required rule.
Let the agent research and build an order preview
Let the agent research the market and create a structured order draft. Check it against live market data and account limits, then show a preview with the exact order that would be sent.
The approval screen shows one complete order using current market and account limits.
Approve the exact order and submit it once
Require approval for the exact preview, compare the approved fields with the live request, and submit it once. Any change to the account, symbol, side, amount, price, payment currency, or leverage requires a new preview and approval.
One approval can be used for only one matching submission.
Confirm the result through private events and account data
Confirm the result using Quote.Trade order, account, position, and private-event data. If the result is uncertain, block another order until the first request is resolved.
The agent reports the result confirmed by Quote.Trade, not an assumption from a client message.
Test what happens when something fails
Simulate expired quotes, schema changes, invalid symbols, rate limits, WebSocket disconnects, duplicate requests, changed approvals, insufficient margin, and emergency shutdown. Begin in paper or read-only mode, then use the smallest practical live test.
The kill switch and credential revocation work even when the model is unavailable.
Common problems and fixes
The model keeps adding fields not in the schema
Accept only the fields in the defined order format and discard everything else before showing a preview.
The agent duplicates an order after a timeout
Check the current order and position state before another submission. Do not assume a timed-out request failed.
The model asks for something outside the limits
Reject it. The server-side risk limits always override the prompt.
Private events disconnect
Use backoff, reload authenticated state after reconnecting, and block new orders while the result is uncertain.