Funding Cost
workflow.run_funding_costCalculate the total funding cost (or income) for holding a perpetual futures position. Edge cases: sizeBase, entryPrice and days above zero; fundingRate a fraction per interval (0.0001 is 0.01%), either sign; intervalHours 0.25 to 24 (default 8); if funding exceeds the position notional there is no finite price shift that offsets it, which is an error. Not covered: a funding rate that changes during the hold, and price moves. Use when user asks "how much funding will I pay holding X days?" or "is funding eating my profit?". Returns: totalCost (positive = you pay, negative = you receive; in the coin for inverse), costPerDay, annualPct, totalPeriods, breakevenShift (size of the price move whose PnL equals the funding: up for a positive rate, down for a negative one, for either side).
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": {
"side": "<side>",
"sizeBase": "<sizeBase>",
"entryPrice": "<entryPrice>",
"fundingRate": "<fundingRate>",
"days": "<days>"
},
"name": "workflow.run_funding_cost"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days | Yes | Number of days to hold | |
| side | Yes | Trade direction: "long" or "short" | |
| sizeBase | Yes | Position size in base asset | |
| entryPrice | Yes | Entry price | |
| fundingRate | Yes | Funding rate per funding interval as a DECIMAL FRACTION, not a percent: 0.0001 means 0.01%, so a quoted 0.0125% is 0.000125 (per 8h unless intervalHours says otherwise) | |
| contractType | No | linear = USDT-margined (default), inverse = coin-margined. For inverse, sizeBase is USD contracts and cost figures come out in the base coin. | |
| intervalHours | No | Hours between funding payments, which is the period fundingRate covers. Default 8 (3 payments a day); 1 on Hyperliquid, dYdX, Kraken and Backpack, 4 or 2 on some symbols of Binance, Bybit, OKX, Gate, KuCoin, MEXC, Aster and Phemex. |