estimate_open_position
Calculate fees and projected position details before opening or increasing a leveraged perpetual futures trade on Jupiter, including liquidation price and total collateral.
Instructions
Estimates fees and resulting position state for opening a new position or increasing an existing one. Returns: (1) fees_to_pay - fees for THIS trade only: open fee, price impact fee, and any accrued borrow fees that will be settled; (2) resulting_position - final state AFTER trade: weighted average entry price, total size, total collateral, leverage, and liquidation price. Does NOT execute the trade. Important: total_collateral_usd includes protocol-specific factors beyond visible fees: (a) USDC price typically ~$0.9997-1.0003, not exactly $1.00; (b) Long positions incur additional swap costs (~0.05%) when converting USDC to the borrowed asset; (c) rounding/slippage. Short positions generally match calculations more closely as they borrow USDC directly. Note: The Jupiter protocol returns slightly lower leverage than requested, with larger differences at higher leverage (e.g., 10x → 9.99x, 100x → 99.47x).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| asset | Yes | The asset to trade | |
| side | Yes | Direction of the trade | |
| collateral_amount | Yes | Amount of USDC to use as collateral (minimum: 10 USD, must be <= wallet balance) | |
| leverage | Yes | Leverage multiplier (added size = collateral * leverage) |