# Portfolio

Portfolio, equity, funding history, and order management. Require Privy JWT authentication.

## Get portfolio

> Returns the user's current portfolio: account value, withdrawable balance,\
> and all open positions with PnL, liquidation distance, funding rate, and\
> cumulative funding earned.\
> \
> Returns an empty positions array (not an error) if the user has no linked\
> agent wallet or if the database is unavailable.<br>

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"tags":[{"name":"Portfolio","description":"Portfolio, equity, funding history, and order management. Require Privy JWT authentication."}],"servers":[{"url":"https://api.dex.zirodelta.xyz","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Privy-issued JWT. Obtain by connecting your wallet at https://app.zirodelta.com."}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp (seconds) when the current rate limit window resets.","schema":{"type":"integer"}}},"schemas":{"Portfolio":{"type":"object","required":["accountValue","withdrawable","positions"],"properties":{"accountValue":{"type":"number","format":"double","description":"Total account value in USD (cross-margin account)."},"withdrawable":{"type":"number","format":"double","description":"Amount available for withdrawal in USD."},"positions":{"type":"array","items":{"$ref":"#/components/schemas/PortfolioPosition"}}}},"PortfolioPosition":{"type":"object","required":["coin","side","size","notional","entryPrice","markPrice","liqPrice","liqDistancePct","leverage","unrealizedPnl","roe","margin","fundingRate1h","dailyYield","fundingEarned"],"properties":{"coin":{"type":"string","description":"Asset symbol."},"side":{"type":"string","enum":["long","short"],"description":"Position direction."},"size":{"type":"number","format":"double","description":"Position size in coin units (always positive)."},"notional":{"type":"number","format":"double","description":"Position notional value in USD (size * markPrice)."},"entryPrice":{"type":"number","format":"double","description":"Average entry price in USD."},"markPrice":{"type":"number","format":"double","description":"Current mark price in USD."},"liqPrice":{"type":"number","format":"double","description":"Estimated liquidation price in USD."},"liqDistancePct":{"type":"number","format":"double","description":"Distance to liquidation price as a percentage of mark price."},"leverage":{"type":"number","format":"double","description":"Effective leverage (notional / margin)."},"unrealizedPnl":{"type":"number","format":"double","description":"Unrealized PnL in USD."},"roe":{"type":"number","format":"double","description":"Return on equity (unrealized PnL / margin)."},"margin":{"type":"number","format":"double","description":"Margin used by this position in USD."},"fundingRate1h":{"type":"number","format":"double","description":"Current 1-hour funding rate for this coin (decimal). Positive means shorts earn."},"dailyYield":{"type":"number","format":"double","description":"Expected daily funding yield in USD at current rate and notional."},"fundingEarned":{"type":"number","format":"double","description":"Total cumulative funding earned (all time) on this position in USD."}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Human-readable error description."},"retry_after":{"type":"integer","description":"Seconds to wait before retrying. Present only on 429 responses."}}}},"responses":{"Unauthorized":{"description":"Missing or invalid JWT.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooManyRequests":{"description":"Rate limit exceeded.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InternalError":{"description":"Internal server error.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/portfolio":{"get":{"operationId":"getPortfolio","summary":"Get portfolio","description":"Returns the user's current portfolio: account value, withdrawable balance,\nand all open positions with PnL, liquidation distance, funding rate, and\ncumulative funding earned.\n\nReturns an empty positions array (not an error) if the user has no linked\nagent wallet or if the database is unavailable.\n","tags":["Portfolio"],"responses":{"200":{"description":"Current portfolio state.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Portfolio"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalError"}}}}}}
```

## Get equity history

> Returns the user's equity curve as a series of time/value data points,\
> bucketed by the requested period.\
> \
> Bucket durations by period:\
> \- 24h: 1-hour buckets\
> \- 1w (default): 1-day buckets\
> \- 1m: 7-day buckets\
> \- all: 30-day buckets\
> \
> Returns a single current-value point if no historical data is available.<br>

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"tags":[{"name":"Portfolio","description":"Portfolio, equity, funding history, and order management. Require Privy JWT authentication."}],"servers":[{"url":"https://api.dex.zirodelta.xyz","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Privy-issued JWT. Obtain by connecting your wallet at https://app.zirodelta.com."}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp (seconds) when the current rate limit window resets.","schema":{"type":"integer"}}},"schemas":{"ChartDataResponse":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ChartPoint"}}}},"ChartPoint":{"type":"object","required":["time","value"],"properties":{"time":{"type":"integer","format":"int64","description":"Unix timestamp in seconds."},"value":{"type":"number","format":"double","description":"Value at this point (USD)."}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Human-readable error description."},"retry_after":{"type":"integer","description":"Seconds to wait before retrying. Present only on 429 responses."}}}},"responses":{"Unauthorized":{"description":"Missing or invalid JWT.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooManyRequests":{"description":"Rate limit exceeded.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/portfolio/equity-history":{"get":{"operationId":"getEquityHistory","summary":"Get equity history","description":"Returns the user's equity curve as a series of time/value data points,\nbucketed by the requested period.\n\nBucket durations by period:\n- 24h: 1-hour buckets\n- 1w (default): 1-day buckets\n- 1m: 7-day buckets\n- all: 30-day buckets\n\nReturns a single current-value point if no historical data is available.\n","tags":["Portfolio"],"parameters":[{"name":"period","in":"query","required":false,"description":"Time period for the equity history.","schema":{"type":"string","enum":["24h","1w","1m","all"],"default":"1w"}}],"responses":{"200":{"description":"Equity history data points.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChartDataResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}}}}
```

## Get funding payment history

> Returns the user's funding payment history as bucketed time/value data points.\
> Each point represents net funding received (positive) or paid (negative) in USDC\
> during that bucket.\
> \
> Same bucket durations as equity-history.<br>

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"tags":[{"name":"Portfolio","description":"Portfolio, equity, funding history, and order management. Require Privy JWT authentication."}],"servers":[{"url":"https://api.dex.zirodelta.xyz","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Privy-issued JWT. Obtain by connecting your wallet at https://app.zirodelta.com."}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp (seconds) when the current rate limit window resets.","schema":{"type":"integer"}}},"schemas":{"ChartDataResponse":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ChartPoint"}}}},"ChartPoint":{"type":"object","required":["time","value"],"properties":{"time":{"type":"integer","format":"int64","description":"Unix timestamp in seconds."},"value":{"type":"number","format":"double","description":"Value at this point (USD)."}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Human-readable error description."},"retry_after":{"type":"integer","description":"Seconds to wait before retrying. Present only on 429 responses."}}}},"responses":{"Unauthorized":{"description":"Missing or invalid JWT.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooManyRequests":{"description":"Rate limit exceeded.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/portfolio/funding-history":{"get":{"operationId":"getFundingHistory","summary":"Get funding payment history","description":"Returns the user's funding payment history as bucketed time/value data points.\nEach point represents net funding received (positive) or paid (negative) in USDC\nduring that bucket.\n\nSame bucket durations as equity-history.\n","tags":["Portfolio"],"parameters":[{"name":"period","in":"query","required":false,"description":"Time period for the funding history.","schema":{"type":"string","enum":["24h","1w","1m","all"],"default":"1w"}}],"responses":{"200":{"description":"Funding payment history data points.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChartDataResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}}}}
```

## Get trade fill history

> Returns the user's trade fill history for the requested period.\
> Each record represents one fill with side, size, price, fee, and closed PnL.<br>

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"tags":[{"name":"Portfolio","description":"Portfolio, equity, funding history, and order management. Require Privy JWT authentication."}],"servers":[{"url":"https://api.dex.zirodelta.xyz","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Privy-issued JWT. Obtain by connecting your wallet at https://app.zirodelta.com."}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp (seconds) when the current rate limit window resets.","schema":{"type":"integer"}}},"schemas":{"TradeHistoryResponse":{"type":"object","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/TradeFill"}}}},"TradeFill":{"type":"object","required":["time","coin","side","size","price","fee","closedPnl","dir"],"properties":{"time":{"type":"integer","format":"int64","description":"Fill timestamp in Unix seconds."},"coin":{"type":"string"},"side":{"type":"string","enum":["buy","sell"],"description":"Trade side."},"size":{"type":"number","format":"double","description":"Fill size in coin units."},"price":{"type":"number","format":"double","description":"Fill price in USD."},"fee":{"type":"number","format":"double","description":"Fee paid in USD."},"closedPnl":{"type":"number","format":"double","description":"Realized PnL from closing a position, in USD. Zero for opening fills."},"dir":{"type":"string","description":"HL fill direction string (e.g. \"Open Long\", \"Close Long\")."}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Human-readable error description."},"retry_after":{"type":"integer","description":"Seconds to wait before retrying. Present only on 429 responses."}}}},"responses":{"Unauthorized":{"description":"Missing or invalid JWT.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooManyRequests":{"description":"Rate limit exceeded.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/portfolio/trade-history":{"get":{"operationId":"getTradeHistory","summary":"Get trade fill history","description":"Returns the user's trade fill history for the requested period.\nEach record represents one fill with side, size, price, fee, and closed PnL.\n","tags":["Portfolio"],"parameters":[{"name":"period","in":"query","required":false,"description":"Time period for the trade history.","schema":{"type":"string","enum":["24h","1w","1m","all"],"default":"1w"}}],"responses":{"200":{"description":"Trade fill history.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TradeHistoryResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"}}}}}}
```

## Get open orders

> Returns all open limit, take-profit, and stop-loss orders for the authenticated user.\
> Orders are fetched directly from Hyperliquid's \`openOrders\` info endpoint.<br>

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"tags":[{"name":"Portfolio","description":"Portfolio, equity, funding history, and order management. Require Privy JWT authentication."}],"servers":[{"url":"https://api.dex.zirodelta.xyz","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Privy-issued JWT. Obtain by connecting your wallet at https://app.zirodelta.com."}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp (seconds) when the current rate limit window resets.","schema":{"type":"integer"}}},"schemas":{"OrdersResponse":{"type":"object","required":["orders"],"properties":{"orders":{"type":"array","items":{"$ref":"#/components/schemas/OpenOrder"}}}},"OpenOrder":{"type":"object","required":["oid","coin","side","size","origSize","price","type","timestamp"],"properties":{"oid":{"type":"integer","format":"int64","description":"Order ID from Hyperliquid."},"coin":{"type":"string","description":"Asset symbol."},"side":{"type":"string","enum":["long","short"],"description":"Order direction."},"size":{"type":"number","format":"double","description":"Remaining unfilled size in coin units."},"origSize":{"type":"number","format":"double","description":"Original order size in coin units."},"price":{"type":"number","format":"double","description":"Limit price for limit orders; trigger price for TP/SL orders."},"type":{"type":"string","enum":["limit","tp","sl"],"description":"Order type. tp = take profit, sl = stop loss."},"timestamp":{"type":"integer","format":"int64","description":"Order creation timestamp in Unix milliseconds."}}},"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Human-readable error description."},"retry_after":{"type":"integer","description":"Seconds to wait before retrying. Present only on 429 responses."}}}},"responses":{"Unauthorized":{"description":"Missing or invalid JWT.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooManyRequests":{"description":"Rate limit exceeded.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InternalError":{"description":"Internal server error.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"paths":{"/api/orders":{"get":{"operationId":"getOrders","summary":"Get open orders","description":"Returns all open limit, take-profit, and stop-loss orders for the authenticated user.\nOrders are fetched directly from Hyperliquid's `openOrders` info endpoint.\n","tags":["Portfolio"],"responses":{"200":{"description":"List of open orders.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrdersResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"},"502":{"$ref":"#/components/responses/InternalError"}}}}}}
```

## Cancel all open orders

> Cancels all open orders for the authenticated user in a single batch request.\
> Returns the count of cancelled orders.<br>

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"tags":[{"name":"Portfolio","description":"Portfolio, equity, funding history, and order management. Require Privy JWT authentication."}],"servers":[{"url":"https://api.dex.zirodelta.xyz","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Privy-issued JWT. Obtain by connecting your wallet at https://app.zirodelta.com."}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp (seconds) when the current rate limit window resets.","schema":{"type":"integer"}}},"responses":{"Unauthorized":{"description":"Missing or invalid JWT.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooManyRequests":{"description":"Rate limit exceeded.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InternalError":{"description":"Internal server error.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Human-readable error description."},"retry_after":{"type":"integer","description":"Seconds to wait before retrying. Present only on 429 responses."}}}}},"paths":{"/api/orders":{"delete":{"operationId":"cancelAllOrders","summary":"Cancel all open orders","description":"Cancels all open orders for the authenticated user in a single batch request.\nReturns the count of cancelled orders.\n","tags":["Portfolio"],"responses":{"200":{"description":"All orders cancelled.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["cancelled"],"properties":{"cancelled":{"type":"integer","description":"Number of orders that were cancelled."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"},"502":{"$ref":"#/components/responses/InternalError"}}}}}}
```

## Cancel a single order

> Cancels a single order by order ID. The \`coin\` query parameter is required\
> because Hyperliquid's cancel action requires both the order ID and the asset index.<br>

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"tags":[{"name":"Portfolio","description":"Portfolio, equity, funding history, and order management. Require Privy JWT authentication."}],"servers":[{"url":"https://api.dex.zirodelta.xyz","description":"Production"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Privy-issued JWT. Obtain by connecting your wallet at https://app.zirodelta.com."}},"headers":{"X-RateLimit-Limit":{"description":"Maximum requests allowed in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests remaining in the current rate limit window.","schema":{"type":"integer"}},"X-RateLimit-Reset":{"description":"Unix timestamp (seconds) when the current rate limit window resets.","schema":{"type":"integer"}}},"responses":{"BadRequest":{"description":"Invalid request parameters or body.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"Missing or invalid JWT.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooManyRequests":{"description":"Rate limit exceeded.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"InternalError":{"description":"Internal server error.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Error":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Human-readable error description."},"retry_after":{"type":"integer","description":"Seconds to wait before retrying. Present only on 429 responses."}}}}},"paths":{"/api/orders/{oid}":{"delete":{"operationId":"cancelOrder","summary":"Cancel a single order","description":"Cancels a single order by order ID. The `coin` query parameter is required\nbecause Hyperliquid's cancel action requires both the order ID and the asset index.\n","tags":["Portfolio"],"parameters":[{"name":"oid","in":"path","required":true,"description":"Hyperliquid order ID (integer).","schema":{"type":"integer","format":"int64"}},{"name":"coin","in":"query","required":true,"description":"Asset symbol for the order (uppercase). Required to resolve the HL asset index.","schema":{"type":"string"}}],"responses":{"200":{"description":"Order cancelled.","headers":{"X-RateLimit-Limit":{"$ref":"#/components/headers/X-RateLimit-Limit"},"X-RateLimit-Remaining":{"$ref":"#/components/headers/X-RateLimit-Remaining"},"X-RateLimit-Reset":{"$ref":"#/components/headers/X-RateLimit-Reset"}},"content":{"application/json":{"schema":{"type":"object","required":["cancelled"],"properties":{"cancelled":{"type":"integer","format":"int64","description":"Order ID that was cancelled."}}}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooManyRequests"},"502":{"$ref":"#/components/responses/InternalError"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zirodelta.com/api-reference/portfolio.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
