market_positions
Fetch open positions for any wallet on Hyperliquid, displaying entries, sizes, unrealized PnL, and leverage.
Instructions
Get all open positions for any wallet address on Hyperliquid. Shows current entries, sizes, unrealized PnL, and leverage for each position.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| useToonFormat | No | Return data in compact toon format (default: true). Set to false for standard JSON. | |
| address | Yes | Ethereum wallet address (0x...) |
Implementation Reference
- src/index.ts:467-480 (registration)Registration of the 'market_positions' tool using server.registerTool(). The tool is registered under the name 'market_positions' with a description and input schema requiring an Ethereum address.
// ══════════════════════════════════════════════════════════ // TOOL 10: Wallet Positions // ══════════════════════════════════════════════════════════ if (shouldRegister("market_positions")) server.registerTool( "market_positions", { description: "Get all open positions for any wallet address on Hyperliquid. Shows current entries, sizes, unrealized PnL, and leverage for each position.", inputSchema: { useToonFormat: useToonFormatSchema, address: ethAddressSchema, }, }, async ({ useToonFormat, address }) => toolResult(await callAPI(useToonFormat, `/market/positions/${address}`)) ); - src/index.ts:479-480 (handler)Handler for 'market_positions': calls the API endpoint /market/positions/{address} with the provided wallet address.
async ({ useToonFormat, address }) => toolResult(await callAPI(useToonFormat, `/market/positions/${address}`)) ); - src/index.ts:471-477 (schema)Input schema for market_positions: accepts useToonFormat (boolean) and address (validated Ethereum address via ethAddressSchema regex).
"market_positions", { description: "Get all open positions for any wallet address on Hyperliquid. Shows current entries, sizes, unrealized PnL, and leverage for each position.", inputSchema: { useToonFormat: useToonFormatSchema, address: ethAddressSchema, }, - build/index.js:314-323 (registration)Registration of the 'market_positions' tool in the built/compiled JS version (build/index.js). Same structure: registerTool with ethAddressSchema.
// TOOL 10: Wallet Positions // ══════════════════════════════════════════════════════════ if (shouldRegister("market_positions")) server.registerTool("market_positions", { description: "Get all open positions for any wallet address on Hyperliquid. Shows current entries, sizes, unrealized PnL, and leverage for each position.", inputSchema: { useToonFormat: useToonFormatSchema, address: ethAddressSchema, }, }, async ({ useToonFormat, address }) => toolResult(await callAPI(useToonFormat, `/market/positions/${address}`))); - build/index.js:323-323 (handler)Handler in the built version: calls API at /market/positions/{address}.
}, async ({ useToonFormat, address }) => toolResult(await callAPI(useToonFormat, `/market/positions/${address}`)));