# Models

## The Error object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"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."}}}}}}
```

## The FundingRateEntry object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"FundingRateEntry":{"type":"object","required":["timestamp","exchange","coin","rate_1h","daily_yield","apr"],"properties":{"timestamp":{"type":"integer","format":"int64","description":"Unix timestamp of the settlement in seconds."},"exchange":{"type":"string","description":"Exchange name."},"coin":{"type":"string","description":"Asset symbol."},"rate_1h":{"type":"number","format":"double","description":"Normalized 1-hour funding rate as a decimal (not percent). Positive means longs pay shorts."},"daily_yield":{"type":"number","format":"double","description":"Daily yield in percent (rate_1h * 24 * 100)."},"apr":{"type":"number","format":"double","description":"Annualized percentage rate (rate_1h * 8760 * 100)."}}}}}}
```

## The FundingRatesResponse object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"FundingRatesResponse":{"type":"object","required":["coin","rates","current"],"properties":{"coin":{"type":"string"},"rates":{"type":"array","items":{"$ref":"#/components/schemas/FundingRateEntry"},"description":"Up to 2160 hourly settlements (90 days)."},"current":{"$ref":"#/components/schemas/FundingRateEntry","description":"Most recent settlement record."}}},"FundingRateEntry":{"type":"object","required":["timestamp","exchange","coin","rate_1h","daily_yield","apr"],"properties":{"timestamp":{"type":"integer","format":"int64","description":"Unix timestamp of the settlement in seconds."},"exchange":{"type":"string","description":"Exchange name."},"coin":{"type":"string","description":"Asset symbol."},"rate_1h":{"type":"number","format":"double","description":"Normalized 1-hour funding rate as a decimal (not percent). Positive means longs pay shorts."},"daily_yield":{"type":"number","format":"double","description":"Daily yield in percent (rate_1h * 24 * 100)."},"apr":{"type":"number","format":"double","description":"Annualized percentage rate (rate_1h * 8760 * 100)."}}}}}}
```

## The OrderBookLevel object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"OrderBookLevel":{"type":"object","required":["price","size","total"],"properties":{"price":{"type":"number","format":"double","description":"Price level."},"size":{"type":"number","format":"double","description":"Size available at this price level (coin units)."},"total":{"type":"number","format":"double","description":"Cumulative size from the best price to this level (coin units)."}}}}}}
```

## The OrderBook object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"OrderBook":{"type":"object","required":["coin","time","bids","asks"],"properties":{"coin":{"type":"string","description":"Asset symbol (uppercase). For spot markets this is the HL internal notation (e.g. BTC or @107)."},"time":{"type":"integer","format":"int64","description":"Server-side timestamp of the snapshot in Unix milliseconds."},"bids":{"type":"array","items":{"$ref":"#/components/schemas/OrderBookLevel"},"description":"Bid levels, best bid first (descending price). Up to 16 levels."},"asks":{"type":"array","items":{"$ref":"#/components/schemas/OrderBookLevel"},"description":"Ask levels, best ask first (ascending price). Up to 16 levels."}}},"OrderBookLevel":{"type":"object","required":["price","size","total"],"properties":{"price":{"type":"number","format":"double","description":"Price level."},"size":{"type":"number","format":"double","description":"Size available at this price level (coin units)."},"total":{"type":"number","format":"double","description":"Cumulative size from the best price to this level (coin units)."}}}}}}
```

## The MarketStats object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"MarketStats":{"type":"object","required":["coin","mark_px","oracle_px","change_24h","volume_24h","open_interest","funding_1h","predicted_funding","max_leverage","has_spot","spot_px"],"properties":{"coin":{"type":"string"},"mark_px":{"type":"number","format":"double","description":"Current mark price in USD."},"oracle_px":{"type":"number","format":"double","description":"Oracle (spot reference) price in USD."},"change_24h":{"type":"number","format":"double","description":"24-hour price change in percent."},"volume_24h":{"type":"number","format":"double","description":"24-hour notional trading volume in USD."},"open_interest":{"type":"number","format":"double","description":"Current total open interest in USD notional."},"funding_1h":{"type":"number","format":"double","description":"Current 1-hour funding rate as a decimal. Positive means longs pay shorts."},"predicted_funding":{"type":"number","format":"double","description":"Predicted next-settlement 1-hour rate from Hyperliquid."},"max_leverage":{"type":"integer","description":"Maximum leverage available for this market."},"has_spot":{"type":"boolean","description":"Whether a spot market exists on Hyperliquid for delta-neutral trading."},"spot_px":{"type":"number","format":"double","description":"Current spot mid price in USD. Zero if no liquid spot market exists."}}}}}}
```

## The CoinInfo object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"CoinInfo":{"type":"object","required":["name","max_leverage","mark_px","change_24h","volume_24h","open_interest","funding_1h","predicted_funding","has_spot"],"properties":{"name":{"type":"string","description":"Asset symbol."},"max_leverage":{"type":"integer","description":"Maximum leverage for this market."},"mark_px":{"type":"number","format":"double","description":"Current mark price in USD."},"change_24h":{"type":"number","format":"double","description":"24-hour price change in percent."},"volume_24h":{"type":"number","format":"double","description":"24-hour notional volume in USD."},"open_interest":{"type":"number","format":"double","description":"Total open interest in USD notional."},"funding_1h":{"type":"number","format":"double","description":"Current 1-hour funding rate (decimal, not percent). Positive means longs pay shorts."},"predicted_funding":{"type":"number","format":"double","description":"Predicted next settlement 1-hour rate from Hyperliquid."},"has_spot":{"type":"boolean","description":"Whether a native spot market exists on Hyperliquid for this coin."}}}}}}
```

## The CoinsResponse object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"CoinsResponse":{"type":"object","required":["coins"],"properties":{"coins":{"type":"array","items":{"$ref":"#/components/schemas/CoinInfo"}}}},"CoinInfo":{"type":"object","required":["name","max_leverage","mark_px","change_24h","volume_24h","open_interest","funding_1h","predicted_funding","has_spot"],"properties":{"name":{"type":"string","description":"Asset symbol."},"max_leverage":{"type":"integer","description":"Maximum leverage for this market."},"mark_px":{"type":"number","format":"double","description":"Current mark price in USD."},"change_24h":{"type":"number","format":"double","description":"24-hour price change in percent."},"volume_24h":{"type":"number","format":"double","description":"24-hour notional volume in USD."},"open_interest":{"type":"number","format":"double","description":"Total open interest in USD notional."},"funding_1h":{"type":"number","format":"double","description":"Current 1-hour funding rate (decimal, not percent). Positive means longs pay shorts."},"predicted_funding":{"type":"number","format":"double","description":"Predicted next settlement 1-hour rate from Hyperliquid."},"has_spot":{"type":"boolean","description":"Whether a native spot market exists on Hyperliquid for this coin."}}}}}}
```

## The Candle object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"Candle":{"type":"object","required":["t","o","h","l","c","v","n"],"properties":{"t":{"type":"integer","format":"int64","description":"Open time in Unix milliseconds."},"o":{"type":"number","format":"double","description":"Open price."},"h":{"type":"number","format":"double","description":"High price."},"l":{"type":"number","format":"double","description":"Low price."},"c":{"type":"number","format":"double","description":"Close price."},"v":{"type":"number","format":"double","description":"Base volume (coin units) for the interval."},"n":{"type":"integer","description":"Number of trades during the interval."}}}}}}
```

## The CandlesResponse object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"CandlesResponse":{"type":"object","required":["coin","interval","perp","spot"],"properties":{"coin":{"type":"string"},"interval":{"type":"string","enum":["1m","5m","15m","1h","4h","1d"]},"perp":{"type":"array","items":{"$ref":"#/components/schemas/Candle"},"description":"OHLCV candles for the perpetual market. Up to 30 days of history."},"spot":{"type":"array","items":{"$ref":"#/components/schemas/Candle"},"description":"OHLCV candles for the spot market. Empty array if no liquid spot market exists."}}},"Candle":{"type":"object","required":["t","o","h","l","c","v","n"],"properties":{"t":{"type":"integer","format":"int64","description":"Open time in Unix milliseconds."},"o":{"type":"number","format":"double","description":"Open price."},"h":{"type":"number","format":"double","description":"High price."},"l":{"type":"number","format":"double","description":"Low price."},"c":{"type":"number","format":"double","description":"Close price."},"v":{"type":"number","format":"double","description":"Base volume (coin units) for the interval."},"n":{"type":"integer","description":"Number of trades during the interval."}}}}}}
```

## The IndicatorPoint object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"IndicatorPoint":{"type":"object","required":["t","cvd","oi","ll","sl","bv","sv"],"properties":{"t":{"type":"integer","format":"int64","description":"Bucket open time in Unix seconds."},"cvd":{"type":"number","format":"double","description":"Cumulative Volume Delta in USD for this 5-minute bucket. Positive means buyers dominated."},"oi":{"type":"number","format":"double","description":"Open interest in USD at the end of the bucket."},"ll":{"type":"number","format":"double","description":"Long liquidation volume in USD during the bucket."},"sl":{"type":"number","format":"double","description":"Short liquidation volume in USD during the bucket."},"bv":{"type":"number","format":"double","description":"Buy volume in USD during the bucket."},"sv":{"type":"number","format":"double","description":"Sell volume in USD during the bucket."}}}}}}
```

## The IndicatorsResponse object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"IndicatorsResponse":{"type":"object","required":["coin","points"],"properties":{"coin":{"type":"string"},"points":{"type":"array","items":{"$ref":"#/components/schemas/IndicatorPoint"},"description":"5-minute microstructure signal buckets for the last 30 days. Up to 8640 points."}}},"IndicatorPoint":{"type":"object","required":["t","cvd","oi","ll","sl","bv","sv"],"properties":{"t":{"type":"integer","format":"int64","description":"Bucket open time in Unix seconds."},"cvd":{"type":"number","format":"double","description":"Cumulative Volume Delta in USD for this 5-minute bucket. Positive means buyers dominated."},"oi":{"type":"number","format":"double","description":"Open interest in USD at the end of the bucket."},"ll":{"type":"number","format":"double","description":"Long liquidation volume in USD during the bucket."},"sl":{"type":"number","format":"double","description":"Short liquidation volume in USD during the bucket."},"bv":{"type":"number","format":"double","description":"Buy volume in USD during the bucket."},"sv":{"type":"number","format":"double","description":"Sell volume in USD during the bucket."}}}}}}
```

## The FlowBucket object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"FlowBucket":{"type":"object","required":["t","cvd","oi","funding","long_liq","short_liq","whale_net"],"properties":{"t":{"type":"integer","format":"int64","description":"Bucket open time in Unix seconds (aligned to requested bucket size)."},"cvd":{"type":"number","format":"double","description":"Cumulative Volume Delta in USD for the bucket."},"oi":{"type":"number","format":"double","description":"Open interest in USD at the end of the bucket."},"funding":{"type":"number","format":"double","description":"Funding rate (1-hour decimal) at the end of the bucket."},"long_liq":{"type":"number","format":"double","description":"Long liquidation volume in USD during the bucket."},"short_liq":{"type":"number","format":"double","description":"Short liquidation volume in USD during the bucket."},"whale_net":{"type":"number","format":"double","description":"Net whale order flow in USD (whale buy volume minus whale sell volume)."}}}}}}
```

## The FlowSummary object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"FlowSummary":{"type":"object","required":["cvd_1h","oi_change_pct","liq_count_1h","risk"],"properties":{"cvd_1h":{"type":"number","format":"double","description":"Total CVD (USD) over the last 1 hour."},"oi_change_pct":{"type":"number","format":"double","description":"Open interest change from the start to the end of the requested window, in percent."},"liq_count_1h":{"type":"integer","description":"Number of liquidation events exceeding $100,000 in the last 1 hour."},"risk":{"type":"string","enum":["green","amber","red"],"description":"Composite risk signal. red = CVD above $5M or more than 3 large liquidations in the last hour; amber = CVD above $1M or more than 1 large liquidation; green = normal conditions."}}}}}}
```

## The FlowResponse object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"FlowResponse":{"type":"object","required":["coin","buckets","summary"],"properties":{"coin":{"type":"string"},"buckets":{"type":"array","items":{"$ref":"#/components/schemas/FlowBucket"}},"summary":{"$ref":"#/components/schemas/FlowSummary"}}},"FlowBucket":{"type":"object","required":["t","cvd","oi","funding","long_liq","short_liq","whale_net"],"properties":{"t":{"type":"integer","format":"int64","description":"Bucket open time in Unix seconds (aligned to requested bucket size)."},"cvd":{"type":"number","format":"double","description":"Cumulative Volume Delta in USD for the bucket."},"oi":{"type":"number","format":"double","description":"Open interest in USD at the end of the bucket."},"funding":{"type":"number","format":"double","description":"Funding rate (1-hour decimal) at the end of the bucket."},"long_liq":{"type":"number","format":"double","description":"Long liquidation volume in USD during the bucket."},"short_liq":{"type":"number","format":"double","description":"Short liquidation volume in USD during the bucket."},"whale_net":{"type":"number","format":"double","description":"Net whale order flow in USD (whale buy volume minus whale sell volume)."}}},"FlowSummary":{"type":"object","required":["cvd_1h","oi_change_pct","liq_count_1h","risk"],"properties":{"cvd_1h":{"type":"number","format":"double","description":"Total CVD (USD) over the last 1 hour."},"oi_change_pct":{"type":"number","format":"double","description":"Open interest change from the start to the end of the requested window, in percent."},"liq_count_1h":{"type":"integer","description":"Number of liquidation events exceeding $100,000 in the last 1 hour."},"risk":{"type":"string","enum":["green","amber","red"],"description":"Composite risk signal. red = CVD above $5M or more than 3 large liquidations in the last hour; amber = CVD above $1M or more than 1 large liquidation; green = normal conditions."}}}}}}
```

## The CrowdPoint object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"CrowdPoint":{"type":"object","required":["oi_value_usd","snapshot_time"],"properties":{"long_pct":{"type":"number","format":"double","nullable":true,"description":"Percentage of accounts holding long positions (0-100). Null if no Binance/Bybit data is available."},"short_pct":{"type":"number","format":"double","nullable":true,"description":"Percentage of accounts holding short positions (0-100). Null if no Binance/Bybit data is available."},"ls_ratio":{"type":"number","format":"double","nullable":true,"description":"Long/short account ratio (long_pct / short_pct). Null if unavailable."},"taker_bs_ratio":{"type":"number","format":"double","nullable":true,"description":"Taker buy/sell volume ratio. Values above 1 mean more buy-side taker aggression. Null if unavailable."},"oi_value_usd":{"type":"number","format":"double","description":"Open interest value in USD (from Hyperliquid)."},"snapshot_time":{"type":"string","description":"Timestamp of the snapshot as an ISO 8601 string."}}}}}}
```

## The CrowdEntry object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"CrowdEntry":{"type":"object","required":["symbol","oi_value_usd"],"properties":{"symbol":{"type":"string","description":"Asset symbol with USDT suffix as stored in the database (e.g. BTCUSDT)."},"long_pct":{"type":"number","format":"double","nullable":true,"description":"Percentage of accounts holding long positions. Null if no cross-exchange data is available."},"short_pct":{"type":"number","format":"double","nullable":true,"description":"Percentage of accounts holding short positions. Null if no cross-exchange data is available."},"ls_ratio":{"type":"number","format":"double","nullable":true,"description":"Long/short account ratio. Null if unavailable."},"taker_bs_ratio":{"type":"number","format":"double","nullable":true,"description":"Taker buy/sell volume ratio. Null if unavailable."},"oi_value_usd":{"type":"number","format":"double","description":"Open interest value in USD from Hyperliquid."}}}}}}
```

## The CrowdLeaderboardResponse object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"CrowdLeaderboardResponse":{"type":"object","required":["entries"],"properties":{"entries":{"type":"array","items":{"$ref":"#/components/schemas/CrowdEntry"}}}},"CrowdEntry":{"type":"object","required":["symbol","oi_value_usd"],"properties":{"symbol":{"type":"string","description":"Asset symbol with USDT suffix as stored in the database (e.g. BTCUSDT)."},"long_pct":{"type":"number","format":"double","nullable":true,"description":"Percentage of accounts holding long positions. Null if no cross-exchange data is available."},"short_pct":{"type":"number","format":"double","nullable":true,"description":"Percentage of accounts holding short positions. Null if no cross-exchange data is available."},"ls_ratio":{"type":"number","format":"double","nullable":true,"description":"Long/short account ratio. Null if unavailable."},"taker_bs_ratio":{"type":"number","format":"double","nullable":true,"description":"Taker buy/sell volume ratio. Null if unavailable."},"oi_value_usd":{"type":"number","format":"double","description":"Open interest value in USD from Hyperliquid."}}}}}}
```

## The PortfolioPosition object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"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."}}}}}}
```

## The Portfolio object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"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."}}}}}}
```

## The ChartPoint object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"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)."}}}}}}
```

## The ChartDataResponse object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"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)."}}}}}}
```

## The TradeFill object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"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\")."}}}}}}
```

## The TradeHistoryResponse object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"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\")."}}}}}}
```

## The OpenOrder object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"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."}}}}}}
```

## The OrdersResponse object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"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."}}}}}}
```

## The OpenPositionRequest object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"OpenPositionRequest":{"type":"object","required":["coin","side","size"],"properties":{"coin":{"type":"string","description":"Asset symbol (uppercase)."},"side":{"type":"string","enum":["long","short"],"description":"Position direction. In delta-neutral (pro) mode with side=long, the negative-funding path is blocked until the HyperEVM lending vault launches."},"size":{"type":"number","format":"double","description":"Position size in USDC notional."},"leverage":{"type":"integer","minimum":1,"maximum":10,"default":1,"description":"Leverage multiplier. Defaults to 1."},"orderType":{"type":"string","enum":["market","limit","pro"],"default":"market","description":"Order type. pro triggers delta-neutral two-leg execution (perp + spot)."},"limitPrice":{"type":"number","format":"double","description":"Required when orderType is limit. Ignored for market orders."},"reduceOnly":{"type":"boolean","default":false,"description":"If true, the order only reduces an existing position."},"tpPrice":{"type":"number","format":"double","description":"Take profit trigger price. Set to 0 or omit to disable."},"slPrice":{"type":"number","format":"double","description":"Stop loss trigger price. Set to 0 or omit to disable."},"spotLimitPrice":{"type":"number","format":"double","description":"Spot leg limit price for delta-neutral (pro) orders. Set to 0 or omit for market execution."}}}}}}
```

## The OpenPositionResponse object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"OpenPositionResponse":{"type":"object","required":["message","coin","side","size"],"properties":{"message":{"type":"string"},"coin":{"type":"string"},"side":{"type":"string","enum":["long","short"]},"size":{"type":"number","format":"double","description":"Size in coin units that was submitted."}}}}}}
```

## The DNOpenPositionResponse object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"DNOpenPositionResponse":{"type":"object","required":["message","coin","perpSide","spotSide","size"],"properties":{"message":{"type":"string"},"coin":{"type":"string"},"perpSide":{"type":"string","enum":["long","short"]},"spotSide":{"type":"string","enum":["buy","sell"]},"size":{"type":"number","format":"double","description":"Size in coin units for each leg."}}}}}}
```

## The Strategy object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"Strategy":{"type":"object","required":["id","coin","type","condition","threshold","active","created_at"],"properties":{"id":{"type":"string","format":"uuid","description":"Strategy UUID."},"coin":{"type":"string","description":"Asset symbol this strategy monitors."},"type":{"type":"string","enum":["auto_close"],"description":"Strategy type. Currently only auto_close is supported."},"condition":{"type":"string","enum":["above","below"],"description":"Trigger condition relative to the threshold."},"threshold":{"type":"number","format":"double","description":"1-hour funding rate threshold (decimal, not percent) that triggers the strategy."},"active":{"type":"boolean","description":"Whether the strategy is currently running."},"triggered_at":{"type":"string","format":"date-time","nullable":true,"description":"Timestamp of the last trigger event. Null if never triggered."},"created_at":{"type":"string","format":"date-time","description":"Creation timestamp."}}}}}}
```

## The CreateStrategyRequest object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"CreateStrategyRequest":{"type":"object","required":["coin","type","condition","threshold"],"properties":{"coin":{"type":"string","description":"Asset symbol to monitor (uppercase)."},"type":{"type":"string","enum":["auto_close"],"description":"Strategy type. Only auto_close is currently supported."},"condition":{"type":"string","enum":["above","below"],"description":"Trigger condition. above = trigger when rate exceeds threshold; below = trigger when rate falls below threshold."},"threshold":{"type":"number","format":"double","description":"1-hour funding rate threshold as a decimal (e.g. 0.000005 = 0.0005% per hour)."}}}}}}
```

## The StrategiesResponse object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"StrategiesResponse":{"type":"object","required":["strategies"],"properties":{"strategies":{"type":"array","items":{"$ref":"#/components/schemas/Strategy"}}}},"Strategy":{"type":"object","required":["id","coin","type","condition","threshold","active","created_at"],"properties":{"id":{"type":"string","format":"uuid","description":"Strategy UUID."},"coin":{"type":"string","description":"Asset symbol this strategy monitors."},"type":{"type":"string","enum":["auto_close"],"description":"Strategy type. Currently only auto_close is supported."},"condition":{"type":"string","enum":["above","below"],"description":"Trigger condition relative to the threshold."},"threshold":{"type":"number","format":"double","description":"1-hour funding rate threshold (decimal, not percent) that triggers the strategy."},"active":{"type":"boolean","description":"Whether the strategy is currently running."},"triggered_at":{"type":"string","format":"date-time","nullable":true,"description":"Timestamp of the last trigger event. Null if never triggered."},"created_at":{"type":"string","format":"date-time","description":"Creation timestamp."}}}}}}
```

## The AutopilotBalance object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"AutopilotBalance":{"type":"object","required":["perp_withdrawable","spot_usdc","total"],"properties":{"perp_withdrawable":{"type":"number","format":"double","description":"Withdrawable USDC balance in the perpetuals account."},"spot_usdc":{"type":"number","format":"double","description":"USDC balance in the spot account."},"total":{"type":"number","format":"double","description":"Sum of perp_withdrawable and spot_usdc."}}}}}}
```

## The AutopilotPositionEntry object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"AutopilotPositionEntry":{"type":"object","required":["id","coin","size_usd","spot_px","spot_sz","perp_px","perp_sz","opened_at"],"properties":{"id":{"type":"string","format":"uuid","description":"Autopilot position record UUID."},"coin":{"type":"string"},"size_usd":{"type":"number","format":"double","description":"Total USD notional of the position."},"spot_px":{"type":"number","format":"double","description":"Spot leg entry price in USD."},"spot_sz":{"type":"number","format":"double","description":"Spot leg size in coin units."},"perp_px":{"type":"number","format":"double","description":"Perp leg entry price in USD."},"perp_sz":{"type":"number","format":"double","description":"Perp leg size in coin units."},"opened_at":{"type":"string","format":"date-time","description":"Timestamp when the position was opened."}}}}}}
```

## The AutopilotStats object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"AutopilotStats":{"type":"object","required":["open_count","closed_count"],"properties":{"open_count":{"type":"integer","description":"Number of currently open autopilot positions."},"closed_count":{"type":"integer","description":"Total number of closed autopilot positions across all time."}}}}}}
```

## The AutopilotStatus object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"AutopilotStatus":{"type":"object","required":["enabled","hl_account","agent_approved","balance","positions","stats"],"properties":{"enabled":{"type":"boolean","description":"Whether autopilot is currently active for this user."},"hl_account":{"type":"string","description":"User's Hyperliquid account address linked to the agent wallet. Empty string if not set up."},"agent_approved":{"type":"boolean","description":"Whether the user has approved the agent wallet via approveAgent on Hyperliquid."},"max_usdc":{"type":"number","format":"double","nullable":true,"description":"Maximum USDC the autopilot is allowed to deploy. Null means no cap."},"balance":{"$ref":"#/components/schemas/AutopilotBalance"},"positions":{"type":"array","items":{"$ref":"#/components/schemas/AutopilotPositionEntry"}},"stats":{"$ref":"#/components/schemas/AutopilotStats"}}},"AutopilotBalance":{"type":"object","required":["perp_withdrawable","spot_usdc","total"],"properties":{"perp_withdrawable":{"type":"number","format":"double","description":"Withdrawable USDC balance in the perpetuals account."},"spot_usdc":{"type":"number","format":"double","description":"USDC balance in the spot account."},"total":{"type":"number","format":"double","description":"Sum of perp_withdrawable and spot_usdc."}}},"AutopilotPositionEntry":{"type":"object","required":["id","coin","size_usd","spot_px","spot_sz","perp_px","perp_sz","opened_at"],"properties":{"id":{"type":"string","format":"uuid","description":"Autopilot position record UUID."},"coin":{"type":"string"},"size_usd":{"type":"number","format":"double","description":"Total USD notional of the position."},"spot_px":{"type":"number","format":"double","description":"Spot leg entry price in USD."},"spot_sz":{"type":"number","format":"double","description":"Spot leg size in coin units."},"perp_px":{"type":"number","format":"double","description":"Perp leg entry price in USD."},"perp_sz":{"type":"number","format":"double","description":"Perp leg size in coin units."},"opened_at":{"type":"string","format":"date-time","description":"Timestamp when the position was opened."}}},"AutopilotStats":{"type":"object","required":["open_count","closed_count"],"properties":{"open_count":{"type":"integer","description":"Number of currently open autopilot positions."},"closed_count":{"type":"integer","description":"Total number of closed autopilot positions across all time."}}}}}}
```

## The SubscriptionStatus object

```json
{"openapi":"3.1.0","info":{"title":"Zirodelta API","version":"1.0.0"},"components":{"schemas":{"SubscriptionStatus":{"type":"object","required":["tier","price","treasury"],"properties":{"tier":{"type":"string","enum":["free","pro"],"description":"Current subscription tier."},"expires_at":{"type":"string","format":"date-time","nullable":true,"description":"Pro expiry timestamp. Null for free tier."},"price":{"type":"string","description":"Current subscription price in USDC (as string matching the on-chain amount)."},"treasury":{"type":"string","description":"Zirodelta treasury address to send payment to via usdSend."}}}}}}
```


---

# 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/models.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.
