Skip to main content

POST /v1/validate

The core endpoint. Analyzes a proposed trade against real-time market data and returns a structured risk assessment.

Request

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

Headers

HeaderRequiredValue
AuthorizationYesBearer YOUR_API_KEY
Content-TypeYesapplication/json

Body

{
"asset": "BTC",
"action": "long",
"size": 50000,
"leverage": 10,
"wallet": "0x7a3b1234567890abcdef1234567890abcdef1234",
"mode": "cross"
}
FieldTypeRequiredDescription
assetstringYesAsset ticker (e.g. "BTC", "ETH", "HYPE")
actionstringYesTrade direction: "long", "short", or "close"
sizenumberYesPosition size in USD. Must be positive, max $100,000,000
leveragenumberNoLeverage multiplier. Cannot exceed the asset's maximum leverage
walletstringYesEthereum wallet address (42 characters, 0x prefix)
modestringNoMargin mode: "cross" (default) or "isolated"

Validation Rules

  • wallet must be a valid 42-character hex address starting with 0x
  • size must be positive and not exceed $100M
  • leverage cannot exceed the asset's maximum allowed leverage
  • asset must be a currently listed (not delisted) asset on Hyperliquid
  • Some assets are isolated-margin only and will reject "cross" mode

Response

{
"risk_score": 42,
"recommendation": "proceed_with_caution",
"flags": ["funding_anomaly"],
"slippage": {
"estimated_bps": 5.2,
"fill_price": 67432.10,
"depth_at_50bps": 2150000,
"depth_at_100bps": 4800000,
"book_imbalance": 0.62
},
"liquidation": {
"price": 61200.50,
"distance_pct": 9.2,
"margin_usage_pct": 68.4,
"effective_leverage": 10.8
},
"funding": {
"rate_8h": 0.0089,
"annualized_pct": 9.7,
"cex_divergence": 0.0034,
"direction": "longs_pay"
},
"impact": {
"expected_bps": 8.1,
"participation_pct": 2.3
},
"var": {
"var_95_pct": 4.2,
"var_99_pct": 6.8,
"var_95_usd": 2100,
"var_99_usd": 3400,
"expected_shortfall_pct": 5.1
},
"oi": {
"current": 485000000,
"at_cap": false,
"utilization_pct": 72.3
},
"portfolio": {
"portfolio_var_pct": 5.1,
"position_count": 3
},
"stress": {
"worst_scenario": "luna_collapse",
"worst_pnl_usd": -18500
},
"fees": {
"estimated_open_fee": 12.50,
"estimated_close_fee": 12.50
},
"meta": {
"asset": "BTC",
"mark_price": 67500.00,
"max_leverage": 50,
"latency_ms": 52,
"request_id": "req_d4f8a2b1"
}
}

Response Fields

FieldTypeDescription
risk_scorenumberComposite risk score from 0 (lowest risk) to 100 (highest risk)
recommendationstring"proceed", "proceed_with_caution", or "abort"
flagsstring[]Array of risk flags identifying specific concerns. See Risk Flags
slippageobjectOrder book slippage analysis
liquidationobjectLiquidation proximity metrics
fundingobjectFunding rate analysis
impactobjectMarket impact estimation
varobjectValue-at-Risk calculations
oiobjectOpen interest utilization
portfolioobjectPortfolio-level risk (when wallet has existing positions)
stressobjectStress test results against historical scenarios
feesobjectEstimated trading fees
metaobjectRequest metadata including current mark price and latency

Slippage Object

FieldTypeDescription
estimated_bpsnumberExpected slippage in basis points
fill_pricenumberEstimated average fill price
depth_at_50bpsnumberUSD liquidity available within 50bps of mid
depth_at_100bpsnumberUSD liquidity available within 100bps of mid
book_imbalancenumberOrder book imbalance ratio (0-1). Values near 0.5 indicate balance

Liquidation Object

FieldTypeDescription
pricenumberEstimated liquidation price
distance_pctnumberDistance from mark price to liquidation as percentage
margin_usage_pctnumberPercentage of available margin consumed
effective_leveragenumberEffective leverage accounting for existing positions

Funding Object

FieldTypeDescription
rate_8hnumberCurrent 8-hour funding rate
annualized_pctnumberProjected annualized funding cost as percentage
cex_divergencenumberDivergence between Hyperliquid and CEX funding rates
directionstring"longs_pay" or "shorts_pay"

Impact Object

FieldTypeDescription
expected_bpsnumberEstimated market impact in basis points
participation_pctnumberTrade size as percentage of recent volume

VaR Object

FieldTypeDescription
var_95_pctnumber24-hour Value-at-Risk at 95% confidence (percentage)
var_99_pctnumber24-hour Value-at-Risk at 99% confidence (percentage)
var_95_usdnumber95% VaR in USD
var_99_usdnumber99% VaR in USD
expected_shortfall_pctnumberExpected Shortfall (CVaR) as percentage

OI Object

FieldTypeDescription
currentnumberCurrent open interest in USD
at_capbooleanWhether the asset is at Hyperliquid's OI cap
utilization_pctnumberOI as percentage of estimated cap

Meta Object

FieldTypeDescription
assetstringAsset ticker
mark_pricenumberCurrent mark price
max_leveragenumberMaximum allowed leverage for this asset
latency_msnumberServer-side processing time in milliseconds
request_idstringUnique identifier for this request