Skip to main content

POST /v1/validate/batch

Validate multiple trades in sequence. Each trade is evaluated against the wallet state that would result from all preceding trades being executed, allowing you to assess correlated position risk.

Request

POST https://api.canon.trade/v1/validate/batch

Headers

HeaderRequiredValue
AuthorizationYesBearer YOUR_API_KEY
Content-TypeYesapplication/json

Body

{
"wallet": "0x7a3b1234567890abcdef1234567890abcdef1234",
"trades": [
{
"asset": "BTC",
"action": "long",
"size": 50000,
"leverage": 10,
"mode": "cross"
},
{
"asset": "ETH",
"action": "long",
"size": 30000,
"leverage": 5,
"mode": "cross"
}
]
}
FieldTypeRequiredDescription
walletstringYesEthereum wallet address (42 characters, 0x prefix)
tradesarrayYesArray of trade objects (1-50 trades)
trades[].assetstringYesAsset ticker
trades[].actionstringYes"long", "short", or "close"
trades[].sizenumberYesPosition size in USD
trades[].leveragenumberNoLeverage multiplier
trades[].modestringNo"cross" (default) or "isolated"

Validation Rules

  • Maximum of 50 trades per batch
  • The trades array must not be empty
  • All standard validation rules from /v1/validate apply to each trade

Response

Returns an array of ValidateResponse objects, one per trade. Each response reflects the risk assessment as if all preceding trades had been executed.

[
{
"risk_score": 28,
"recommendation": "proceed",
"flags": [],
"slippage": { "..." : "..." },
"liquidation": { "..." : "..." },
"meta": {
"asset": "BTC",
"mark_price": 67500.00,
"latency_ms": 52,
"request_id": "req_batch_001"
}
},
{
"risk_score": 55,
"recommendation": "proceed_with_caution",
"flags": ["correlated_exposure"],
"slippage": { "..." : "..." },
"liquidation": { "..." : "..." },
"meta": {
"asset": "ETH",
"mark_price": 3415.20,
"latency_ms": 48,
"request_id": "req_batch_001"
}
}
]

The second trade (ETH long) may show a higher risk score and correlated_exposure flag because the wallet already has a BTC long from the first trade. This sequential evaluation is a key feature of batch validation.

Use Cases

  • Portfolio construction: Validate a set of positions before opening them
  • Rebalancing: Check the risk of closing some positions and opening others
  • Correlation detection: Identify when multiple trades create concentrated exposure