Hedge Ratio
primitive.hedge_ratioCalculate the short perpetual futures position size needed to hedge a spot holding. Default USDT-linear: sizes and costs in USD. With contractType "inverse" (coin-margined, needs entryPrice) the short is the same USD contracts and margin and funding come back in the base coin. Edge cases: spotSize above zero (USD value); hedgeRatio 0 to 200 percent (default 100); leverage 1 or more (default 1); fundingRatePct in percent per interval (0.01 is 0.01%, default 0.01); intervalHours 0.25 to 24 (default 8); an inverse contract needs entryPrice. Not covered: basis risk between spot and the perp, rebalancing as prices move, margin calls, and a funding rate that changes. Use when user asks "how much should I short to hedge my BTC?" or "what margin do I need for a 100% hedge?". Returns: perpNotional, requiredMargin, dailyFundingCost, annualFundingCost, hedgeCoverage, contractType and costUnit ("USD", or "base_coin" for inverse: read it before showing margin or funding as dollars). Inverse converts at the one entryPrice you give, so the coin figures assume the price stays there.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"spotSize": "<spotSize>"
},
"name": "primitive.hedge_ratio"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| leverage | No | Leverage on the perp short. Default 1. | |
| spotSize | Yes | Spot position value in USDT | |
| entryPrice | No | Coin price in USD. Required for contractType inverse (converts the USD margin and funding to coin); ignored for linear. | |
| hedgeRatio | No | Percentage of spot to hedge, e.g. 100 for full hedge, 50 for half. Default 100. | |
| contractType | No | linear = USDT-margined (default). inverse = coin-margined: spotSize stays the USD value of the holding, requiredMargin and the funding costs are returned in the base coin. | |
| intervalHours | No | Hours between funding payments, the period fundingRatePct covers. Default 8 (3 payments a day); 1 on Hyperliquid, dYdX, Kraken and Backpack (per-hour rates); 4 or 2 on some symbols of Binance, Bybit, OKX, Gate, KuCoin, MEXC, Aster and Phemex. | |
| fundingRatePct | No | Current funding rate per funding interval in PERCENT: 0.01 means 0.01%, so a quoted 0.0125% is 0.0125 (per 8h unless intervalHours says otherwise). Used for cost estimate. |