{"components":{"schemas":{"AcceptanceDevice":{"enum":["desktop","phone"],"type":"string"},"AcceptanceScope":{"enum":["all","market"],"type":"string"},"AccountRead":{"properties":{"completedAt":{"type":"string"},"coverage":{"type":"string"},"indexedLoanOnlyLifecycleIds":{"items":{"type":"string"},"type":"array"},"lifetimeNetPnlRead":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/LifetimeNetPnlRead"}]},"liveEnrichment":{"type":"string"},"missingSources":{"items":{"type":"string"},"type":"array"},"page":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/AccountReadPage"}]},"readId":{"format":"uuid","type":"string"},"resource":{"type":"string"},"startedAt":{"type":"string"},"status":{"type":"string"},"unavailableEnrichments":{"items":{"type":"string"},"type":"array"},"underwriter":{"type":["string","null"]},"unindexedJupiterRowIds":{"description":"Always empty. Kept because existing clients require the array.","items":{"type":"string"},"type":"array"},"version":{"format":"int32","minimum":0,"type":"integer"},"visibility":{"type":"string"},"walletAddress":{"type":"string"}},"required":["version","resource","status","walletAddress","visibility","readId","startedAt","completedAt","coverage","missingSources","liveEnrichment","unavailableEnrichments","indexedLoanOnlyLifecycleIds","unindexedJupiterRowIds"],"type":"object"},"AccountReadPage":{"properties":{"limit":{"type":"string"},"offset":{"type":"string"}},"required":["limit","offset"],"type":"object"},"ActionResponse":{"properties":{"actionType":{"type":"string"},"builderFee":{"description":"Builder (integrator) fee charged on this fill, separate from\n`platformFee`.","type":["string","null"]},"collateralAfter":{"type":["string","null"]},"collateralDelta":{"type":["string","null"]},"collateralDeposited":{"type":["string","null"]},"entryPrice":{"type":["string","null"]},"failureDetails":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/UserErrorDetails"}]},"failureReason":{"type":["string","null"]},"forcedCloseReason":{"description":"Set when Imperial closed this leg on the user's behalf rather than at\nthe user's request. `actionType` is unchanged. Legacy: currently only\nappears on historical positions from a retired feature.","type":["string","null"]},"hadSwap":{"type":"boolean"},"hasProfit":{"type":["boolean","null"]},"id":{"type":"string"},"interest":{"type":["string","null"]},"jupiterFee":{"type":["string","null"]},"orderCreatedAt":{"format":"int64","type":["integer","null"]},"orderDcaEndPrice":{"type":["string","null"]},"orderDcaIntervalSeconds":{"format":"int64","type":["integer","null"]},"orderDcaLegNumber":{"format":"int32","type":["integer","null"]},"orderDcaLegTrigger":{"type":["string","null"]},"orderDcaNumLegs":{"format":"int64","type":["integer","null"]},"orderDcaPriceLimit":{"type":["string","null"]},"orderDcaStartPrice":{"type":["string","null"]},"orderExecutionTriggerPrice":{"type":["string","null"]},"orderIndicatorConfig":{"type":["string","null"]},"orderRatchetSize":{"type":["string","null"]},"orderSizeUsd":{"type":["string","null"]},"orderSlippageBps":{"format":"int32","type":["integer","null"]},"orderThresholdValue":{"type":["string","null"]},"orderTriggerDelaySecs":{"format":"int64","type":["integer","null"]},"orderType":{"type":["string","null"]},"orderWaitDurationSecs":{"format":"int64","type":["integer","null"]},"orderWaitPrice":{"type":["string","null"]},"orderWorstPrice":{"type":["string","null"]},"pairsImpactFee":{"description":"Legacy: only set on historical actions from a retired venue.","type":["string","null"]},"platformFee":{"type":["string","null"]},"pnlRealized":{"type":["string","null"]},"positionSizeAfter":{"type":["string","null"]},"postLiquidationPriceUsd":{"type":["string","null"]},"proOrderFee":{"type":["string","null"]},"sequenceNumber":{"format":"int32","type":"integer"},"sizeDelta":{"type":["string","null"]},"sizeDeltaTokens":{"type":["string","null"]},"status":{"type":"string"},"swapSlippage":{"type":["string","null"]},"triggerCondition":{"type":["string","null"]},"triggerPrice":{"type":["string","null"]},"tx1Signature":{"type":"string"},"tx1Timestamp":{"format":"int64","type":"integer"},"tx2Signature":{"type":["string","null"]},"tx2Timestamp":{"format":"int64","type":["integer","null"]},"tx3PlatformFee":{"type":["string","null"]},"tx3Signature":{"type":["string","null"]},"tx3SwapFee":{"type":["string","null"]},"tx3SweepSlippage":{"type":["string","null"]},"tx3Timestamp":{"format":"int64","type":["integer","null"]},"userReceived":{"type":["string","null"]}},"required":["id","actionType","status","sequenceNumber","tx1Signature","tx1Timestamp","hadSwap"],"type":"object"},"ArmadaActivityBucket":{"properties":{"longOiUsd":{"type":"string"},"shortOiUsd":{"type":"string"},"timestamp":{"format":"date-time","type":"string"},"tradeCount":{"format":"int64","type":"integer"},"volumeUsd":{"type":"string"}},"required":["timestamp","volumeUsd","tradeCount","longOiUsd","shortOiUsd"],"type":"object"},"ArmadaActivityResponse":{"properties":{"grouping":{"type":"string"},"period":{"type":"string"},"rows":{"items":{"$ref":"#/components/schemas/ArmadaActivityBucket"},"type":"array"}},"required":["period","grouping","rows"],"type":"object"},"ArmadaBookLevel":{"description":"One aggregated order book level.","properties":{"price":{"description":"Level price, USD.","format":"double","type":"number"},"quoteSize":{"description":"USD value of this level: sum of price times size over the levels\ngrouped into it.","format":"double","type":"number"},"size":{"description":"Base units resting at this price.","format":"double","type":"number"},"total":{"description":"Cumulative base units at this level and every better one.","format":"double","type":"number"}},"required":["price","size","quoteSize","total"],"type":"object"},"ArmadaCrossLeg":{"description":"One cross leg's held terms. An add re-pins the WHOLE leg at the tighter of\nthese and its market's terms at the size after the add, field by field\n(ACCEPT's `cross_leg_terms`), and is admitted on the seat's initial margin\nafter it.","properties":{"addInitialBps":{"description":"The initial margin rate an add re-pins the whole leg at, for an add that\nleaves it at its current size: the larger of what the leg holds for an\nadd and its market's rate at that size. What an add holds is its pin; a\nleg that never pinned holds the config's leverage, while `initialBps`\ncounts it at the seat's leverage cap, which a tiered leg stamps at its\ntier's. So an unpinned leg can report this above both its `initialBps`\nand its market's rate.\n\nA bigger add takes the market's rate at the size after it, which rises\nup a tiered market's `marginTiers`: each slice of the leg is charged at\nits own row, so past the first row any add raises it, even one that\nstays in the same row. Price it as the larger of this and\n`ceil(10_000 / maxLeverage)` of the table's tier at `sizeUsd` plus the\nadd; REQUEST refuses an add past the table's last row. With\n`marginTiers` null this is the rate at any size.","format":"int32","minimum":0,"type":"integer"},"asset":{"type":"string"},"initialBps":{"description":"The initial margin rate the seat's initial margin counts the leg at, in\nbps of its notional: what it pinned, else the seat's leverage cap.","format":"int32","minimum":0,"type":"integer"},"maintenanceBps":{"format":"int32","minimum":0,"type":["integer","null"]},"marginTiers":{"description":"The market's size-tiered margin table, in `/armada/markets`'s shape,\nread off the leg's funding accumulator in the same read as the seat, so\nit is never missing for a market that has one. Null only when the\nmarket has no table: it keeps its single tier at every size.","items":{"$ref":"#/components/schemas/ArmadaMarginTier"},"type":["array","null"]},"pinned":{"description":"Whether the leg pinned its own terms. One opened before legs pinned is\nheld at the config's leverage until an add pins it.","type":"boolean"},"side":{"type":"string"},"sizeUsd":{"format":"double","type":"number"},"tiered":{"type":"boolean"}},"required":["asset","side","sizeUsd","pinned","initialBps","tiered","addInitialBps"],"type":"object"},"ArmadaDecline":{"description":"Why a quote was withheld.","enum":["book_too_thin","book_stale","cheaper_elsewhere","unpriceable"],"type":"string"},"ArmadaFillsResponse":{"properties":{"markets":{"description":"One entry per market that had orders in the window. A market with no\nentry had no orders.","items":{"$ref":"#/components/schemas/ArmadaMarketFills"},"type":"array"},"windowHours":{"description":"Trailing window the statistics cover, hours.","format":"int32","type":"integer"}},"required":["windowHours","markets"],"type":"object"},"ArmadaLienClearTx":{"properties":{"lastValidBlockHeight":{"description":"Last block height at which the transaction's blockhash is valid.","format":"int64","minimum":0,"type":"integer"},"transaction":{"description":"Base64 bincode legacy `Transaction`, unsigned. `wallet` is its fee\npayer and only signer.","type":"string"}},"required":["transaction","lastValidBlockHeight"],"type":"object"},"ArmadaLiquidationPreview":{"description":"The liquidation price of the position an Armada entry leaves once it\nfills: the seat's collateral plus this order's, net of its opening fee, with\nevery other position on a cross seat held at its live mark.","properties":{"available":{"description":"Whether a projection could be made. False when the account, a mark\nprice or margin parameters are unavailable, or the account is being\nliquidated.","type":"boolean"},"entryPrice":{"description":"The fill price projected: the limit, else the live mark.","format":"double","type":["number","null"]},"projectedLiquidationPrice":{"description":"USD. Null when unavailable or no threshold applies (a fully funded\nlong, or an entry already past it at its fill).","format":"double","type":["number","null"]},"seat":{"description":"`cross`, `isolated` or `isolated_2`: the seat the entry is allocated.","type":["string","null"]}},"required":["available"],"type":"object"},"ArmadaLiquidationPreviewConfig":{"properties":{"fee1e6":{"description":"Per-leg trading fee as a fraction of notional, scaled by 1,000,000\n(`100` = 1 bp).","format":"int32","minimum":0,"type":"integer"},"maintenanceMarginBps":{"description":"Maintenance margin, bps of notional.","format":"int32","minimum":0,"type":"integer"},"reserveCapBps":{"description":"Upper bound on the closing-cost reserve held at liquidation, bps of\nnotional.","format":"int64","minimum":0,"type":"integer"}},"required":["maintenanceMarginBps","reserveCapBps","fee1e6"],"type":"object"},"ArmadaLiquidityCheck":{"properties":{"asset":{"type":"string"},"bufferUsedPct":{"description":"The share of the room between entry and the maintenance line the\nclose cost takes, as a percent. Over 100: liquidatable on open.","format":"double","type":["number","null"]},"closeCostBps":{"description":"What closing this position would cost against the mark now, bps of\nits notional, smoothed like the market's.","format":"double","type":["number","null"]},"closeCostInLiquidation":{"description":"Whether the close cost moves this open's liquidation line: false on a\nmarket with a margin table (its size-tiered maintenance already\ncharges for the exit) and on an untiered market. `null` while\nImperial's limits are unread, when only the cost is judged.","type":["boolean","null"]},"closeCostUsd":{"format":"double","type":["number","null"]},"fills":{"description":"The book takes this size in full.","type":["boolean","null"]},"initialMarginBps":{"description":"`10_000 / leverage`: the margin this leverage opens with.","format":"double","type":["number","null"]},"level":{"$ref":"#/components/schemas/LiquidityCheckLevel"},"leverage":{"description":"The leverage judged: the request's, else the market's maximum.","format":"double","type":["number","null"]},"liquidatableOnOpen":{"description":"Opening at this size and leverage puts the position at or past its\nliquidation line at once.","type":"boolean"},"liquidationCostBps":{"description":"What the liquidation line takes from the close cost, bps of notional:\ncapped at `liquidationCostCapBps`, `0` when it does not count.","format":"double","type":["number","null"]},"liquidationCostCapBps":{"format":"double","type":"number"},"maintenanceMarginBps":{"description":"The maintenance an open of `sizeUsd` is charged: its market's margin\ntable at that size, else the market's flat rate.","format":"double","type":["number","null"]},"marketStatus":{"$ref":"#/components/schemas/LiquidityStatus","description":"The side's market-wide status, judged at the reference notional."},"maxLeverage":{"description":"The highest leverage an open of `sizeUsd` may take: its market's\nmargin table at that size, else the flat cap.","format":"double","type":["number","null"]},"maxLeverageForSize":{"description":"The highest leverage at which this size's close cost takes no more\nthan half the room to liquidation; `maxLeverage` when the book is deep\nenough.","format":"double","type":["number","null"]},"reason":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ThinReason"}]},"referenceUsd":{"format":"double","type":"number"},"side":{"$ref":"#/components/schemas/Side"},"sizeUsd":{"format":"double","type":"number"},"thinBps":{"format":"double","type":"number"},"veryThinBps":{"format":"double","type":"number"}},"required":["asset","side","sizeUsd","level","marketStatus","liquidatableOnOpen","referenceUsd","thinBps","veryThinBps","liquidationCostCapBps"],"type":"object"},"ArmadaLiquidityResponse":{"properties":{"ladderUsd":{"description":"The notionals, USD, each side's `costBps` and `fills` are given at.","items":{"format":"double","type":"number"},"type":"array"},"liquidationCostCapBps":{"description":"The most a close cost adds to a liquidation line, bps of notional.","format":"double","type":"number"},"markets":{"items":{"$ref":"#/components/schemas/ArmadaMarketLiquidity"},"type":"array"},"referenceUsd":{"description":"The notional, USD, a side's `status` is judged at.","format":"double","type":"number"},"thinBps":{"description":"Closing `referenceUsd` costing this many bps or more is `thin`.","format":"double","type":"number"},"updatedAtMs":{"description":"Unix ms of the pass served; `0` before the first.","format":"int64","type":"integer"},"veryThinBps":{"description":"... and this many or more is `very_thin`.","format":"double","type":"number"}},"required":["updatedAtMs","referenceUsd","thinBps","veryThinBps","liquidationCostCapBps","ladderUsd","markets"],"type":"object"},"ArmadaMarginResponse":{"description":"One Armada margin account's balance, and what of it can be withdrawn and\nwhen. Every money field is null, never `0`, when the account could not be\nread; show it as unknown.","properties":{"arrivingEtaSecs":{"description":"Estimated seconds until the rest of `withdrawableTotalUsd` becomes\nwithdrawable. Null when no estimate is available.","format":"int64","type":["integer","null"]},"collateralUsd":{"description":"Settled collateral in this account, USD.","format":"double","type":["number","null"]},"crossLegs":{"description":"CROSS seat only: each open leg's held terms. Null on an isolated seat\nor when the seat's positions could not be read with its balance.","items":{"$ref":"#/components/schemas/ArmadaCrossLeg"},"type":["array","null"]},"drawableUsd":{"description":"Cross-margin account only: the balance an isolated open draws from this\naccount before charging the wallet, USD. Null for an isolated account\nor when unavailable.","format":"double","type":["number","null"]},"effectiveCollateralUsd":{"description":"Account equity, USD: collateral plus unrealized PnL and funding.","format":"double","type":["number","null"]},"entryInitialMarginUsd":{"description":"The initial margin the program bounds an open against: every pinned\ncross leg at its own rate and the rest of the gross at the seat's\nleverage, all on ENTRY notional. `initialMarginUsd` is on the larger of\nentry and mark notional (the withdrawal policy), so the two part once a\nleg moves. `spendableForOpensUsd` is `collateralUsd` less this.","format":"double","type":["number","null"]},"freeCollateralUsd":{"description":"Equity after current losses, funding, initial margin and the withdrawal\nbuffer, capped by settled free cash, USD, less `restingReserveUsd` on\na cross account. Null when unavailable.","format":"double","type":["number","null"]},"heldProfitUsd":{"description":"Recent profit still inside its withdrawal hold, USD. Null when no hold\napplies or it cannot be read.","format":"double","type":["number","null"]},"initialMarginUsd":{"description":"Initial margin required by open positions, USD.","format":"double","type":["number","null"]},"lienClearableAt":{"description":"Unix seconds from which the account owner may release the lien through\n`/armada/lien/clear-tx`. Null with no lien or when unavailable.","format":"int64","type":["integer","null"]},"lienPricedAt":{"description":"Unix seconds of the price behind the lien. Null with no lien.","format":"int64","type":["integer","null"]},"lienUsd":{"description":"Unrealized loss already locked in at a verified price, USD: part of\n`collateralUsd` that cannot be withdrawn unless the price recovers;\nclosing the position realizes the loss. Every withdrawable figure above\nalready accounts for it. `0` with no lien.","format":"double","type":["number","null"]},"liquidationPending":{"description":"True while the account is being liquidated.","type":["boolean","null"]},"liquidationThresholdMaxUsd":{"description":"Upper end of the liquidation threshold range, USD of equity.","format":"double","type":["number","null"]},"liquidationThresholdMinUsd":{"description":"Lower end of the liquidation threshold range, USD of equity. The exact\nthreshold within the range depends on order book depth at liquidation.","format":"double","type":["number","null"]},"maintenanceMarginBps":{"description":"Maintenance margin rate, bps of notional.","format":"int32","minimum":0,"type":["integer","null"]},"maintenanceMarginUsd":{"description":"Maintenance margin required by open positions, USD.","format":"double","type":["number","null"]},"openPositions":{"description":"Number of open positions in this account.","format":"int64","minimum":0,"type":["integer","null"]},"primeBound":{"description":"True when this account is restricted: partial-close proceeds stay\nlocked until the position is fully closed, collateral edits are\nunavailable, and liquidation thresholds are not reported.","type":["boolean","null"]},"profitAvailableAt":{"description":"When the next portion of held profit becomes withdrawable, Unix\nseconds.","format":"int64","type":["integer","null"]},"profitFullyAvailableAt":{"description":"When all held profit becomes withdrawable, Unix seconds.","format":"int64","type":["integer","null"]},"restingReserveUsd":{"description":"Cross-margin account only: the part of this account's balance that\nresting Armada limit orders lean on, USD. It is already taken out of\n`freeCollateralUsd`, `withdrawableNowUsd` and `withdrawableTotalUsd`,\nwhich read `0` when it is larger than what was free; cancelling a\nresting limit releases its share. Null on an isolated account, which\nbacks no resting limit. Also null when it could not be read: the three\nfigures are then NOT reduced by it, so treat them as possibly too high\nby an unknown amount, never as net of a reserve of `0`.","format":"double","type":["number","null"]},"retainsCollateral":{"description":"True when the account keeps its balance between trades (set by an\nexplicit deposit) rather than returning it when flat.","type":["boolean","null"]},"spendableForOpensUsd":{"description":"CROSS seat only: what the seat pays toward an open before the wallet is\ncharged — collateral less the initial margin its legs require, the\nengine's admission rule. Blind to open PnL and the lien, as the engine\nis; ACCEPT takes the added leg's unsettled funding and, on a tiered\nmarket, the fill's fees out of it. `0` while the seat cannot open.\nNull on an isolated seat, which posts every open in full.","format":"double","type":["number","null"]},"withdrawableNowUsd":{"description":"What can be withdrawn right now, USD.","format":"double","type":["number","null"]},"withdrawableTotalUsd":{"description":"The whole free balance, USD, part of which may still be arriving; see\n`arrivingEtaSecs`.","format":"double","type":["number","null"]}},"type":"object"},"ArmadaMarginTier":{"description":"One row of a market's margin table: the slice of a position up to\n`upToUsd` is charged at this leverage and maintenance.","properties":{"maintenanceBps":{"description":"Maintenance margin for this slice, bps of notional.","format":"int32","minimum":0,"type":"integer"},"maxLeverage":{"description":"Maximum leverage for this slice.","format":"int32","minimum":0,"type":"integer"},"upToUsd":{"description":"Upper bound of this slice, USD notional.","format":"double","type":"number"}},"required":["upToUsd","maxLeverage","maintenanceBps"],"type":"object"},"ArmadaMarket":{"description":"One Armada market, with the parameters a market list needs.","properties":{"chartSeries":{"$ref":"#/components/schemas/ChartSeries","description":"Default price series for this market's chart history."},"crossLiquidation":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ArmadaLiquidationPreviewConfig","description":"The same inputs for a position on the cross-margin account."}]},"crossMaxLeverage":{"description":"Maximum opening leverage for a position on the cross-margin account,\nnet of fees. Can sit slightly below `maxLeverage`.","format":"double","type":"number"},"crossMmr":{"description":"Maintenance margin as a fraction of notional, for a position on the\ncross-margin account.","format":"double","type":"number"},"dailyPriceChange":{"description":"24h price change, signed percent.","format":"double","type":["number","null"]},"dailyQuoteTokenVolume":{"description":"24h traded notional of the reference market Imperial prices from, USD.\nUseful for sorting by liquidity; it is not Imperial's volume (see\n`volume24hUsd`).","format":"double","type":["number","null"]},"fundingRate1hPct":{"description":"Funding rate of the reference market Imperial prices from, accruing\nover the current hour, in percent (`0.0025` means 0.0025%). Null when\nunavailable; treat null as unknown, not zero. Armada's own rate is\n`imperialFundingRate1hPct`.","format":"double","type":["number","null"]},"imperialFundingRate1hPct":{"description":"Armada's live funding rate, hourly percent (positive: longs pay\nshorts). Null when unavailable or stale.","format":"double","type":["number","null"]},"indexPrice":{"description":"Index price, USD. Null when unavailable.","format":"double","type":["number","null"]},"lastTradePrice":{"description":"Last traded price, USD. Null when unavailable.","format":"double","type":["number","null"]},"liquidation":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ArmadaLiquidationPreviewConfig","description":"Liquidation-estimate inputs for an isolated position: the market's tier\nwhen it has one. Null when unavailable."}]},"listedAt":{"description":"When the market was listed, Unix seconds. Null when unknown.","format":"int64","type":["integer","null"]},"marginTiers":{"description":"The market's size-tiered margin table, ascending by size; null when a\nsingle tier applies at every size. Each slice of a position is charged\nat its own row, and a position above the last row is refused. The\nleverage and maintenance above are the first row's.","items":{"$ref":"#/components/schemas/ArmadaMarginTier"},"type":["array","null"]},"markPrice":{"description":"Mark price, USD. Null when unavailable.","format":"double","type":["number","null"]},"marketId":{"description":"Numeric market id. Stable.","format":"int32","type":"integer"},"maxLeverage":{"description":"Maximum opening leverage for an isolated position, net of fees.","format":"double","type":"number"},"minBaseAmount":{"description":"Minimum order size, base units.","format":"double","type":"number"},"minQuoteAmount":{"description":"Minimum order size, USD notional.","format":"double","type":"number"},"mmr":{"description":"Maintenance margin as a fraction of notional, for an isolated position.","format":"double","type":"number"},"openInterest":{"description":"Imperial's open interest in this market, base units (multiply by\n`markPrice` for USD), longs and shorts added together. `0` when nobody\nholds a position; null when it cannot be read right now.","format":"double","type":["number","null"]},"priceDecimals":{"description":"Decimal places of the price increment.","format":"int32","minimum":0,"type":"integer"},"reduceOnly":{"description":"True when positions can be closed but not opened or increased.","type":"boolean"},"sizeDecimals":{"description":"Decimal places of the size increment (smallest tradable base amount).","format":"int32","minimum":0,"type":"integer"},"symbol":{"description":"Market symbol, e.g. `BTC`.","type":"string"},"tierMaxLeverage":{"description":"The market's leverage tier, before fees; null for a market without\none. An isolated position's total size is limited by it, so use this\n(not `maxLeverage`) when checking an increase to an existing position.","format":"int32","minimum":0,"type":["integer","null"]},"venueChartSeries":{"$ref":"#/components/schemas/ChartSeries","description":"Alternative chart series a client may use; clients that ignore it use\n`chartSeries`."},"volume24hUsd":{"description":"Imperial's traded notional in this market over the trailing 24h, USD,\neach fill counted once. `0` when nobody traded it; null when it cannot\nbe read right now.","format":"double","type":["number","null"]}},"required":["symbol","marketId","maxLeverage","crossMaxLeverage","mmr","crossMmr","sizeDecimals","priceDecimals","minBaseAmount","minQuoteAmount","reduceOnly","chartSeries","venueChartSeries"],"type":"object"},"ArmadaMarketFills":{"description":"Fill statistics for one market over the window.","properties":{"acceptRate":{"description":"`accepted / (accepted + rejected + expired)`; pending orders are\nexcluded. Null when nothing has an outcome yet.","format":"double","type":["number","null"]},"accepted":{"description":"Orders filled.","format":"int64","type":"integer"},"adverseBps":{"description":"10th-percentile fill price versus the stated price, in bps: 9 in 10\nfills were better than this. Null when there were no fills.","format":"double","type":["number","null"]},"expired":{"description":"Orders that expired without filling.","format":"int64","type":"integer"},"filledSizeUsd":{"description":"Total filled size, USD notional.","format":"double","type":"number"},"hedgeVenue":{"description":"Execution route identifier; informational. `\"any\"` for orders that did\nnot request a specific route.","type":"string"},"market":{"description":"Market symbol (not a token mint).","type":"string"},"medianBps":{"description":"Median fill price versus the price each order stated, in bps.\nPositive means the fill was better for the trader. Null when there were\nno fills (`0` is a real, different answer).","format":"double","type":["number","null"]},"pending":{"description":"Orders with no recorded outcome yet.","format":"int64","type":"integer"},"rejected":{"description":"Orders rejected; see `rejects` for reasons.","format":"int64","type":"integer"},"rejects":{"description":"Count of rejected orders by reason. Empty when there were none.","items":{"$ref":"#/components/schemas/ArmadaRejectCount"},"type":"array"},"requested":{"description":"Orders submitted on chain in the window.","format":"int64","type":"integer"}},"required":["hedgeVenue","market","requested","accepted","rejected","expired","pending","filledSizeUsd","rejects"],"type":"object"},"ArmadaMarketLiquidity":{"description":"One market's book, as a liquidation sees it.","properties":{"closeCostInLiquidation":{"description":"A position opened here now is liquidated on its maintenance PLUS its\nclose cost (up to `liquidationCostCapBps`), so a thin book brings its\nliquidation closer. False on a market with a margin table, whose\nsize-tiered maintenance already charges for the exit, and on an\nuntiered market. When false the book still sets what a close costs,\nbut not when it is liquidated.","type":["boolean","null"]},"long":{"$ref":"#/components/schemas/ArmadaSideLiquidity","description":"Closing a long sells into the bids."},"maintenanceMarginBps":{"description":"An isolated position's maintenance margin, bps of notional: a margin\ntable's first row. Larger positions are charged more; `/check` reads\nthe table at the ticket's size.","format":"double","type":["number","null"]},"marginTable":{"description":"The market charges positions by size from a margin table\n(`/armada/markets`' `marginTiers`).","type":["boolean","null"]},"marketId":{"format":"int32","type":"integer"},"maxLeverage":{"description":"An isolated position's opening leverage cap, as `/armada/markets`\nserves it: a margin table's first row. `null` while Imperial's limits\nare unread, as are the three fields below.","format":"double","type":["number","null"]},"short":{"$ref":"#/components/schemas/ArmadaSideLiquidity","description":"Closing a short buys the asks."},"status":{"$ref":"#/components/schemas/LiquidityStatus","description":"The worse side: `very_thin`, then `thin`, then `normal`;\n`unavailable` only when neither side has a reading."},"symbol":{"type":"string"}},"required":["symbol","marketId","status","long","short"],"type":"object"},"ArmadaMarketStats":{"description":"Price and funding figures for one market, read together with its book.","properties":{"dailyPriceChangePct":{"description":"24h price change, signed percent. Display only.","format":"double","type":["number","null"]},"dailyPriceHigh":{"description":"24h high, USD. Display only.","format":"double","type":["number","null"]},"dailyPriceLow":{"description":"24h low, USD. Display only.","format":"double","type":["number","null"]},"fundingRate1hPct":{"description":"Funding rate of the reference market Imperial prices from, accruing\nover the current hour, in percent (`0.0025` means 0.0025%).\nInformational: Armada positions pay `imperialFundingRate1hPct`, not\nthis rate.","format":"double","type":["number","null"]},"imperialFundingRate1hPct":{"description":"Armada's funding rate for this market, hourly percent; positive means\nlongs pay shorts. This is the rate positions are charged, accruing\ncontinuously. Null when no rate is currently in force, in which case\nnothing accrues.","format":"double","type":["number","null"]},"indexPrice":{"description":"Index price, USD. Null when unavailable.","format":"double","type":["number","null"]},"lastTradePrice":{"description":"Last traded price, USD. Display only.","format":"double","type":["number","null"]},"markObservedAtMs":{"description":"When the update carrying `markPrice` was received, Unix ms. Use this\nto judge the mark's age.","format":"int64","type":["integer","null"]},"markPrice":{"description":"Mark price, USD; quotes are priced from it. Null when unavailable.","format":"double","type":["number","null"]},"midPrice":{"description":"Book midpoint, USD. Display only.","format":"double","type":["number","null"]},"nextFundingAtMs":{"description":"When the current hour of `fundingRate1hPct` settles, Unix ms. Null when\nunknown. Armada funding accrues continuously and has no settlement\ntime.","format":"int64","type":["integer","null"]},"statsSentAtMs":{"description":"When these figures were published, Unix ms.","format":"int64","type":["integer","null"]}},"type":"object"},"ArmadaMarketStatus":{"properties":{"hedgeVenue":{"description":"Execution route identifier; informational.","type":"string"},"market":{"type":"string"},"phase":{"$ref":"#/components/schemas/GuardPhase","description":"Current trading phase of the market."}},"required":["hedgeVenue","market","phase"],"type":"object"},"ArmadaMetrics":{"description":"Quote statistics since the server last restarted.","properties":{"acceptRate":{"description":"`served / (served + rejected)`. Null before the first request.","format":"double","type":["number","null"]},"markout1s":{"$ref":"#/components/schemas/MarkoutSummary","description":"Price movement 1 second after each quote."},"markout2s":{"$ref":"#/components/schemas/MarkoutSummary","description":"Price movement 2 seconds after each quote."},"rejected":{"description":"Quote requests declined.","format":"int64","minimum":0,"type":"integer"},"rejectsByCode":{"additionalProperties":{"format":"int64","minimum":0,"type":"integer"},"description":"Declined quote requests, counted by reason code.","propertyNames":{"type":"string"},"type":"object"},"served":{"description":"Quotes served.","format":"int64","minimum":0,"type":"integer"}},"required":["served","rejected","rejectsByCode","markout1s","markout2s"],"type":"object"},"ArmadaOpenAvailability":{"properties":{"available":{"description":"True when a new position of this side and size can currently be opened.","type":"boolean"},"reason":{"description":"Why not, when `available` is false: `size_above_market_table` (larger\nthan the market's margin table allows), `risk_limit` (the market's risk\nlimit is reached), or `capacity_unavailable`.","type":["string","null"]}},"required":["available"],"type":"object"},"ArmadaOrderbook":{"description":"Live order book depth Imperial prices this market from.","properties":{"asks":{"description":"Best price first: asks ascending.","items":{"$ref":"#/components/schemas/ArmadaBookLevel"},"type":"array"},"bestAsk":{"description":"Best ask, USD. Null when the side is empty.","format":"double","type":["number","null"]},"bestBid":{"description":"Best bid, USD. Null when the side is empty.","format":"double","type":["number","null"]},"bids":{"description":"Best price first: bids descending.","items":{"$ref":"#/components/schemas/ArmadaBookLevel"},"type":"array"},"bookAgeMs":{"description":"Milliseconds since the book last changed. A quiet market's book ages\nwhile the feed is healthy, so do not read this as liveness; use\n`venueReachable`.","format":"int64","type":"integer"},"halt":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/HaltStatus","description":"The market's halt status, as `/armada/halt` reports it at the same\nmoment, so a client polling the book needs no second poll."}]},"hedgeVenue":{"description":"Execution route identifier; informational.","type":"string"},"market":{"description":"Market symbol.","type":"string"},"marketId":{"$ref":"#/components/schemas/i16","description":"Numeric market id, the same as `marketId` in `/armada/markets`."},"maxAgeMs":{"description":"Maximum book age, ms, that this book is still served under. Lets a\nclient show staleness without hard-coding the limit.","format":"int64","type":"integer"},"mid":{"description":"Midpoint of best bid and best ask, USD.","format":"double","type":["number","null"]},"raw":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ArmadaRawLevels","description":"Ungrouped levels from the same snapshot, present only when\n`includeRaw=true`."}]},"spread":{"description":"Best ask minus best bid, USD.","format":"double","type":["number","null"]},"spreadBps":{"description":"Spread in bps of the midpoint.","format":"double","type":["number","null"]},"stats":{"$ref":"#/components/schemas/ArmadaMarketStats"},"venueReachable":{"description":"True when live prices for this market are arriving. When false, treat\nthe book as stale.","type":"boolean"}},"required":["hedgeVenue","market","marketId","bids","asks","bookAgeMs","maxAgeMs","venueReachable","stats"],"type":"object"},"ArmadaQuote":{"properties":{"allInBps":{"description":"Total cost over the mark, bps of notional: `chargedHedgeCostBps + feeBps`.","format":"double","type":"number"},"bookAgeMs":{"description":"Milliseconds since the order book last changed when the quote was priced.","format":"int64","type":"integer"},"chargedHedgeCostBps":{"description":"Book slippage charged at this size, bps of notional. Never negative.\nExcludes `feeBps`.","format":"double","type":"number"},"feeBps":{"description":"Total per-leg trading fee, bps of notional.","format":"double","type":"number"},"hedgeBaseSize":{"description":"Order size in base units, at the mark.","format":"double","type":"number"},"hedgeCostBps":{"description":"Measured execution cost for this size, bps of notional: signed book\nslippage against the mark plus the external taker fee. Can be negative;\ninformational.","format":"double","type":"number"},"hedgeVenue":{"$ref":"#/components/schemas/Venue","description":"Execution route identifier; informational."},"hedgeWorstPrice":{"description":"Worst book price reached when filling this size, USD.","format":"double","type":"number"},"levelsConsumed":{"description":"Number of book levels this size consumes.","minimum":0,"type":"integer"},"mark":{"description":"Mark price the quote was priced against, USD.","format":"double","type":"number"},"market":{"description":"Market symbol.","type":"string"},"notionalUsd":{"description":"Order size quoted, USD notional.","format":"double","type":"number"},"quotePrice":{"description":"Quoted price, USD: the mark moved by `allInBps` against the trader.","format":"double","type":"number"},"widenMult1e3":{"description":"Price-widening multiplier applied to slippage, scaled by 1,000 (1000 = none).","format":"int32","minimum":0,"type":"integer"}},"required":["hedgeVenue","market","mark","hedgeCostBps","chargedHedgeCostBps","feeBps","allInBps","quotePrice","notionalUsd","hedgeBaseSize","hedgeWorstPrice","levelsConsumed","widenMult1e3","bookAgeMs"],"type":"object"},"ArmadaRawLevels":{"description":"Ungrouped levels, from the same snapshot as the grouped `bids`/`asks`, always\n[`MAX_BOOK_DEPTH`] deep: the ticket prices market orders off them, and a\npanel's display depth must not cap the size it can quote.","properties":{"asks":{"description":"Best price first, exactly as a request without `priceStep` returns them.","items":{"$ref":"#/components/schemas/ArmadaBookLevel"},"type":"array"},"bids":{"description":"Best price first, exactly as a request without `priceStep` returns them.","items":{"$ref":"#/components/schemas/ArmadaBookLevel"},"type":"array"}},"required":["bids","asks"],"type":"object"},"ArmadaRejectCount":{"description":"One reject reason's share of a window.","properties":{"category":{"description":"Reject category code.","format":"int32","type":"integer"},"categoryName":{"description":"Stable name of the category code. Null for a code this server does not\nrecognise.","type":["string","null"]},"count":{"description":"Number of rejected orders with this reason in the window.","format":"int64","type":"integer"},"reason":{"description":"On-chain reject reason code.","format":"int32","type":"integer"},"reasonName":{"description":"Stable name of the reason code. Null for a code this server does not\nrecognise.","type":["string","null"]}},"required":["reason","category","count"],"type":"object"},"ArmadaSettledMetrics":{"description":"Fill statistics for orders submitted on chain, summed across all markets\nin the window. Quotes declined before an order was submitted are not\ncounted here; see `metrics` for those.","properties":{"acceptRate":{"description":"`accepted / (accepted + rejected + expired)`. Null when nothing has an\noutcome yet.","format":"double","type":["number","null"]},"accepted":{"description":"Orders filled.","format":"int64","type":"integer"},"expired":{"description":"Orders that expired without filling.","format":"int64","type":"integer"},"filledSizeUsd":{"description":"Total filled size, USD notional.","format":"double","type":"number"},"pending":{"description":"Orders with no recorded outcome yet.","format":"int64","type":"integer"},"rejected":{"description":"Orders rejected.","format":"int64","type":"integer"},"rejectsByReason":{"description":"Count of rejected orders by reason, across all markets.","items":{"$ref":"#/components/schemas/ArmadaRejectCount"},"type":"array"},"requested":{"description":"Orders submitted on chain in the window.","format":"int64","type":"integer"},"windowHours":{"description":"Trailing window the statistics cover, hours.","format":"int32","type":"integer"}},"required":["windowHours","requested","accepted","rejected","expired","pending","filledSizeUsd","rejectsByReason"],"type":"object"},"ArmadaSideLiquidity":{"description":"One side of one market.","properties":{"costBps":{"description":"Cost of closing each of `ladderUsd`, bps of that notional; `null`\nwhere unread.","items":{"format":"double","type":["number","null"]},"type":"array"},"fills":{"description":"Whether the book takes each of `ladderUsd` in full.","items":{"type":"boolean"},"type":"array"},"maxLeverageAtReference":{"description":"The highest leverage at which closing `referenceUsd` takes no more\nthan half the room between a position's entry and its liquidation\nline: a `referenceUsd` position's maximum (its margin table's, at that\nsize) when the book is deep enough, or when the close cost does not\nmove the line. `null` when unread or the market's limits are.","format":"double","type":["number","null"]},"reason":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ThinReason","description":"Why the side is not `normal`. `no_book` when it has no live book;\n`null` when normal, or while the market is still being read."}]},"referenceCostBps":{"description":"Cost of closing `referenceUsd` on this side, bps of that notional,\nsmoothed over the last 30 s.","format":"double","type":["number","null"]},"status":{"$ref":"#/components/schemas/LiquidityStatus"},"statusSinceMs":{"description":"Unix ms the current status began.","format":"int64","type":"integer"},"thinFromUsd":{"description":"The smallest of `ladderUsd` whose close costs `thinBps` or more;\n`null` when none does.","format":"double","type":["number","null"]},"touchCostBps":{"description":"What the first unit closed loses to the mark, bps: the spread plus any\ngap between the mark and the book.","format":"double","type":["number","null"]}},"required":["status","statusSinceMs","costBps","fills"],"type":"object"},"ArmadaStatusResponse":{"properties":{"enabled":{"description":"True when Armada is enabled on this deployment.","type":"boolean"},"markets":{"description":"Trading phase of each market.","items":{"$ref":"#/components/schemas/ArmadaMarketStatus"},"type":"array"},"metrics":{"$ref":"#/components/schemas/ArmadaMetrics","description":"Quote statistics since the server last restarted: quotes served and\ndeclined, and price movement shortly after each quote."},"openQuotes":{"description":"Quotes currently served and not yet expired or used, on this server.","minimum":0,"type":"integer"},"settled":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ArmadaSettledMetrics","description":"Fill statistics for orders submitted on chain over the trailing\n`windowHours`. Null when the statistics cannot be read right now."}]}},"required":["enabled","markets","metrics","openQuotes"],"type":"object"},"BuildDepositTxRequest":{"properties":{"amount":{"description":"Deposit amount in USDC native units (6-decimal — `1_000_000` = $1).","format":"int64","minimum":0,"type":"integer"},"deferOperatorSignature":{"description":"Return the transaction with Imperial's sponsor signature still empty,\nto be sent to `/api/v1/deposit/cosign-tx` once the wallet has signed.\nSome wallets warn when asked to sign a transaction that already carries\nanother signature; signing first avoids that. Defaults to false, which\nreturns the transaction already signed by the sponsor.","type":"boolean"},"mode":{"description":"`\"deposit\"` to credit USDC directly from the wallet's USDC ATA into the\nprofile's USDC ATA, or `\"withdraw\"` to pull USDC out of the profile back\nto the wallet's USDC ATA. Funding from native SOL is not supported —\nwrap to WSOL on the client first.","type":"string"},"profileIndex":{"description":"Sub-account index (0..5) the deposit lands in.","format":"int32","minimum":0,"type":"integer"},"wallet":{"description":"Owner wallet base58 pubkey. The returned transaction is sponsored by\nImperial (fee payer, rent and ATA creation) and must also be signed by\nthis wallet.","type":"string"}},"required":["wallet","profileIndex","amount","mode"],"type":"object"},"BuildDepositTxResponse":{"properties":{"transaction":{"description":"Base64-encoded `VersionedTransaction`. Decode, sign with the wallet's\nkeypair, and submit via your usual RPC.","type":"string"}},"required":["transaction"],"type":"object"},"BuilderPayoutEntry":{"properties":{"amountUsdcBase":{"format":"int64","type":"integer"},"notes":{"type":["string","null"]},"paidAt":{"description":"Unix seconds.","format":"int64","type":"integer"},"transactionSignature":{"description":"`null` while the payout is pending; only payouts with a signature\nreduce `claimableUsdcBase`.","type":["string","null"]}},"required":["amountUsdcBase","paidAt"],"type":"object"},"BuilderSummaryResponse":{"properties":{"accruedUsdcBase":{"description":"Lifetime builder fees accrued on opening and closing trades, in USDC\nnative units (6 decimals).","format":"int64","type":"integer"},"active":{"type":"boolean"},"builderName":{"type":"string"},"claimableUsdcBase":{"description":"max(0, accrued − paid).","format":"int64","type":"integer"},"code":{"type":"string"},"feeBps":{"description":"The code's rate in bps of notional, e.g. `0.3`.","format":"double","type":"number"},"feeRate1e6":{"description":"The same rate in millionths of notional (1 bp = 100), e.g. `30`.","format":"int32","type":"integer"},"paidUsdcBase":{"description":"Lifetime settled payouts (rows with a transaction signature).","format":"int64","type":"integer"},"payouts":{"description":"Latest 50 payouts, newest first (includes pending unsigned rows).","items":{"$ref":"#/components/schemas/BuilderPayoutEntry"},"type":"array"}},"required":["code","builderName","feeBps","feeRate1e6","active","accruedUsdcBase","paidUsdcBase","claimableUsdcBase","payouts"],"type":"object"},"CapitalCheck":{"description":"Capacity check that refused an order opening or increasing a position.","enum":["exit_reserve","market_mix","crash_budget"],"type":"string"},"ChartSeries":{"description":"Which price a market's chart draws: `trade` (traded prices), `mark` (mark\nprices, used for markets too thin for trades to draw a chart), or `venue`\n(merged trade and mark candles).","enum":["trade","mark","venue"],"type":"string"},"CloseSlippageBand":{"description":"Realized fill slippage for one (market, venue, leg) over the lookback\nwindow. Figures are signed basis points of the quoted price; **negative\nmeans the fill was worse for the user**, for longs and shorts alike.","properties":{"adverseBps":{"description":"Adverse edge: the 10th percentile of the signed series, so 9 in 10\nfills landed better than this.","format":"double","type":"number"},"assetSymbol":{"type":"string"},"formulaVersion":{"description":"Reference price the band is measured against: `1` = the client-side\nTP/SL preview price, `2` = a server-issued Armada quote. Treat bands\nwith different versions as separate; do not average them. Bands are\nsorted ascending by this field, so the last band per (market, venue,\nleg) is the newest.","format":"int32","type":"integer"},"leg":{"description":"`\"tp\"`, `\"sl\"`, or `\"entry\"`.","type":"string"},"medianBps":{"description":"Typical fill. The centre of the quoted range.","format":"double","type":"number"},"sampleCount":{"format":"int64","type":"integer"},"underwriter":{"type":"string"}},"required":["assetSymbol","underwriter","leg","formulaVersion","sampleCount","medianBps","adverseBps"],"type":"object"},"CloseSlippageResponse":{"properties":{"bands":{"description":"Only markets with at least `minSamples` fills. A market absent from\nthis list does not have enough history for a band.","items":{"$ref":"#/components/schemas/CloseSlippageBand"},"type":"array"},"lookbackDays":{"format":"int32","type":"integer"},"minSamples":{"description":"The floor actually applied, after clamping.","format":"int64","type":"integer"}},"required":["lookbackDays","minSamples","bands"],"type":"object"},"CombinedOrdersResponse":{"properties":{"jupiterOrders":{"description":"Legacy: always empty. Kept so existing clients keep parsing.","items":{"type":"object"},"type":"array"},"passthroughOrders":{"items":{"$ref":"#/components/schemas/PassthroughOrderInfo"},"type":"array"},"totalCount":{"format":"int32","type":"integer"}},"required":["jupiterOrders","passthroughOrders","totalCount"],"type":"object"},"CustomizeReferralCodeRequest":{"additionalProperties":false,"properties":{"code":{"type":"string"},"expectedCode":{"description":"The wallet's current code, exactly as returned by GET or ensure. The\nchange is refused with `409` if the code has changed since.","type":"string"}},"required":["code","expectedCode"],"type":"object"},"DcaSummary":{"properties":{"avgFillPrice":{"type":["string","null"]},"fillCount":{"format":"int64","type":"integer"},"legsExecuted":{"format":"int64","type":"integer"},"numLegs":{"format":"int64","type":"integer"}},"required":["legsExecuted","numLegs","fillCount"],"type":"object"},"DepositAggregatesResponse":{"properties":{"net":{"description":"In minus out (signed micro-USD).","type":"string"},"totalIn":{"description":"Total into profiles (micro-USD magnitude), USD-valued rows only.","type":"string"},"totalOut":{"description":"Total out of profiles (micro-USD magnitude), USD-valued rows only.","type":"string"}},"required":["totalIn","totalOut","net"],"type":"object"},"DepositEventResponse":{"properties":{"amount":{"description":"Signed raw token units (native decimals); positive = into the profile.","type":"string"},"amountUsd":{"description":"Signed micro-USD. Omitted for mints with no USD valuation.","type":["string","null"]},"annotation":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/DepositHistoryAnnotation"}]},"counterparty":{"description":"The other side of the transfer: source owner for deposits, destination\nwallet for withdrawals, the other profile PDA for transfers.","type":["string","null"]},"counterpartyProfileIndex":{"description":"The other profile's index for transfer legs.","format":"int32","type":["integer","null"]},"eventAt":{"format":"int64","type":"integer"},"eventType":{"description":"`deposit`, `external_deposit`, `withdrawal`, `transfer_in`, or\n`transfer_out`.","type":"string"},"id":{"type":"string"},"marketMint":{"type":"string"},"profileIndex":{"format":"int32","type":"integer"},"signature":{"type":"string"}},"required":["id","eventType","marketMint","profileIndex","amount","signature","eventAt"],"type":"object"},"DepositHistoryAnnotation":{"description":"A note Imperial attached to a verified transfer. Informational only; it\nnever changes the transfer's type or amounts.","properties":{"note":{"type":"string"},"relatedSignature":{"type":["string","null"]}},"required":["note"],"type":"object"},"DepositHistoryResponse":{"properties":{"aggregates":{"$ref":"#/components/schemas/DepositAggregatesResponse"},"events":{"items":{"$ref":"#/components/schemas/DepositEventResponse"},"type":"array"},"profileIndex":{"description":"The account scope applied to the rows, pagination and totals.","format":"int32","type":["integer","null"]},"totalCount":{"format":"int64","type":"integer"}},"required":["events","totalCount","aggregates"],"type":"object"},"DirectVenueMetadata":{"description":"Legacy: venue account details for historical Phoenix positions.","properties":{"accountCollateralUsd":{"type":"string"},"baseLots":{"type":"string"},"effectiveCollateralUsd":{"type":"string"},"maintenanceMarginUsd":{"type":"string"},"marginMode":{"type":"string"},"pdaIndex":{"format":"int32","minimum":0,"type":"integer"},"positionInitialMarginUsd":{"type":"string"},"subaccountIndex":{"format":"int32","minimum":0,"type":"integer"},"traderAccount":{"type":"string"}},"required":["marginMode","traderAccount","pdaIndex","subaccountIndex","baseLots","accountCollateralUsd","effectiveCollateralUsd","positionInitialMarginUsd","maintenanceMarginUsd"],"type":"object"},"ExactLifecycleResponse":{"properties":{"count":{"format":"int32","type":"integer"},"dataList":{"items":{"$ref":"#/components/schemas/LifecycleResponse"},"type":"array"},"totalCount":{"format":"int32","type":"integer"}},"required":["dataList","count","totalCount"],"type":"object"},"FeeBreakdown":{"properties":{"builderFee":{"description":"Builder (integrator) fees, charged separately from `platformFee`.","type":["string","null"]},"interest":{"type":"string"},"jupiterFee":{"type":"string"},"liquidationFee":{"description":"Armada only: margin retained as a liquidation fee. Already included in\n`platformFee`, so `platformFee - liquidationFee` is the trading fee.\nAbsent when the position was not liquidated.","type":["string","null"]},"loanInterest":{"description":"Legacy: only set on some historical positions from retired features.","type":["string","null"]},"pairsImpactFee":{"description":"Legacy: only set on historical positions from a retired venue.","type":["string","null"]},"platformFee":{"type":"string"},"proOrderFee":{"type":"string"},"slippage":{"type":"string"},"swapFee":{"type":"string"}},"required":["platformFee","swapFee","slippage","jupiterFee","interest","proOrderFee"],"type":"object"},"FundingAggregatesResponse":{"properties":{"net":{"description":"Paid minus received (signed micro-USD).","type":"string"},"totalPaid":{"description":"Total the trader paid (micro-USD magnitude).","type":"string"},"totalReceived":{"description":"Total the trader received (micro-USD magnitude).","type":"string"}},"required":["totalPaid","totalReceived","net"],"type":"object"},"FundingEventResponse":{"properties":{"actionId":{"type":["string","null"]},"amount":{"description":"Signed micro-USD; positive = trader paid.","type":"string"},"eventAt":{"format":"int64","type":"integer"},"eventType":{"description":"`funding_settled`, or `borrow_settled` (legacy: historical positions on\nretired venues only).","type":"string"},"id":{"type":"string"},"lifecycleId":{"type":"string"},"marketMint":{"type":"string"},"payload":{},"positionSizeAfterUsd":{"type":["string","null"]},"positionSizeUsd":{"type":["string","null"]},"rate":{"description":"Effective per-second rate ×10^`rateScale`.","type":["string","null"]},"rateScale":{"format":"int32","type":"integer"},"side":{"type":"string"},"signature":{"type":["string","null"]},"spanEnd":{"format":"int64","type":["integer","null"]},"spanStart":{"format":"int64","type":["integer","null"]},"symbol":{"type":"string"},"underwriter":{"type":"string"}},"required":["id","lifecycleId","underwriter","marketMint","symbol","side","eventType","amount","rateScale","eventAt"],"type":"object"},"FundingHistoryResponse":{"properties":{"aggregates":{"$ref":"#/components/schemas/FundingAggregatesResponse"},"events":{"items":{"$ref":"#/components/schemas/FundingEventResponse"},"type":"array"},"profileIndex":{"description":"The account scope applied to the rows, pagination and totals.","format":"int32","type":["integer","null"]},"totalCount":{"format":"int64","type":"integer"}},"required":["events","totalCount","aggregates"],"type":"object"},"GuardPhase":{"description":"A market's trading phase: `normal`; `widened` (quotes carry extra\nslippage, the fee is unchanged); or `halted` (quotes are refused).","enum":["normal","widened","halted"],"type":"string"},"HaltStatus":{"properties":{"halted":{"description":"True when trading in this market is temporarily halted.","type":"boolean"},"haltedSinceMs":{"description":"When the halt was first observed, Unix ms; null while trading.","format":"int64","type":["integer","null"]},"market":{"description":"Market symbol.","type":"string"},"planned":{"description":"True when the halt was announced in advance; false\nfor an unplanned halt.","type":"boolean"},"warehoused":{"description":"True when the market stays tradable during this halt.","type":"boolean"}},"required":["market","halted","planned","warehoused"],"type":"object"},"IndicatorSummary":{"properties":{"condition":{"description":"`below` | `above` | `cross_below` | `cross_above`.","type":"string"},"period":{"format":"int32","minimum":0,"type":"integer"},"threshold":{"description":"RSI threshold as a plain decimal string (e.g. \"30\").","type":"string"},"timeframe":{"description":"Numeric candle timeframe code, as a string.","type":"string"}},"required":["period","threshold","condition","timeframe"],"type":"object"},"LifecycleResponse":{"properties":{"accountLeverage":{"description":"Armada Cross only, on the owner's own listings: this position's size ÷\nthe whole Cross margin account's collateral, the figure `leverageX`\ncarries on a Cross row. Priced and absent as `marginUsd` is.","type":["string","null"]},"accruedFundingFrom":{"description":"Unix seconds when the `accruedFundingUsd` window started: the last\naction that recorded funding, else the position open. Not necessarily\n`lastActionAt`.","format":"int64","type":["integer","null"]},"accruedFundingUsd":{"description":"Funding accrued on this open position that does not yet appear in\n`/funding-history`; it is recorded at the next reduce or close. USD;\npositive means the trader pays.","type":["string","null"]},"accruedInterestUsd":{"description":"Legacy: only set on some historical positions from retired features.","type":["string","null"]},"actions":{"items":{"$ref":"#/components/schemas/ActionResponse"},"type":"array"},"asset":{"type":"string"},"baseLeverageX":{"type":["string","null"]},"borrowFeeOwed":{"type":["string","null"]},"borrowedCollateralUsd":{"description":"Legacy: only set on some historical positions from retired features.","type":["string","null"]},"breakevenPriceUsd":{"description":"Legacy: breakeven price for historical Phoenix positions: the price the\nopen residue must reach to recover residual fees and funding (the margin\nkernel's breakeven). Null for non-Phoenix and closed positions.","type":["string","null"]},"closeFeeOwed":{"type":["string","null"]},"closedAt":{"format":"int64","type":["integer","null"]},"collateralUsd":{"type":["string","null"]},"directVenue":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/DirectVenueMetadata"}]},"effectiveLeverageX":{"type":["string","null"]},"engineMarginUsd":{"description":"Armada Cross only, on the owner's own listings: the initial margin the\nprogram requires of this position alone, at its own rate (its pin, or\nthe account's leverage cap on a leg opened before pins) on the larger\nof its entry notional and its notional at the mark. Priced and absent\nas `marginUsd` is.","type":["string","null"]},"entryPrice":{"type":["string","null"]},"fees":{"$ref":"#/components/schemas/FeeBreakdown"},"feesOwed":{"type":["string","null"]},"fundingRateHourlyPercent":{"type":["string","null"]},"hedgeVenue":{"description":"Internal venue tag recorded on Armada positions. Informational; absent\non older rows.","type":["string","null"]},"id":{"type":"string"},"lastActionAt":{"format":"int64","type":"integer"},"leverageX":{"type":["string","null"]},"liqBandPriceUsd":{"description":"Legacy: only set on some historical positions from retired features.","type":["string","null"]},"liqTriggerPriceUsd":{"description":"Legacy: only set on some historical positions from retired features.","type":["string","null"]},"liquidationPrice":{"type":["string","null"]},"liquidationPriceAgeMs":{"description":"Armada only: set when `liquidationPrice` is the last good estimate\n(at most 60s old, margin account unchanged since) because a fresh read\nfailed; its age in milliseconds. Absent on a fresh estimate.","format":"int64","minimum":0,"type":["integer","null"]},"loanOriginationNotionalUsd":{"description":"Legacy: only set on some historical positions from retired features.","type":["string","null"]},"loanRateBps":{"description":"Legacy: only set on some historical positions from retired features.","format":"int32","minimum":0,"type":["integer","null"]},"maintenanceBreachPriceUsd":{"description":"Legacy: the maintenance-breach price for historical Phoenix positions,\nwith no wrong-side guard. Past maintenance it sits on the mark's wrong\nside (above it for a long), where `partial_liquidation_price_usd` is\nnull: the position is liquidatable now. Null for non-Phoenix, cross and\nclosed positions.","type":["string","null"]},"marginUsd":{"description":"Armada only, on the owner's own listings. Display only: no margin\nratio, health, liquidation price, availability or order check reads it.\n\nCross: this position's margin at `selectedLeverage`, its notional at the\nmark ÷ that leverage, never below `engineMarginUsd`. Absent without a\nrecorded leverage. Isolated: its margin account's collateral, the figure\n`collateralUsd` carries.\n\nPriced with `liquidationPrice`, from the same margin account read and\nthe hedge venue mark, and refreshed with the full positions read, not on each\nwebsocket re-mark. When `liquidationPriceAgeMs` is set, this field\ncomes from that same remembered read, of that age. Absent when no read\ncan price the account.","type":["string","null"]},"markPrice":{"type":["string","null"]},"maxCollateralUsd":{"type":["string","null"]},"maxLeverageX":{"type":["string","null"]},"maxSizeUsd":{"type":["string","null"]},"netCashPnlUsd":{"description":"Realized net PnL for a closed or liquidated position, in USD: total\nUSDC received across closes minus total USDC put in across opens, so it\nalready includes every fee and funding payment. `pnlUsd` is the gross\nprice PnL instead. Null while the position is open, or when the cash\namounts are not fully recorded (fall back to `pnlUsd`).","type":["string","null"]},"openedAt":{"format":"int64","type":"integer"},"openingSignature":{"type":["string","null"]},"openingSlot":{"description":"Solana slot of the opening transaction.","format":"int64","type":["integer","null"]},"ourLiquidationPriceUsd":{"description":"Legacy: only set on some historical positions from retired features. When set, it supersedes `liquidationPrice`.","type":["string","null"]},"ownedCollateralUsd":{"description":"Legacy: only set on some historical positions from retired features.","type":["string","null"]},"ownership":{"type":"string"},"packPrize":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/PackPrizeOverlay","description":"Legacy: only on historical positions opened from a perp pack (packs are\ndiscontinued). All other fields show the real position."}]},"pairsEntryOracleIndex":{"description":"Legacy: always omitted.","format":"double","type":["number","null"]},"pairsLegAAnchor":{"description":"Legacy: always omitted.","format":"double","type":["number","null"]},"pairsLegBAnchor":{"description":"Legacy: always omitted.","format":"double","type":["number","null"]},"pairsWABps":{"description":"Legacy: always omitted.","format":"int32","minimum":0,"type":["integer","null"]},"partialLiquidationPriceUsd":{"description":"Legacy: partial-liquidation price for historical Phoenix positions.\nNull otherwise.","type":["string","null"]},"pnlPctBasisUsd":{"description":"Armada Cross only, on the owner's own listings: the base of this\nposition's PnL %, equal to `marginUsd`. Isolated rows keep\n`returnBasis`. Display only, like `marginUsd`.","type":["string","null"]},"pnlPercent":{"type":["string","null"]},"pnlUsd":{"type":["string","null"]},"positionPda":{"type":"string"},"profileIndex":{"format":"int32","type":["integer","null"]},"profilePictureUrl":{"type":["string","null"]},"returnBasis":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ReturnBasis","description":"Verified collateral basis for the percentage return of an isolated\nArmada position. Absent for other positions."}]},"seatCollateralUsd":{"description":"Legacy: only set on some historical positions from retired features.","type":["string","null"]},"selectedLeverage":{"description":"Armada only, on the owner's own listings.\n\nIsolated: the leverage the trader tagged on this position, served no\nhigher than what an order on the market may use now (absent while that\nlimit is unknown). It sets the leverage of the next order or add on this\nmarket and nothing else: it moves no money, and neither `leverageX` nor\n`pnlPercent` reads it. Both come from the real money in the position.\n\nCross: the leverage picked on the ticket, as recorded when the\nposition's fills were indexed (the highest across its fills, the figure\n`maxLeverageX` carries). Display only: the program pins each Cross leg's\nmargin at the market's own cap, so this leverage moves no money and no\nlimit reads it. It is not held to the market's current cap and is not a\ndefault for the next order. Absent when none was recorded.","type":["string","null"]},"side":{"type":"string"},"sizeTokenAmount":{"type":["string","null"]},"sizeUsd":{"type":["string","null"]},"source":{"type":"string"},"status":{"type":"string"},"sunriseMarginSeat":{"description":"Armada margin account holding the position: null for cross margin;\notherwise the identifier of its isolated margin account.","type":["string","null"]},"swapFeeOwed":{"type":["string","null"]},"totalFeesUsd":{"type":"string"},"tpslOrders":{"items":{"$ref":"#/components/schemas/TpSlOrderResponse"},"type":"array"},"underwriter":{"type":"string"},"username":{"type":["string","null"]},"venueMove":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/VenueMoveOverlay","description":"Only on an Armada position Imperial moved here from another venue for\nits owner: the original open time and entry, and the PnL carried in its\ncollateral. All other fields show the real position."}]},"wallet":{"type":"string"}},"required":["id","positionPda","wallet","source","side","asset","totalFeesUsd","fees","status","openedAt","lastActionAt","underwriter","actions"],"type":"object"},"LifecyclesResponse":{"properties":{"count":{"format":"int32","type":"integer"},"dataList":{"items":{"$ref":"#/components/schemas/LifecycleResponse"},"type":"array"},"lifetimeCollateralUsd":{"type":"string"},"lifetimeFeeBreakdown":{"$ref":"#/components/schemas/FeeBreakdown"},"lifetimeFeesUsd":{"type":"string"},"lifetimeNetPnlUsd":{"type":"string"},"lifetimePnlUsd":{"type":"string"},"phoenixCrossSeats":{"description":"Legacy: account state of historical Phoenix cross-margin accounts, one\nper profile. Omitted when there are none.","items":{"$ref":"#/components/schemas/PhoenixCrossSeatState"},"type":"array"},"totalCount":{"format":"int64","type":"integer"}},"required":["dataList","count","totalCount","lifetimeCollateralUsd","lifetimePnlUsd","lifetimeNetPnlUsd","lifetimeFeesUsd","lifetimeFeeBreakdown"],"type":"object"},"LifetimeNetPnlRead":{"description":"`lifetimeNetPnlRead` in the account-read contract.","properties":{"assurance":{"type":"string"},"calculationId":{"format":"uuid","type":"string"},"completedAt":{"type":"string"},"sharedInFlight":{"type":"boolean"},"source":{"type":"string"},"startedAt":{"type":"string"}},"required":["calculationId","source","startedAt","completedAt","sharedInFlight","assurance"],"type":"object"},"LiquidityCheckLevel":{"description":"How much one ticket should worry about the book.","enum":["ok","caution","danger","unavailable"],"type":"string"},"LiquidityStatus":{"description":"How thin a side's book is. Ordered by severity, except that\n`Unavailable` means \"no information\" rather than \"worse than very thin\".","enum":["normal","thin","very_thin","unavailable"],"type":"string"},"MarginModeResponse":{"properties":{"marginMode":{"description":"The mode now in force.","type":"string"},"profileIndex":{"format":"int32","type":"integer"},"venueLock":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/VenueLock","description":"Present only when the new mode restricts which venues the profile may\nopen positions on. Opens that violate it are rejected; apply it\nclient-side to avoid the round trip."}]},"wallet":{"type":"string"}},"required":["wallet","profileIndex","marginMode"],"type":"object"},"MarketRow":{"properties":{"byVenue":{"$ref":"#/components/schemas/MarketVenueVolume","description":"`volumeUsd` split by venue."},"longOiUsd":{"type":"string"},"openInterestUsd":{"type":"string"},"positionCount":{"format":"int64","type":"integer"},"shortOiUsd":{"type":"string"},"symbol":{"type":"string"},"traderCount":{"format":"int64","type":"integer"},"volumeUsd":{"type":"string"}},"required":["symbol","volumeUsd","openInterestUsd","longOiUsd","shortOiUsd","traderCount","positionCount","byVenue"],"type":"object"},"MarketVenueVolume":{"description":"Volume by venue. `armadaUsd` is current trading; the other columns are\nretired venues and only carry historical volume.","properties":{"armadaUsd":{"type":"string"},"flashUsd":{"type":"string"},"gmtradeUsd":{"type":"string"},"jupiterUsd":{"type":"string"},"phoenixUsd":{"type":"string"}},"required":["armadaUsd","jupiterUsd","flashUsd","phoenixUsd","gmtradeUsd"],"type":"object"},"MarketsResponse":{"properties":{"period":{"type":"string"},"rows":{"items":{"$ref":"#/components/schemas/MarketRow"},"type":"array"}},"required":["period","rows"],"type":"object"},"MarkoutSummary":{"description":"Price movement after a quote, measured from the quoted mid at a fixed\ndelay. Positive means the price moved in the direction the trader traded.","properties":{"meanBps":{"description":"Notional-weighted mean movement, bps of the quoted mid. Null until a\nsample exists.","format":"double","type":["number","null"]},"notionalUsd":{"description":"Total notional of the measured quotes, USD.","format":"double","type":"number"},"samples":{"description":"Number of quotes measured.","format":"int64","minimum":0,"type":"integer"}},"required":["samples","notionalUsd"],"type":"object"},"MobileBalancesResponse":{"properties":{"profiles":{"description":"One entry per Imperial subaccount (profile_index 0..5), in order.","items":{"$ref":"#/components/schemas/ProfileUsdcBalance"},"type":"array"},"wallet":{"type":"string"}},"required":["wallet","profiles"],"type":"object"},"MobileCancelOrderRequest":{"properties":{"cascadeChildren":{"description":"Whether cancelling an entry order also cancels the pending TP/SL orders\nlinked to it (their `parentOrderPda` is this order). Defaults to `true`:\nclose orders are market/side-scoped on-chain, so ones that outlive their\nentry order execute against whatever position exists on that market/side\nnext. Pass `false` only when the children should survive — e.g. the\n\"execute limit at market now\" flow, where the cancel is immediately\nfollowed by an equivalent market open the children are meant to protect.","type":["boolean","null"]},"orderPda":{"description":"Base58 PDA of the order to cancel.","type":"string"},"profileIndex":{"description":"Sub-account index (0..5) the order belongs to.","format":"int32","minimum":0,"type":"integer"},"wallet":{"description":"Base58 wallet pubkey. Must match the JWT's wallet claim.","type":"string"}},"required":["wallet","orderPda","profileIndex"],"type":"object"},"MobileCollateralEditRequest":{"properties":{"action":{"description":"0 = add collateral, 1 = remove collateral.","format":"int32","minimum":0,"type":"integer"},"collateralAmount":{"description":"Amount of collateral to add or remove, in the collateral mint's native units.","format":"int64","minimum":0,"type":"integer"},"exact":{"description":"Armada removals: `true` moves exactly `collateralAmount` or nothing. A\nremoval more than can leave now is refused with\n`sunrise-nothing-withdrawable` and the amount that can leave, and moves\nnothing. Without it a removal moves what can leave, up to\n`collateralAmount`. An add always moves the whole amount or nothing, so\nthe flag changes nothing there. Refused on a Phoenix (`underwriter = 2`)\nremoval.","type":"boolean"},"marketMint":{"description":"Base58 SPL mint of the market whose position is being adjusted.","type":"string"},"positionPubkey":{"description":"Legacy: required only when removing collateral from a position on a\nretired venue (`underwriter = 2`); the account from the withdrawal\nquote.","type":["string","null"]},"price":{"description":"Client-observed market price in micro-USD (`price × 1e6`), the same\nscale as `marketPrice` on `POST /api/v1/mobile/orders`.","format":"int64","minimum":0,"type":"integer"},"profileIndex":{"description":"Sub-account index (0..5).","format":"int32","minimum":0,"type":"integer"},"requestedHedgeVenue":{"description":"Execution route identifier for Armada orders; informational. Send `0`\n(automatic) or omit it. Reserved values are rejected. Must be `0` for\nother underwriters.","format":"int32","minimum":0,"type":"integer"},"side":{"description":"0 = long, 1 = short.","format":"int32","minimum":0,"type":"integer"},"slippageBps":{"description":"Slippage tolerance in basis points.","format":"int32","minimum":0,"type":"integer"},"sunriseMarginMode":{"description":"Armada position's margin seat: `\"cross\"` or `\"isolated\"`. If omitted,\nthe seat is resolved from the existing position.","type":["string","null"]},"underwriter":{"description":"Execution venue. Send `7` (Armada). `2` (Phoenix, retired) is accepted\nonly for closing or adjusting legacy positions. `0`, `1`, `3`, `4`, `5`\nand `6` belong to retired venues and are refused.","format":"int32","minimum":0,"type":"integer"},"wallet":{"description":"Base58 wallet pubkey. Must match the JWT's wallet claim.","type":"string"}},"required":["wallet","marketMint","side","action","collateralAmount","slippageBps","profileIndex","underwriter","price"],"type":"object"},"MobileConnectRequest":{"properties":{"delegate":{"description":"When set, this is a delegate-mode connect: `signature` is by this delegate\npubkey, which must match the on-chain `UserAccount.signer_delegate`.","type":["string","null"]},"message":{"description":"Plain message that was signed. Wallet mode: `imperial:mobile-connect:{wallet}:{nonce}`.\nDelegate mode: `imperial:delegate-connect:{wallet}:{delegate}:{nonce}`.\n`{nonce}` must be a current Unix timestamp (seconds or millis, e.g. `Date.now()`), not a\nrandom value: digits only, at most 13 of them. It is rejected if >5 min old or >5 min in\nthe future, and is single-use.","type":"string"},"signature":{"description":"Base58-encoded signature over `message`. Wallet mode: by `wallet`. Delegate\nmode: by the registered `delegate` key.","type":"string"},"wallet":{"description":"Base58 Solana wallet pubkey","type":"string"}},"required":["wallet","message","signature"],"type":"object"},"MobileConnectResponse":{"properties":{"code":{"description":"One-time code to exchange for a JWT via `/mobile/exchange` within 5 minutes.","type":"string"}},"required":["code"],"type":"object"},"MobileCreateOrderBatchRequest":{"properties":{"closeOrders":{"description":"Close orders (TP, SL, trailing stop, DCA close, ...) attached to the\nentry. Each must have `action == 1` and match the entry's `wallet`,\n`marketMint`, `side`, `underwriter` and `profileIndex`. A resting close\nwith `sizeUsd = 0` closes the full size the entry opens. All legs must\ncarry the same `builderCode`, or none.","items":{"$ref":"#/components/schemas/MobileCreateOrderRequest"},"type":"array"},"entry":{"$ref":"#/components/schemas/MobileCreateOrderRequest","description":"The entry order. Must have `action == 0` (Increase)."}},"required":["entry"],"type":"object"},"MobileCreateOrderBatchResponse":{"properties":{"closeOrders":{"description":"One result per close leg, in input order. Empty if the entry failed.","items":{"$ref":"#/components/schemas/MobileOrderResponse"},"type":"array"},"entry":{"$ref":"#/components/schemas/MobileOrderResponse","description":"Result of the entry submission. `success = false` skips the close legs."},"ledger":{"description":"Keyed requests only: the order bot recorded every transaction it sent\nfor this bundle in the money-request ledger. Absent otherwise.","type":"boolean"}},"required":["entry","closeOrders"],"type":"object"},"MobileCreateOrderRequest":{"properties":{"action":{"description":"0 = Increase, 1 = Decrease.","format":"int32","minimum":0,"type":"integer"},"builderCode":{"description":"Optional builder code (case-insensitive; normalized to uppercase). The\ncode's fixed fee rate (at most 10 bps) is charged on notional, on top of\nthe standard fee, on both the opening and closing trade. Unknown or\ndeactivated codes are rejected with `400`.","type":["string","null"]},"closeBps":{"description":"For decrease orders (`action = 1`) only: fraction of the live position\nto close, in basis points (`10000` = full close, `2500` = a quarter).\nRecommended over `sizeUsd` for closes: it is evaluated against the\nposition size at execution, so price drift cannot turn an intended full\nclose into a partial one that leaves dust.\nWhen set, `sizeUsd` is ignored for close sizing. A full close may\nequivalently send `sizeUsd = 0` with this field omitted. Not yet\nsupported on DCA close order types (12/13/14), which still size each\nleg from `sizeUsd`. Rejected with `400` on increase orders.","format":"int32","minimum":0,"type":["integer","null"]},"collateralAmount":{"description":"Collateral in the collateral mint's native units (USDC: 6 decimals,\n1_000_000 = $1).\n\nOn Armada (`underwriter = 7`) this is always the position's **full**\nmargin, on cross and isolated seats alike, never a pre-netted top-up.\nThe wallet is charged only for the part not already covered by free\ncollateral on the cross seat or, for isolated seats, by an available\nArmada balance (`drawableUsd` on `GET /api/v1/armada/margin`).","format":"int64","minimum":0,"type":"integer"},"extraData":{"description":"Per-order-type parameters (e.g. `{ \"worstPrice\": ..., \"ratchetSize\": ... }`\nfor ratchet orders, plus an optional `stopTriggerPrice` on a Ratchet close; `{ \"dcaNumLegs\": ..., \"dcaIntervalSeconds\": ... }` for DCA).\nArmada orders may set `sunriseSeat`: 0 = cross, 1 = isolated, 2 = the\nsecond isolated seat. For an isolated increase, sending 1 is enough;\nImperial picks which of the two isolated seats it opens on. Increases\nwithout `sunriseSeat` use the profile's margin mode, and an increase\nnaming the other kind's seat is a `400` with `errorCode`\n`MarginModeSeatMismatch`. Closes should carry the target position's\nseat, which does not change when the profile's mode changes.\nA take-profit / stop-loss leg may name its role in `closeRole` (`\"tp\"`\nor `\"sl\"`); the trigger condition must then point the way that role\nmeans for the order's side, or the leg is refused."},"fundingStatus":{"description":"Must be 0 (or omitted): every order is funded at creation. Deferred funding (1) was\nretired and is refused.","format":"int32","minimum":0,"type":"integer"},"leverage":{"description":"Armada increases only: the leverage chosen for the order. Saved as the\nmarket's leverage setting and displayed for cross positions, where size\nover collateral reflects the whole cross account rather than this\nposition.","format":"double","type":["number","null"]},"marketMint":{"description":"Base58 SPL mint of the market (e.g. SOL mint for SOL-PERP). Either this\nor `symbol` must be set; if both are provided, `marketMint` wins.\nUse `symbol` instead unless you already have a venue-specific mint and\nwant to skip the server-side lookup.","type":["string","null"]},"marketPrice":{"description":"Client-observed market price when the order was placed, in micro-USD\n(`price × 1e6`; SOL at $64.94 is `64940000`). Unlike `triggerPrice`,\nthis is not 1e9 scale. Used on-chain as the reference for the market\norder's slippage check; a value far from the market is refused rather\nthan filled. Ignored for resting orders.","format":"int64","minimum":0,"type":"integer"},"orderType":{"description":"0=Market, 1=Limit, 2=StopLimit, 3=LandMine, 4=Ratchet, 6=RatchetEntry, 9=DCA,\n10=FibRatchet, 11=FibRatchetEntry, 12=DcaClose, 13=DcaTimeClose,\n14=DcaRatchetClose, 15=DcaTime, 16=DcaRatchet.","format":"int32","minimum":0,"type":"integer"},"parentOrderPda":{"description":"Order PDA of the resting limit order this close order (TP/SL/trailing\nstop) is attached to. Set it when attaching a close order to a limit\nthat has not filled yet, so it is grouped with, and cancelled along\nwith, that limit. Omit for close orders on an open position and for\nentry orders.","type":["string","null"]},"phoenixNative":{"description":"Legacy: only applied to limit orders on a retired venue. Omit it.","type":["boolean","null"]},"priority":{"description":"Stored on the order; lower value = higher priority (0 is highest). Has no effect on\nSolana priority fees.","format":"int32","minimum":0,"type":"integer"},"profileIndex":{"description":"Sub-account index (0..5). Profiles don't share balances or positions.\nEach profile has a margin mode (isolated by default) that sets the\ndefault margin seat for new positions; `GET\n/api/v1/passthrough/users/{wallet}/profiles` reports it. On Armada,\n`extraData.sunriseSeat` may name a seat of that mode; one of the other\nkind is refused with `MarginModeSeatMismatch`.","format":"int32","minimum":0,"type":"integer"},"quote":{"description":"Optional, diagnostic only: the client's pre-trade estimate for this\norder (shape: `OrderQuotePayload`), stored so the realized fill can be\ncompared with it. A malformed value never fails the order."},"quoteId":{"description":"Id of a quote returned by `/api/v1/armada/quote` (Armada only). The\norder is priced from the server's record of that quote, not from\nclient-sent numbers. A quote applies to one order and expires; an\nunknown or expired id is ignored rather than failing the order.","type":["string","null"]},"requestedHedgeVenue":{"description":"Execution route identifier for Armada orders; informational. Send `0`\n(automatic) or omit it. Reserved values are rejected. Must be `0` for\nother underwriters.","format":"int32","minimum":0,"type":"integer"},"side":{"description":"0 = long, 1 = short.","format":"int32","minimum":0,"type":"integer"},"sizeUsd":{"description":"Position size in USD, 6-decimal fixed point (1_000_000 = $1).","format":"int64","minimum":0,"type":"integer"},"slippageBps":{"description":"Slippage tolerance in basis points (100 = 1%).","format":"int32","minimum":0,"type":"integer"},"symbol":{"description":"Canonical Imperial symbol (e.g. `\"SOL\"`, `\"XAU\"`). Resolved server-side\nto the right `marketMint` for the requested `underwriter`. This is the\nrecommended way to address a market: symbols from the market and\nfunding-rate endpoints work directly, including markets with no SPL mint\nof their own (XAU, SPY, EUR, ...).","type":["string","null"]},"triggerCondition":{"description":"0 = Above, 1 = Below. Direction of trigger condition relative to price.","format":"int32","minimum":0,"type":"integer"},"triggerPrice":{"description":"Trigger price in oracle scale (1e9). Required for non-market orders.","format":"int64","minimum":0,"type":"integer"},"underwriter":{"description":"Execution venue. Send `7` (Armada). `2` (Phoenix, retired) is accepted\nonly for closing or adjusting legacy positions. `0`, `1`, `3`, `4`, `5`\nand `6` belong to retired venues and are refused.","format":"int32","minimum":0,"type":"integer"},"wallet":{"description":"Base58 wallet pubkey. Must match the JWT's wallet claim.","type":"string"}},"required":["wallet","side","orderType","action","triggerCondition","sizeUsd","collateralAmount","slippageBps","triggerPrice","profileIndex","priority","underwriter"],"type":"object"},"MobileExchangeRequest":{"properties":{"code":{"description":"One-time code returned by `/mobile/connect`.","type":"string"}},"required":["code"],"type":"object"},"MobileExchangeResponse":{"properties":{"expiresAt":{"description":"Unix timestamp (seconds) when the JWT expires.","format":"int64","minimum":0,"type":"integer"},"jwt":{"description":"JWT. Pass as `Authorization: Bearer <jwt>` on trading endpoints.","type":"string"}},"required":["jwt","expiresAt"],"type":"object"},"MobileOrderResponse":{"properties":{"adjustedSizeUsd":{"description":"Legacy: set only when a retired venue reduced the order's size so it\ncould open; the final size in 6-decimal USD. Informational, not an\nerror.","format":"int64","minimum":0,"type":["integer","null"]},"cancelledChildOrderPdas":{"description":"Cancel only: PDAs of pending TP/SL orders attached to the cancelled\norder (via `parentOrderPda`) that were cancelled with it.","items":{"type":"string"},"type":"array"},"error":{"description":"Humanized error message when `success` is false.","type":["string","null"]},"errorCode":{"description":"Machine-matchable error code for programmatic branching. Named codes\ncover the stable rejection classes: `PostOnlyWouldCross`,\n`SwapRouteUnavailable`, `MarketClosed`, `TradingPaused`,\n`SlippageExceeded`, `PositionAlreadyClosed`, `ProfileHasOpenPositions`,\n`CancelViaAppOnly`, `InsufficientBalance`,\n`LeverageTooHigh`, `LeverageTooLow`, `MinCollateral`,\n`ReduceBelowMinCollateral`, `InsufficientVenueBalance`,\n`InsufficientMargin`. Any other on-chain rejection surfaces its raw\nprogram error as `Custom<N>` (e.g. `Custom6024`). `None` on success and\non failures with no recognizable program code (read `error` for the\nhuman-facing message).","type":["string","null"]},"errorDetails":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/UserErrorDetails","description":"Structured, user-safe reason, outcome and recovery guidance. `error` and\n`errorCode` remain for existing integrations."}]},"ledger":{"description":"Keyed requests only: the order bot recorded every transaction it sent\nfor this request in the money-request ledger. Absent otherwise.","type":"boolean"},"makerOnly":{"description":"Legacy: `true` only for post-only orders on a retired venue. Always\n`false` for current orders.","type":"boolean"},"orderPda":{"description":"Base58 Order PDA for **resting orders only** (limit, stop-limit,\ntrailing stop, DCA, etc.); `null` for market orders. Use it for\n`/api/v1/mobile/orders/cancel` or `/api/v1/mobile/orders/update` without\npolling for the order. Derived from the profile PDA and the account's\norder counter at placement. On a `duplicate` outcome, the existing\npending order.","type":["string","null"]},"postOnlyRejected":{"description":"`true` when a post-only order was refused because it would have crossed\nthe spread. Paired with `wouldCross = true` and\n`errorCode = \"PostOnlyWouldCross\"`; no order, position or trade is\ncreated. Legacy: only set for retired-venue post-only orders.","type":"boolean"},"reason":{"description":"Original explanation accompanying a known cancel no-op.","type":["string","null"]},"resolutionSignature":{"description":"Transaction behind an outcome that differs from what was asked: a cancel\nthat was not a full cancellation (partial, unverified, scheduled,\nretired), or the close that an Armada open produced when it netted\nagainst an opposite position and the remainder did not open. For\ninformation only; do not use it to decide whether to cancel or retry.\n`signature` is reserved for a confirmed cancellation or placed order.","type":["string","null"]},"signature":{"description":"Solana transaction signature, if one was produced.","type":["string","null"]},"status":{"description":"Cancel only: a known no-op outcome (for example, the order was already\ngone).","type":["string","null"]},"submissionOutcome":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/SubmissionOutcome","description":"How this request ended, when not a plain success: `rejected`, `unknown`\n(the result could not be confirmed), or `duplicate`. Describes this\nrequest only; never infer the outcome of an earlier submission from it.\nMay be absent."}]},"success":{"description":"True if the request was accepted.","type":"boolean"},"wouldCross":{"description":"`true` when the requested limit price would immediately cross resting\nliquidity. For a post-only order this is why it was rejected rather\nthan filled as taker.","type":"boolean"}},"required":["success","makerOnly","postOnlyRejected","wouldCross"],"type":"object"},"MobilePointsResponse":{"properties":{"seasonName":{"description":"Name of the active points season, or `null` when no season is live\n(in which case both points figures are `0`).","type":["string","null"]},"seasonPoints":{"description":"Whole-point figure as displayed on the Imperial homepage\n(`seasonPointsMicros / 1_000_000`, floored).","format":"int64","minimum":0,"type":"integer"},"seasonPointsMicros":{"description":"Imperial points earned this season, in micro-points (6 decimals).","format":"int64","minimum":0,"type":"integer"},"wallet":{"type":"string"}},"required":["wallet","seasonPointsMicros","seasonPoints"],"type":"object"},"MobilePreflightResponse":{"description":"Preflight verdict on an order that has not been placed. `ok: false` is\nreturned with HTTP 200 and a reason in `error` / `errorCode`.","properties":{"adjustedSizeUsd":{"description":"Legacy: present only when a retired venue would reduce this order's\nsize; the reduced size in 6-decimal USD, same scale as `sizeUsd`.","format":"int64","minimum":0,"type":["integer","null"]},"error":{"type":["string","null"]},"errorCode":{"type":["string","null"]},"ok":{"type":"boolean"}},"required":["ok"],"type":"object"},"MobileProOrderUpdate":{"properties":{"ratchetSize":{"format":"int64","minimum":0,"type":["integer","null"]},"stopTrigger":{"description":"Ratchet only: early stop trigger (0 clears it back to a classic trailing stop).","format":"int64","minimum":0,"type":["integer","null"]},"type":{"description":"One of: `ratchet`, `landMine`.","type":"string"},"waitDurationSeconds":{"format":"int64","minimum":0,"type":["integer","null"]},"waitPrice":{"format":"int64","minimum":0,"type":["integer","null"]},"worstPrice":{"format":"int64","minimum":0,"type":["integer","null"]}},"required":["type"],"type":"object"},"MobileReversePositionRequest":{"description":"The position to reverse. It names the position rather than a size: the new\nposition holds the same amount of the asset, read off the chain.","properties":{"builderCode":{"type":["string","null"]},"marketMint":{"description":"The `marketMint` a close of this position sends. Either this or `symbol`.","type":["string","null"]},"marketPrice":{"description":"Live price in micro-USD. Both legs' slippage bands measure against it.","format":"int64","minimum":0,"type":"integer"},"positionEpoch":{"description":"The position's `openedAtSlot`. A reverse of any other instance of the\nposition is refused, so a repeated press cannot flip it back.","format":"int64","minimum":0,"type":"integer"},"profileIndex":{"format":"int32","minimum":0,"type":"integer"},"requestedHedgeVenue":{"description":"`1` (the venue Armada hedges on); `0` means the position's own venue.","format":"int32","minimum":0,"type":"integer"},"side":{"description":"The position's current side: 0 long, 1 short.","format":"int32","minimum":0,"type":"integer"},"slippageBps":{"description":"Applied to each leg.","format":"int32","minimum":0,"type":"integer"},"sunriseSeat":{"description":"The position's margin seat: 0 cross, 1 isolated, 2 second isolated.","format":"int32","minimum":0,"type":"integer"},"symbol":{"description":"The market's symbol. Either this or `marketMint`.","type":["string","null"]},"wallet":{"type":"string"}},"required":["wallet","profileIndex","side","sunriseSeat","positionEpoch","marketPrice","slippageBps"],"type":"object"},"MobileReversePositionResponse":{"properties":{"cancelledOrderPdas":{"description":"Order PDAs the reverse cancelled before closing: entry orders on the\nold side of this market, and the TP/SL attached to them. Present on\nany outcome, `not_placed` included, since a cancel that landed stays.","items":{"type":"string"},"type":"array"},"closeSignature":{"description":"The close's ACCEPT, once it settled.","type":["string","null"]},"error":{"type":["string","null"]},"errorCode":{"type":["string","null"]},"errorDetails":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/UserErrorDetails"}]},"newCollateralUsd":{"description":"Micro-USDC posted behind the new position.","format":"int64","minimum":0,"type":["integer","null"]},"newSide":{"description":"The new position's side: 0 long, 1 short.","format":"int32","minimum":0,"type":["integer","null"]},"newSizeUsd":{"description":"Micro-USD the new position filled.","format":"int64","minimum":0,"type":["integer","null"]},"openSignature":{"description":"The open's ACCEPT, once it settled.","type":["string","null"]},"ordersLeftLive":{"description":"On `closed_only`: the order PDAs of the user's entry orders on the new\nside of this market, which the reverse leaves live. The user is flat,\nso one that fills opens a position.","items":{"type":"string"},"type":"array"},"outcome":{"description":"`reversed` (both legs settled on chain), `not_placed` (refused before\nanything closed; a retry is safe), `closed_only` (the close settled and\nthe open was refused; never retry automatically) or `unknown` (a leg's\nresult is not known yet; watch positions, do not retry).","example":"reversed","type":"string"}},"required":["outcome"],"type":"object"},"MobileReversePreflightResponse":{"description":"Verdict on a reverse the caller has NOT placed. `reversible: false` is a\n200 with a reason, like `/mobile/orders/preflight`.","properties":{"error":{"type":["string","null"]},"errorCode":{"type":["string","null"]},"errorDetails":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/UserErrorDetails"}]},"estimatedFeesUsd":{"description":"Micro-USDC of fees for both legs at `marketPrice`.","format":"int64","minimum":0,"type":["integer","null"]},"leverageAfter":{"description":"`newSizeUsd` over `newCollateralUsd`, e.g. `19.0`. Above\n`leverageBefore` when the close leaves less than the old margin.","format":"double","type":["number","null"]},"leverageBefore":{"description":"The old position's seat leverage (gross notional over collateral),\ne.g. `10.0`.","format":"double","type":["number","null"]},"newCollateralUsd":{"description":"Micro-USDC the new position would be margined with: the leverage the\nold position's seat carries, from what the account holds once the close\nsettles at `marketPrice`, its profit or loss and fees included. Less\nthan that leverage needs when the close leaves less; a little more when\nthat leverage sits on the cap and the open's fee would tip it over.","format":"int64","minimum":0,"type":["integer","null"]},"newSide":{"format":"int32","minimum":0,"type":["integer","null"]},"newSizeUsd":{"description":"Micro-USD the new position would hold at `marketPrice`.","format":"int64","minimum":0,"type":["integer","null"]},"ordersToCancel":{"description":"Order PDAs a reverse would cancel first: the live entry orders on the\nposition's side of this market, and the TP/SL attached to them.","items":{"type":"string"},"type":"array"},"reversible":{"type":"boolean"}},"required":["reversible"],"type":"object"},"MobileUpdateOrderRequest":{"properties":{"closeBps":{"description":"For decrease orders: new close percentage in bps (0..10000). Omit to leave unchanged.","format":"int32","minimum":0,"type":["integer","null"]},"orderPda":{"description":"Base58 PDA of the order to update.","type":"string"},"priority":{"description":"New order priority (lower value = higher priority). Omit to leave\nunchanged.","format":"int32","minimum":0,"type":["integer","null"]},"proOrderUpdate":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/MobileProOrderUpdate","description":"Per-type parameter update for advanced orders (ratchet / land-mine)."}]},"profileIndex":{"description":"Sub-account index (0..5).","format":"int32","minimum":0,"type":"integer"},"quote":{"description":"Optional, diagnostic only: the client's updated pre-trade estimate\n(shape: `OrderQuotePayload`). Must include `side`, `orderType`,\n`underwriter` and `marketMint`, since this request identifies the order\nby PDA only."},"sizeUsd":{"description":"New size in USD. Omit to leave unchanged.","format":"int64","minimum":0,"type":["integer","null"]},"slippageBps":{"description":"New slippage tolerance (bps). Omit to leave unchanged.","format":"int32","minimum":0,"type":["integer","null"]},"triggerPrice":{"description":"New trigger price (1e9 scale). Omit to leave unchanged.","format":"int64","minimum":0,"type":["integer","null"]},"wallet":{"description":"Base58 wallet pubkey. Must match the JWT's wallet claim.","type":"string"}},"required":["wallet","orderPda","profileIndex"],"type":"object"},"OiHistoryPeak":{"properties":{"oiUsd":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","oiUsd"],"type":"object"},"OiHistoryPoint":{"properties":{"oiUsd":{"type":"string"},"timestamp":{"format":"date-time","type":"string"}},"required":["timestamp","oiUsd"],"type":"object"},"OiHistoryResponse":{"properties":{"currentOiUsd":{"description":"Current open interest across all open positions, in USD. The last\nentry in `rows` should normally match it.","type":"string"},"grouping":{"type":"string"},"peak":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/OiHistoryPeak"}]},"period":{"type":"string"},"rows":{"items":{"$ref":"#/components/schemas/OiHistoryPoint"},"type":"array"}},"required":["period","grouping","currentOiUsd","rows"],"type":"object"},"OpenInterestResponse":{"properties":{"asOf":{"format":"date-time","type":"string"},"grouping":{"type":"string"},"rows":{"items":{"$ref":"#/components/schemas/OpenInterestRow"},"type":"array"}},"required":["grouping","asOf","rows"],"type":"object"},"OpenInterestRow":{"properties":{"label":{"type":"string"},"longUsd":{"type":"string"},"positionCount":{"format":"int64","type":"integer"},"shortUsd":{"type":"string"},"totalUsd":{"type":"string"},"traderCount":{"format":"int64","type":"integer"}},"required":["label","longUsd","shortUsd","totalUsd","traderCount","positionCount"],"type":"object"},"OracleFreshness":{"description":"`fresh` (current), `stale` (past its expiry; per-market values are\nreported as unknown), or `unavailable` (no valid status).","enum":["fresh","stale","unavailable"],"type":"string"},"OracleMarketStatus":{"description":"Reference pricing status for one market.","properties":{"price_cap_bps":{"description":"The price movement cap while `warning` is true, bps. Null otherwise.","format":"int32","minimum":0,"type":["integer","null"]},"symbol":{"description":"Market symbol.","type":"string"},"warning":{"description":"True when the market's reference price is not currently drawn from\nexternal sources and its movement is capped. Null when unknown; null is\nnot a statement that pricing is normal.","type":["boolean","null"]}},"required":["symbol"],"type":"object"},"OracleStatusResponse":{"description":"Informational reference pricing status per market. Not used to price or\naccept orders.","properties":{"expires_at_ms":{"description":"When this status stops being `fresh`, Unix ms.","format":"int64","type":["integer","null"]},"freshness":{"$ref":"#/components/schemas/OracleFreshness"},"markets":{"description":"Per-market status. Treat a market missing from the list as unknown.","items":{"$ref":"#/components/schemas/OracleMarketStatus"},"type":"array"},"observed_at_ms":{"description":"When this server last read the status, Unix ms.","format":"int64","type":["integer","null"]},"schema_version":{"description":"Response format version.","format":"int32","minimum":0,"type":"integer"},"server_time_ms":{"description":"Server time at response, Unix ms.","format":"int64","type":"integer"},"source":{"description":"Identifier of the pricing data source; informational.","type":"string"},"source_computed_at_ms":{"description":"When the source computed the status, Unix ms.","format":"int64","type":["integer","null"]}},"required":["schema_version","source","freshness","server_time_ms","markets"],"type":"object"},"OrderHistoryDetailResponse":{"allOf":[{"$ref":"#/components/schemas/OrderHistoryRowResponse"},{"properties":{"children":{"items":{"$ref":"#/components/schemas/OrderHistoryRowResponse"},"type":"array"},"config":{"description":"Decoded order or strategy configuration."},"events":{"items":{"$ref":"#/components/schemas/OrderHistoryEventResponse"},"type":"array"},"feesUsd":{"type":["string","null"]},"fills":{"items":{"$ref":"#/components/schemas/OrderHistoryFillResponse"},"type":"array"},"fundingUsd":{"description":"Funding the order's fills settled; a component of `fees_usd`, never an addition.","type":["string","null"]}},"required":["children","fills","events"],"type":"object"}]},"OrderHistoryEventResponse":{"properties":{"eventType":{"type":"string"},"legIndex":{"format":"int32","type":["integer","null"]},"payload":{},"price":{"type":["string","null"]},"reason":{"type":["string","null"]},"reasonCode":{"type":["string","null"]},"reasonDetails":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/UserErrorDetails"}]},"signature":{"type":["string","null"]},"source":{"type":"string"},"timestamp":{"format":"int64","type":"integer"},"value":{"type":["string","null"]}},"required":["eventType","timestamp","source"],"type":"object"},"OrderHistoryFillResponse":{"properties":{"feesUsd":{"type":["string","null"]},"fundingUsd":{"description":"Funding this fill settled (positive = paid). A component of `fees_usd`, never\nan addition, so `fees_usd - funding_usd` is the fill's trading fee.","type":["string","null"]},"legIndex":{"format":"int64","type":["integer","null"]},"price":{"type":["string","null"]},"sizeUsd":{"type":["string","null"]},"status":{"type":"string"},"statusReason":{"type":["string","null"]},"statusReasonDetails":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/UserErrorDetails"}]},"time":{"format":"int64","type":"integer"},"txSignature":{"type":["string","null"]}},"required":["time","status"],"type":"object"},"OrderHistoryResponse":{"properties":{"orders":{"items":{"$ref":"#/components/schemas/OrderHistoryRowResponse"},"type":"array"},"profileIndex":{"description":"The account scope applied to the rows, pagination and totals.","format":"int32","type":["integer","null"]},"totalCount":{"format":"int64","type":"integer"}},"required":["orders","totalCount"],"type":"object"},"OrderHistoryRowResponse":{"properties":{"action":{"type":"string"},"avgFillPrice":{"type":["string","null"]},"bestPriceSeen":{"type":["string","null"]},"botState":{"description":"Execution state of a live order, when not normal: `circuit_broken`\n(paused), `insufficient_funds`, `at_leverage_limit` or\n`above_market_table` (triggered but not placed; it still rests).","type":["string","null"]},"cancelledAt":{"format":"int64","type":["integer","null"]},"childCount":{"format":"int64","type":"integer"},"collateralAmount":{"type":"string"},"createdAt":{"format":"int64","type":"integer"},"creationSignature":{"type":"string"},"dca":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/DcaSummary"}]},"displayStatus":{"description":"User-facing status: `open`, `active`, `partially_filled`, `filled`,\n`triggered`, `completed`, `paused`, `canceled`, `rejected`, or `failed`.","type":"string"},"executedAt":{"format":"int64","type":["integer","null"]},"executionSignature":{"type":["string","null"]},"executionTriggerPrice":{"type":["string","null"]},"fillCount":{"format":"int64","type":"integer"},"filledSizeUsd":{"type":["string","null"]},"indicator":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/IndicatorSummary"}]},"marketMint":{"type":"string"},"orderPda":{"type":"string"},"orderType":{"type":"string"},"parentOrderPda":{"type":["string","null"]},"profileIndex":{"format":"int32","type":"integer"},"ratchet":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/RatchetSummary"}]},"side":{"type":"string"},"sizeUsd":{"type":"string"},"slippageBps":{"format":"int32","type":"integer"},"status":{"description":"Raw stored status (`pending`, `resting`, `executed`, `filled`,\n`cancelled`, `failed`). Prefer `displayStatus`.","type":"string"},"statusReason":{"description":"User-readable reason, when known. Also set on a live order waiting at\n`botState` `at_leverage_limit` (coded `ArmadaSeatAtLeverageLimit`) or\n`above_market_table` (coded `ArmadaSizeAboveMarketTable`).","type":["string","null"]},"statusReasonCode":{"description":"Machine reason code underlying `status_reason`.","type":["string","null"]},"statusReasonDetails":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/UserErrorDetails"}]},"triggerCondition":{"type":["string","null"]},"triggerPrice":{"type":["string","null"]},"underwriter":{"type":"string"},"venueOrderId":{"type":["string","null"]}},"required":["orderPda","marketMint","side","orderType","action","sizeUsd","collateralAmount","slippageBps","displayStatus","status","underwriter","profileIndex","creationSignature","createdAt","fillCount","childCount"],"type":"object"},"OrderQuotePayload":{"description":"Client-side pre-trade estimate for a close order (TP/SL), sent in `quote`\nfor diagnostics. Money fields (`*Micro`) are micro-USD (6 decimals); prices\n(`*Nano`) are 1e9 scale, like `triggerPrice`.","properties":{"afterFeesOwedMicro":{"format":"int64","type":"integer"},"afterFeesPaidMicro":{"format":"int64","type":"integer"},"assetSymbol":{"type":["string","null"]},"borrowFeeOwedMicro":{"format":"int64","type":"integer"},"clientVersion":{"type":["string","null"]},"closeBps":{"format":"int32","type":"integer"},"closeFeeOwedMicro":{"format":"int64","type":"integer"},"collateralUsdMicro":{"format":"int64","type":"integer"},"entryPriceNano":{"format":"int64","type":"integer"},"execPriceNano":{"format":"int64","type":"integer"},"feesOwedMicro":{"format":"int64","type":"integer"},"feesPaidMicro":{"format":"int64","type":"integer"},"formulaVersion":{"description":"Version of the estimate formula; changes whenever the formula does.","format":"int32","type":"integer"},"inputMode":{"description":"`\"price\"`, `\"pct\"` or `\"pnl\"`.","type":"string"},"lastPriceNano":{"format":"int64","type":"integer"},"leg":{"description":"`\"tp\"` or `\"sl\"`.","type":"string"},"legPnlMicro":{"description":"Estimated PnL of this order on its own.","format":"int64","type":"integer"},"lifecycleId":{"format":"uuid","type":["string","null"]},"markPriceNano":{"format":"int64","type":"integer"},"marketMint":{"type":["string","null"]},"netCapitalMicro":{"description":"Net capital at risk used as the estimate's basis. Absent when it could\nnot be computed and current collateral was used instead.","format":"int64","type":["integer","null"]},"netPnlMicro":{"description":"Estimated net PnL for the whole position.","format":"int64","type":"integer"},"orderType":{"format":"int32","minimum":0,"type":["integer","null"]},"pricePnlMicro":{"format":"int64","type":"integer"},"priceRef":{"description":"`\"last\"` or `\"mark\"`.","type":"string"},"side":{"description":"Identity of the order being quoted. Needed on order updates, which\naddress the order by PDA only; ignored when the enclosing request\nalready carries these fields.","format":"int32","minimum":0,"type":["integer","null"]},"sizeUsdMicro":{"format":"int64","type":"integer"},"swapFeeOwedMicro":{"format":"int64","type":"integer"},"underwriter":{"format":"int32","minimum":0,"type":["integer","null"]}},"required":["leg","netPnlMicro","legPnlMicro","pricePnlMicro","afterFeesPaidMicro","afterFeesOwedMicro","execPriceNano","entryPriceNano","sizeUsdMicro","collateralUsdMicro","closeBps","feesPaidMicro","feesOwedMicro","borrowFeeOwedMicro","closeFeeOwedMicro","swapFeeOwedMicro","markPriceNano","lastPriceNano","priceRef","inputMode","formulaVersion"],"type":"object"},"OwnedReferralAlias":{"properties":{"code":{"type":"string"},"createdAt":{"type":"string"},"kind":{"type":"string"}},"required":["code","kind","createdAt"],"type":"object"},"OwnedReferralAliasesResponse":{"properties":{"aliases":{"items":{"$ref":"#/components/schemas/OwnedReferralAlias"},"type":"array"}},"required":["aliases"],"type":"object"},"PackPrizeOverlay":{"description":"Legacy: display details for a historical position opened from a perp pack.\nPerp packs are discontinued.","properties":{"backdatedEntryPrice":{"description":"Displayed entry price: a real market price at `backdatedOpenedAt`.","type":"string"},"backdatedOpenedAt":{"description":"Displayed open time, Unix seconds.","format":"int64","type":"integer"},"pnlOffsetUsd":{"description":"PnL fixed at the pack draw, in USD. Add it to the live PnL; do not\nrecompute it from `backdatedEntryPrice`.","type":"string"},"ripFeeUsd":{"description":"Part of the pack price, in USD, excluded from the position's PnL basis.","type":["string","null"]},"stakeUsd":{"description":"Full pack price, in USD. The displayed PnL basis is this minus\n`ripFeeUsd`, unless `storyCollateralUsd` is set.","type":"string"},"storyCollateralUsd":{"description":"Displayed collateral, in USD. When present it is the displayed PnL\nbasis, and `pnlOffsetUsd` is measured against it.","type":["string","null"]}},"required":["backdatedEntryPrice","backdatedOpenedAt","stakeUsd","pnlOffsetUsd"],"type":"object"},"PassthroughOrderInfo":{"properties":{"action":{"type":"string"},"botState":{"description":"Execution state of a live order, when not normal: `circuit_broken`\n(execution paused), `insufficient_funds` (triggered, but the profile\ncould not fund it), `at_leverage_limit` (triggered, but filling it\nwould have put its Armada seat past its leverage tier) or\n`above_market_table` (triggered, but filling it would have taken the\nposition past the market's margin table). Either of the last two still\nrests and fills when it next triggers with room.","type":["string","null"]},"collateralAmount":{"type":"string"},"createdAt":{"format":"int64","type":"integer"},"creationSignature":{"type":"string"},"creationSlot":{"description":"Solana slot in which the order's creation transaction landed.","format":"int64","type":"integer"},"currentBestPriceUsd":{"type":["string","null"]},"fundingStatus":{"format":"int32","type":"integer"},"marketMint":{"type":"string"},"orderData":{},"orderPda":{"type":"string"},"orderType":{"type":"string"},"parentOrderPda":{"description":"Order PDA of the parent limit order, when this is a close order\n(TP/SL/trailing) attached to a limit order that has not filled yet.\nAbsent for entry orders and for close orders on an open position.","type":["string","null"]},"priority":{"format":"int32","type":"integer"},"profileIndex":{"format":"int32","type":"integer"},"side":{"type":"string"},"sizeUsd":{"type":"string"},"slippageBps":{"format":"int32","type":"integer"},"status":{"type":"string"},"sunriseSeat":{"description":"Armada only: margin seat chosen at creation, as in\n`extraData.sunriseSeat`: `0` cross, `1` or `2` isolated. Absent for\nolder orders.","format":"int32","minimum":0,"type":["integer","null"]},"triggerCondition":{"type":["string","null"]},"triggerPrice":{"type":["string","null"]},"underwriter":{"type":"string"},"venueOrderState":{"description":"Venue-specific resting-order state. Legacy: only set on historical\nPhoenix orders."},"wallet":{"type":"string"}},"required":["orderPda","wallet","marketMint","side","orderType","action","sizeUsd","collateralAmount","slippageBps","status","creationSignature","creationSlot","createdAt","profileIndex","priority","fundingStatus","underwriter"],"type":"object"},"PassthroughOrderResponse":{"properties":{"action":{"type":"string"},"cancelledAt":{"format":"int64","type":["integer","null"]},"collateralAmount":{"type":"string"},"createdAt":{"format":"int64","type":"integer"},"creationSignature":{"type":"string"},"creationSlot":{"description":"Solana slot in which the order's placement transaction landed.","format":"int64","type":"integer"},"executedAt":{"format":"int64","type":["integer","null"]},"executionSignature":{"type":["string","null"]},"marketMint":{"type":"string"},"orderData":{},"orderPda":{"type":"string"},"orderType":{"type":"string"},"parentOrderPda":{"description":"Order PDA of the parent limit order, when this is a close order\n(TP/SL/trailing stop) attached to a limit that had not filled. Omitted\nfor entry orders and for close orders attached to an open position.","type":["string","null"]},"profileIndex":{"format":"int32","type":"integer"},"profilePda":{"type":"string"},"side":{"type":"string"},"sizeUsd":{"type":"string"},"slippageBps":{"format":"int32","type":"integer"},"status":{"type":"string"},"triggerCondition":{"type":["string","null"]},"triggerPrice":{"type":["string","null"]},"underwriter":{"type":"string"},"venueOrderState":{"description":"Live state of a resting order, when available. For an Armada resting\nlimit, `data` holds `kind` (`\"resting_limit\"`), `armed` (whether the\norder is currently working at its limit), and `target_size_usd` /\n`filled_size_usd` (6-decimal USD). Historical orders from retired venues\nmay carry other shapes. Omitted when there is no resting state."},"wallet":{"type":"string"}},"required":["orderPda","wallet","profilePda","marketMint","side","orderType","action","sizeUsd","collateralAmount","slippageBps","status","creationSignature","creationSlot","createdAt","profileIndex","underwriter"],"type":"object"},"PassthroughOrdersResponse":{"properties":{"count":{"format":"int32","type":"integer"},"orders":{"items":{"$ref":"#/components/schemas/PassthroughOrderResponse"},"type":"array"},"statusFilter":{"description":"The status filter that was applied, if any. Check it when requesting\n`active`: a response without it means the filter was not applied.","type":["string","null"]}},"required":["orders","count"],"type":"object"},"PersonalInviteReferral":{"properties":{"refereeWallet":{"type":"string"},"referralCode":{"type":"string"},"referrerWallet":{"type":"string"}},"required":["referrerWallet","refereeWallet","referralCode"],"type":"object"},"PersonalInviteRequest":{"additionalProperties":false,"properties":{"code":{"type":"string"},"expectedReferrerWallet":{"description":"Optional referrer wallet shown in a preview of the code. When set, the\nreferral is recorded only if the code still belongs to that wallet.","type":["string","null"]}},"required":["code"],"type":"object"},"PersonalInviteResponse":{"oneOf":[{"properties":{"referral":{"$ref":"#/components/schemas/PersonalInviteReferral"},"status":{"enum":["bound"],"type":"string"}},"required":["referral","status"],"type":"object"},{"properties":{"status":{"enum":["already_referred"],"type":"string"}},"required":["status"],"type":"object"}]},"PhoenixCrossSeatState":{"description":"Legacy: account-level state of a Phoenix cross-margin account. Phoenix is\nretired; this only appears for historical Phoenix positions. Values are\ndecimal strings as Phoenix reported them; a missing field means Phoenix did\nnot report it (treat as unknown, not zero).","properties":{"accountCollateralUsd":{"description":"Total deposited collateral.","type":"string"},"cancelMarginUsd":{"type":["string","null"]},"effectiveCollateralForWithdrawalsUsd":{"type":["string","null"]},"effectiveCollateralUsd":{"description":"Collateral plus discounted unrealised PnL.","type":"string"},"initialMarginForWithdrawalsUsd":{"type":["string","null"]},"initialMarginUsd":{"description":"Margin consumed by open positions and resting orders.","type":["string","null"]},"liquidationPricesBySymbol":{"additionalProperties":{"type":["string","null"]},"description":"Per-market liquidation price as Phoenix computed it, keyed by Phoenix\nsymbol. Null when Phoenix quoted no price for that market; every market\non the account has a key.","propertyNames":{"type":"string"},"type":"object"},"maintenanceMarginUsd":{"type":["string","null"]},"maxPositions":{"description":"Maximum number of concurrent positions on the account.","format":"int64","minimum":0,"type":["integer","null"]},"openPositions":{"description":"Number of markets with an open position on the account.","format":"int64","minimum":0,"type":"integer"},"portfolioValueUsd":{"type":["string","null"]},"profileIndex":{"format":"int32","minimum":0,"type":"integer"},"riskState":{"description":"Phoenix's risk classification (e.g. `\"healthy\"`).","type":["string","null"]},"riskTier":{"description":"Phoenix's risk tier (e.g. `\"safe\"`).","type":["string","null"]},"traderAccount":{"type":"string"},"unrealizedPnlUsd":{"type":["string","null"]}},"required":["traderAccount","profileIndex","accountCollateralUsd","effectiveCollateralUsd","openPositions","liquidationPricesBySymbol"],"type":"object"},"PnlHistoryPoint":{"properties":{"cumulativeFundingPayment":{"description":"Cumulative funding paid, in USD. Signed: positive = paid by the\ntrader. Includes borrow fees on historical positions from retired venues.","format":"double","type":"number"},"cumulativePnl":{"description":"Realized PnL accumulated up to and including this bucket, in USD.","format":"double","type":"number"},"cumulativeTakerFee":{"description":"Cumulative trading/execution fees, in USD. Excludes Imperial's\nplatform fee and (legacy) swap fees.","format":"double","type":"number"},"timestamp":{"description":"Bucket start, unix seconds.","format":"int64","type":"integer"},"unrealizedPnl":{"description":"Mark-to-market PnL of currently open positions at the time of the\nrequest, in USD. **Only present on the last bucket**; earlier buckets\nare `null` because historical mark-to-market is not available.","format":"double","type":["number","null"]}},"required":["timestamp","cumulativePnl","cumulativeFundingPayment","cumulativeTakerFee"],"type":"object"},"PositionsResponse":{"allOf":[{"$ref":"#/components/schemas/LifecyclesResponse"},{"properties":{"accountRead":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/AccountRead"}]},"unavailablePositionDetails":{"items":{},"type":["array","null"]}},"type":"object"}],"description":"No request may manufacture evidence from a legacy response. In particular,\nsharing the snapshot must preserve its original read ID and time window."},"PriorityFeeResponse":{"properties":{"priority_fee":{"description":"Median Solana priority fee, in micro-lamports per compute unit, seen in\nrecent blocks that touched the Imperial program. Refreshed every 30s and\ncapped at 500,000. Note the field name is snake_case.","format":"int64","minimum":0,"type":"integer"}},"required":["priority_fee"],"type":"object"},"ProfileResponse":{"properties":{"excludedVenues":{"items":{"type":"string"},"type":"array"},"marginMode":{"description":"`\"isolated\"` or `\"unified\"` (cross). The profile's default margin mode\nfor new positions: `\"unified\"` opens them on the cross margin account,\nwhere one balance backs every position. An Armada order may name a seat\nwith `extraData.sunriseSeat`, but only one of this mode; a seat of the\nother kind is refused with `MarginModeSeatMismatch`. See \"Profiles and\nmargin accounts\" in the API overview.","type":"string"},"name":{"type":["string","null"]},"profileIndex":{"format":"int32","minimum":0,"type":"integer"},"profilePda":{"type":"string"},"venueLock":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/VenueLock","description":"Present only when the margin mode restricts which venues the profile\nmay open positions on. Use this field rather than deriving the\nrestriction from `marginMode`."}]}},"required":["profileIndex","profilePda","excludedVenues","marginMode"],"type":"object"},"ProfileUsdcBalance":{"properties":{"profileIndex":{"format":"int32","minimum":0,"type":"integer"},"profilePda":{"type":"string"},"usdc":{"description":"USDC held in the profile's USDC token account, in native units\n(6 decimals; divide by `1_000_000` for whole USDC). `0` when the token\naccount has not been created yet.","format":"int64","minimum":0,"type":"integer"}},"required":["profileIndex","profilePda","usdc"],"type":"object"},"ProfilesResponse":{"properties":{"armadaParticipant":{"description":"Whether the wallet has ever joined the Armada access program. Used for\npromotions only; it does not grant or restrict trading. `null` when\nunknown.","type":["boolean","null"]},"betaVenues":{"description":"Venues available to this wallet for opening positions, by public name\n(currently `[\"armada\"]`). The same for all six profiles. Treat a venue\nabsent here as unavailable for new positions. Applies to opens only:\nclosing, reducing and withdrawing from an existing position never\ndepend on this list. Empty when the venue list could not be read.","items":{"type":"string"},"type":"array"},"profiles":{"description":"Always six entries, indexed `0..5`, whether or not the profile has ever\nbeen used.","items":{"$ref":"#/components/schemas/ProfileResponse"},"type":"array"}},"required":["profiles","betaVenues"],"type":"object"},"RatchetSummary":{"properties":{"referencePrice":{"description":"Starting reference price in nano-USD.","type":["string","null"]},"targetPrice":{"description":"Fibonacci target price in nano-USD. Fibonacci trailing orders only.","type":["string","null"]},"trailDistance":{"description":"Fixed trail distance in nano-USD. Absent for Fibonacci trailing orders.","type":["string","null"]}},"type":"object"},"RateSource":{"description":"Where a funding-rate entry came from, so a client can tell live data from\nfallbacks.","enum":["phoenix_clob_no_snapshot","phoenix_market_ws","sunrise_onchain_funding","fallback_constant"],"type":"string"},"ReferralCodeResponse":{"properties":{"code":{"type":"string"},"kind":{"type":"string"},"maxAliases":{"format":"int32","type":"integer"},"nextNewCodeAt":{"type":["string","null"]},"remainingAliases":{"format":"int64","type":"integer"},"updatedAt":{"type":"string"},"wallet":{"type":"string"}},"required":["wallet","code","kind","updatedAt","maxAliases","remainingAliases"],"type":"object"},"ReturnBasis":{"description":"The collateral behind an isolated Armada position, checked against on-chain\nhistory, used as the basis for its percentage return. `status` says whether\nit could be verified.","oneOf":[{"description":"Verified against on-chain history.","properties":{"capitalUsd":{"description":"Collateral backing the position, in USD.","type":"string"},"entryPrice":{"type":["string","null"]},"lifecycleId":{"type":"string"},"marginRevision":{"description":"Margin account revision the check was made against. Null only for\na closed position, which is checked against its closing transaction.","type":["string","null"]},"openingSlot":{"description":"Solana slot of the opening transaction.","format":"int64","minimum":0,"type":"integer"},"positionSizeUsd":{"type":["string","null"]},"status":{"enum":["verified"],"type":"string"},"version":{"description":"Format version of this object.","format":"int32","minimum":0,"type":"integer"}},"required":["version","capitalUsd","lifecycleId","openingSlot","status"],"type":"object"},{"description":"Verification is still running; poll again later.","properties":{"status":{"enum":["pending"],"type":"string"},"version":{"format":"int32","minimum":0,"type":"integer"}},"required":["version","status"],"type":"object"},{"description":"The collateral could not be verified for this position.","properties":{"status":{"enum":["unavailable"],"type":"string"},"version":{"format":"int32","minimum":0,"type":"integer"}},"required":["version","status"],"type":"object"},{"description":"The position is on cross margin, so it has no collateral of its own.","properties":{"status":{"enum":["shared_margin"],"type":"string"},"version":{"format":"int32","minimum":0,"type":"integer"}},"required":["version","status"],"type":"object"}]},"RevokeResponse":{"properties":{"success":{"type":"boolean"}},"required":["success"],"type":"object"},"RiskAcceptance":{"description":"One acceptance, as recorded.","properties":{"acceptedAt":{"description":"When it was accepted, server time.","format":"date-time","type":"string"},"device":{"$ref":"#/components/schemas/AcceptanceDevice"},"kind":{"type":"string"},"locale":{"type":"string"},"market":{"type":["string","null"]},"scope":{"$ref":"#/components/schemas/AcceptanceScope"},"textHash":{"description":"SHA-256 of the text accepted, lowercase hex, without a prefix.","type":"string"},"version":{"format":"int32","minimum":0,"type":"integer"}},"required":["kind","version","textHash","locale","scope","device","acceptedAt"],"type":"object"},"RiskAcceptanceRequest":{"additionalProperties":false,"properties":{"device":{"$ref":"#/components/schemas/AcceptanceDevice"},"kind":{"description":"Which warning: `thin_book`.","type":"string"},"locale":{"description":"The language the text was shown in, e.g. `en`. Stored lowercase.","type":"string"},"market":{"description":"The market, for `scope: market`: one whose book is thin right now.\nOmitted for `all`.","type":["string","null"]},"scope":{"$ref":"#/components/schemas/AcceptanceScope"},"text":{"description":"The exact text shown, character for character (at most 4,000). It is\nstored as sent, so it must be what was on screen.","type":"string"},"textHash":{"description":"Optional: the SHA-256 of `text` (64 hex characters, optionally prefixed\n`sha256:`). When given, it must match `text`.","type":["string","null"]},"version":{"description":"The warning's version. A change of meaning is a new version and asks\neveryone again.","format":"int32","minimum":0,"type":"integer"}},"required":["kind","version","text","locale","scope","device"],"type":"object"},"RiskAcceptancesResponse":{"properties":{"all":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/RiskAcceptance","description":"The highest version accepted for every thin-book market at once, at\nits latest acceptance; `null` if never."}]},"kind":{"type":"string"},"markets":{"additionalProperties":{"$ref":"#/components/schemas/RiskAcceptance"},"description":"Per market: the highest version accepted for that market alone, at its\nlatest acceptance.","propertyNames":{"type":"string"},"type":"object"}},"required":["kind","markets"],"type":"object"},"ServedQuote":{"description":"A quote served for one order.","properties":{"expiresAtMs":{"description":"When the quote expires, Unix ms. An expired `quoteId` is not attached.","format":"int64","type":"integer"},"hedgeVenue":{"description":"Execution route identifier; informational.","type":"string"},"quote":{"$ref":"#/components/schemas/ArmadaQuote"},"quoteId":{"description":"Server-issued quote id. Optionally send it with the order to attach\nthis quote to it; each id binds to at most one order.","type":"string"},"servedAtMs":{"description":"When the quote was served, Unix ms.","format":"int64","type":"integer"}},"required":["quoteId","hedgeVenue","quote","expiresAtMs","servedAtMs"],"type":"object"},"ServiceHealth":{"properties":{"db":{"type":["string","null"]},"grpcStream":{"type":["string","null"]},"lastProcessedSlot":{"format":"int64","minimum":0,"type":["integer","null"]},"rpc":{"type":["string","null"]},"status":{"type":"string"}},"required":["status"],"type":"object"},"SetMarginModeRequest":{"properties":{"marginMode":{"description":"`\"isolated\"` or `\"unified\"`. Anything else is a `400`.","example":"unified","type":"string"}},"required":["marginMode"],"type":"object"},"SetPositionLeverageRequest":{"properties":{"leverage":{"description":"The new tag: at least 1, and at most what the market lets an open of\nthis size use at the platform's highest builder fee. It sets the leverage\nof the next order or add on this market, not the position's own.","format":"double","type":"number"},"lifecycleId":{"description":"`id` of the open Isolated Armada position row.","type":"string"},"wallet":{"description":"Base58 wallet pubkey. Must match the JWT's wallet claim.","type":"string"}},"required":["wallet","lifecycleId","leverage"],"type":"object"},"SetPositionLeverageResponse":{"properties":{"lifecycleId":{"type":"string"},"selectedLeverage":{"description":"The tag now on the position, to two decimals.","type":"string"}},"required":["lifecycleId","selectedLeverage"],"type":"object"},"Side":{"description":"Position direction.","enum":["long","short"],"type":"string"},"StatsSummaryResponse":{"properties":{"activeTraders24h":{"format":"int64","type":"integer"},"asOf":{"format":"date-time","type":"string"},"feeRevenue24hUsd":{"type":"string"},"openInterestUsd":{"type":"string"},"venues":{"items":{"$ref":"#/components/schemas/VenueStats"},"type":"array"},"volume24hUsd":{"type":"string"},"volume7dUsd":{"type":"string"},"volumeAllUsd":{"type":"string"}},"required":["volume24hUsd","volume7dUsd","volumeAllUsd","openInterestUsd","activeTraders24h","feeRevenue24hUsd","venues","asOf"],"type":"object"},"StatusResponse":{"properties":{"db":{"description":"Database health: `healthy` or `down`.","type":"string"},"indexer":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ServiceHealth","description":"Health of the chain indexer that feeds positions and history."}]},"orderBot":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/ServiceHealth","description":"Health of the order execution service."}]}},"required":["db"],"type":"object"},"SubmissionOutcome":{"enum":["rejected","unknown","duplicate"],"type":"string"},"ThinReason":{"description":"What makes a side thin.","enum":["depth","price_gap","cannot_fill","no_book"],"type":"string"},"TpSlOrderResponse":{"description":"A close order (TP, SL, trailing, indicator or DCA close) attached to a position.","properties":{"closeBps":{"description":"Share of the position this close order closes, in basis points\n(10000 = 100%), applied to the live position size at execution. Absent\non older orders.","format":"int32","minimum":0,"type":["integer","null"]},"currentBestPriceUsd":{"type":["string","null"]},"currentIndicatorValue":{"format":"double","type":["number","null"]},"dcaEndLeverageScaled":{"format":"int64","type":["integer","null"]},"dcaEndPriceUsd":{"type":["string","null"]},"dcaIntervalSeconds":{"format":"int64","type":["integer","null"]},"dcaLastLegTimestamp":{"format":"int64","type":["integer","null"]},"dcaLegsExecuted":{"format":"int64","type":["integer","null"]},"dcaLeverageWeightingType":{"format":"int64","type":["integer","null"]},"dcaNumLegs":{"format":"int64","type":["integer","null"]},"dcaPriceLimitUsd":{"type":["string","null"]},"dcaStartAt":{"description":"Delayed start time for a DCA close, Unix seconds. Absent or 0 means no\ndelay.","format":"int64","type":["integer","null"]},"dcaStartLeverageScaled":{"format":"int64","type":["integer","null"]},"dcaStartPriceUsd":{"type":["string","null"]},"dcaWeightingType":{"format":"int64","type":["integer","null"]},"indicatorCondition":{"type":["string","null"]},"indicatorRatchetSize":{"type":["string","null"]},"indicatorThreshold":{"type":["string","null"]},"indicatorTimeframe":{"type":["string","null"]},"isActivated":{"type":["boolean","null"]},"isReverseFib":{"type":["boolean","null"]},"isStopArmed":{"type":["boolean","null"]},"orderPda":{"type":["string","null"]},"orderType":{"type":"string"},"profileIndex":{"format":"int32","type":["integer","null"]},"ratchetSizeUsd":{"type":["string","null"]},"sizeUsd":{"type":"string"},"source":{"type":"string"},"stopTriggerPriceUsd":{"type":["string","null"]},"triggerCondition":{"type":["string","null"]},"triggerHitAt":{"format":"int64","type":["integer","null"]},"triggerPriceUsd":{"type":"string"},"worstPriceUsd":{"type":["string","null"]}},"required":["source","orderType","triggerPriceUsd","sizeUsd"],"type":"object"},"TradesResponse":{"allOf":[{"$ref":"#/components/schemas/LifecyclesResponse"},{"properties":{"accountRead":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/AccountRead"}]}},"type":"object"}],"description":"`/trades` with the opt-in evidence. No `unavailablePositionDetails`: the\nclient rejects that field on a trades read."},"UnifiedFundingRatesResponse":{"properties":{"rows":{"items":{"$ref":"#/components/schemas/UnifiedFundingRow"},"type":"array"}},"required":["rows"],"type":"object"},"UnifiedFundingRow":{"properties":{"phoenix":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/VenueFundingRate"}]},"sunrise":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/VenueFundingRate","description":"Armada funding rate: the rate Imperial charges on Armada positions in\nthis market. Absent when no rate is in force."}]},"symbol":{"type":"string"}},"required":["symbol"],"type":"object"},"UserErrorDetails":{"description":"Structured, user-safe error details returned alongside error responses on\nHTTP, WebSocket, order history and notifications.","properties":{"action":{"type":["string","null"]},"capitalCheck":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/CapitalCheck","description":"Which capacity check refused an order that opens or increases a\nposition. These refusals share one capacity `code`; this field tells\nthem apart. Omitted on advisory refusals (quotes, preflight, resting\norders)."}]},"code":{"type":"string"},"message":{"type":"string"},"outcome":{"type":["string","null"]},"referenceId":{"type":["string","null"]},"retryAfterSecs":{"description":"Seconds to wait before retrying the same request, when the refusal is\ntemporary. Use this field rather than parsing `message`, which is\nhuman-readable and may be translated. Omitted when the wait is unknown\n(not the same as zero).","format":"int32","minimum":0,"type":["integer","null"]}},"required":["code","message"],"type":"object"},"Venue":{"description":"Trading venue identifier. `armada` is Imperial's perpetuals market.","enum":["jupiter","phoenix","armada"],"type":"string"},"VenueFundingRate":{"properties":{"longBorrowRatePerHourPercent":{"description":"Legacy: hourly borrow rate in percent, only used by retired venues.\nCurrently always null.","format":"double","type":["number","null"]},"longFundingRatePerHourPercent":{"description":"Hourly funding rate in percent (`0.04` = 0.04%). **Positive long rate\nmeans longs pay shorts**; negative means shorts pay longs. The short\nrate is the negation of the long rate. Null when unavailable.","format":"double","type":["number","null"]},"shortBorrowRatePerHourPercent":{"format":"double","type":["number","null"]},"shortFundingRatePerHourPercent":{"format":"double","type":["number","null"]},"source":{"$ref":"#/components/schemas/RateSource"}},"required":["source"],"type":"object"},"VenueLock":{"description":"Allowlist of venues a profile may open new positions on.","properties":{"reason":{"description":"Why the lock exists, e.g. `\"unified_margin\"`.","type":"string"},"venues":{"description":"The only venues this profile may open positions on while the lock\napplies. Closes, reductions and cancels always go to the position's own\nvenue.","items":{"type":"string"},"type":"array"}},"required":["venues","reason"],"type":"object"},"VenueMoveOverlay":{"description":"The display story of a moved position. See the module docs.","properties":{"carriedFeesRemainingUsd":{"description":"USD. The part of `carriedFeesUsd` no close has taken yet: a close of\n`x` of what is left shows `x` of this off its own result, as it shows\n`x` of `pnlOffsetUsd` on it. Shrinks with each close by the same share\nas `pnlOffsetUsd`, and is 0 once the position is closed.","type":"string"},"carriedFeesUsd":{"description":"USD. Fees and funding paid on the position before the move, its close\nincluded. Add to the displayed fees.","type":"string"},"carriedFundingUsd":{"description":"USD, signed. The part of `carriedFeesUsd` that is funding the old\nposition paid (positive) or received (negative): shown on the funding\nlines, with only the rest of `carriedFeesUsd` on the fee lines.\n`carriedFeesUsd` itself stays the whole figure the PnL takes off.","type":"string"},"entryOffsetUsd":{"description":"USD. `side × base × (the move's fill − the original entry)` for what\nis still open of the position the move opened: taken off the live\nentry per coin, it gives the original entry back (blended with any\nlater adds). Shrinks with each close by the same share as\n`pnlOffsetUsd`. Used for the entry shown and nothing else; equal to\n`pnlOffsetUsd` where the move's fill could not be read.","type":"string"},"entryPrice":{"description":"The original entry price, USD. The live displayed entry is derived from\nthe live entry and size with `entryOffsetUsd`; this is its fallback.","type":"string"},"openedAt":{"description":"Displayed open time, Unix seconds: when the owner first opened the\nposition.","format":"int64","type":"integer"},"pnlOffsetAtMoveUsd":{"description":"USD. `pnlOffsetUsd` as it was at the move, before later closes released\npart of it.","type":"string"},"pnlOffsetUsd":{"description":"USD. Carried PnL still inside the position: counted in the live\ncollateral, displayed as unrealized PnL. Add it to the live PnL and take\nit off the displayed collateral; never recompute it from `entryPrice`.\nIt is what the old position's close realized, so it is not `side ×\nbase × (live entry − original entry)`: the two venues' prices sat apart\nat the move. The entry shown is derived from `entryOffsetUsd` instead.","type":"string"}},"required":["openedAt","entryPrice","pnlOffsetUsd","entryOffsetUsd","pnlOffsetAtMoveUsd","carriedFeesUsd","carriedFeesRemainingUsd","carriedFundingUsd"],"type":"object"},"VenueStats":{"properties":{"openInterestUsd":{"type":"string"},"traderCount":{"format":"int64","type":"integer"},"venue":{"description":"Underwriter label, as stored on position rows. Historical rows may\ncarry retired venue labels.","type":"string"},"volumeUsd":{"type":"string"}},"required":["venue","volumeUsd","openInterestUsd","traderCount"],"type":"object"},"VolumeBucket":{"properties":{"flashUsd":{"type":"string"},"gmtradeUsd":{"type":"string"},"jupiterUsd":{"type":"string"},"phoenixUsd":{"type":"string"},"sunriseUsd":{"description":"Armada volume in the bucket.","type":"string"},"timestamp":{"format":"date-time","type":"string"},"totalUsd":{"type":"string"},"tradeCount":{"format":"int64","type":"integer"}},"required":["timestamp","totalUsd","jupiterUsd","flashUsd","phoenixUsd","gmtradeUsd","sunriseUsd","tradeCount"],"type":"object"},"VolumeRangeResponse":{"properties":{"builderFeesUsd":{"type":"string"},"endTs":{"format":"int64","type":"integer"},"liquidationVolumeUsd":{"type":"string"},"platformFeesUsd":{"type":"string"},"startTs":{"format":"int64","type":"integer"},"tradeCount":{"format":"int64","type":"integer"},"venue":{"type":["string","null"]},"volumeUsd":{"type":"string"}},"required":["startTs","endTs","volumeUsd","liquidationVolumeUsd","tradeCount","platformFeesUsd","builderFeesUsd"],"type":"object"},"VolumeResponse":{"properties":{"grouping":{"type":"string"},"period":{"type":"string"},"rows":{"items":{"$ref":"#/components/schemas/VolumeBucket"},"type":"array"}},"required":["period","grouping","rows"],"type":"object"},"i16":{"format":"int32","type":"integer"}},"securitySchemes":{"bearer_jwt":{"bearerFormat":"JWT","description":"JWT issued via `/mobile/connect` + `/mobile/exchange`. The wallet claim in the JWT must match the `wallet` field in each trading request body.","scheme":"bearer","type":"http"}}},"info":{"contact":{"name":"Imperial","url":"https://imperial.trade"},"description":"\nImperial is a perpetual futures exchange on Solana. Every order is priced off deep external\nliquidity and settles on Solana; collateral is USDC and stays in the Imperial program's vault\non Solana. This API is what bots and integrators use to authenticate, trade, and read market\nand account data.\n\nBase URL: `https://api.imperial.trade/api/v1`. Market data is public; trading needs a JWT.\n\n## Quickstart\n\n1. **Authenticate** — `POST /mobile/connect`, then `POST /mobile/exchange` for a JWT (see\n   \"Authentication\"). Send it as `Authorization: Bearer <jwt>` on every trading call.\n2. **Pick a market** — `GET /armada/markets` lists every tradable market with its leverage\n   and margin tiers. `GET /armada/quote` gives an expected fill for a size, and\n   `GET /armada/open-availability` says whether an open would be accepted right now.\n3. **Fund a profile** — `POST /deposit/build-tx` with `mode: \"deposit\"` returns a sponsored,\n   partially signed transaction that creates the profile (if new) and deposits USDC from the\n   wallet. Sign and submit it. `mode: \"withdraw\"` returns USDC to the wallet.\n   `GET /mobile/balances` shows each profile's USDC.\n4. **Open** — `POST /mobile/orders` with `underwriter: 7`, `action: 0`, `side`, `symbol`\n   (e.g. `\"BTC\"`), `sizeUsd`, `collateralAmount`, a live `marketPrice` and a non-zero\n   `slippageBps`. To attach a take profit or stop loss in the same request, use\n   `POST /mobile/orders/batch`. Always check `success` in the response body (see \"Responses\n   and errors\").\n5. **Track** — subscribe to `/ws` for your wallet with `positionState: true` for pushed\n   position rows, and to `/ws/market` for prices. `GET /positions` and `GET /orders` return\n   the same data on demand.\n6. **Close** — `POST /mobile/orders` with `action: 1` and `closeBps: 10000` for a full close\n   (`2500` for a quarter). Closes are never blocked by capacity limits or early-access gating.\n\n## Authentication\n\nTrading endpoints are JWT-gated. The flow:\n\n1. `POST /mobile/connect` — sign `imperial:mobile-connect:{wallet}:{nonce}` with your Solana\n   keypair and post `{wallet, message, signature}`. `{nonce}` must be a **current Unix\n   timestamp** — seconds or milliseconds (e.g. `Date.now()`), **not** a random value: digits\n   only, at most 13. It is rejected if it is more than 5 minutes old or more than 5 minutes in\n   the future, and each nonce may be used only once. Response: a one-time `code`.\n\n   Note: once the request is well formed, this endpoint returns an opaque `401\n   {\"error\":\"Failed to generate mobile session\"}` for *any* underlying cause — bad signature,\n   expired nonce, or replay — so an unexpected 401 with a valid signature almost always means\n   the nonce is not a fresh timestamp. A `400` means the request was refused before the\n   signature was checked: `Invalid wallet pubkey`, `Invalid message format` (the signed string\n   didn't match the `imperial:mobile-connect:{wallet}:{nonce}` prefix), `Invalid nonce: …` (not\n   a plain timestamp), `Nonce expired or in the future` (more than 10 minutes off), or `Nonce\n   already used`.\n2. `POST /mobile/exchange` — exchange the `code` for `{jwt, expires_at}`. The code expires in\n   5 minutes and can only be redeemed once.\n3. Send trading requests with `Authorization: Bearer <jwt>`. The JWT's wallet claim must match\n   the `wallet` field in every request body.\n4. `POST /mobile/revoke` — revoke the JWT when you're done (e.g. bot shutdown, key rotation).\n\nThe JWT is a Solana-signature-anchored delegation: anyone holding it can place orders from\nthe associated wallet's profiles. Treat it like an API key — copy\nit once, store it securely, and revoke it if compromised.\n\nMulti-wallet bots (e.g. fan-out traders): each wallet owner independently completes the flow\non their own dashboard and shares their JWT with the bot operator. The bot then holds N tokens\nand calls the API in parallel, one request per wallet. Any wallet owner can revoke their token\nanytime without affecting the others.\n\n## Orders\n\n`POST /mobile/orders` places one order. Fields that trip people up:\n\n- `underwriter` — always `7`. Older values appear only on historical orders and positions\n  from retired venues, and new orders with them are rejected.\n- `side`: `0` long, `1` short. `action`: `0` open or increase, `1` reduce or close.\n- `sizeUsd` and `collateralAmount` are 6-decimal USD (µUSDC). `collateralAmount` on an open is\n  the position's **full** margin; the server nets what the account already holds, so do not\n  subtract it yourself. A cross open deposits only what the cross account's free collateral\n  doesn't cover, and an isolated open draws the account's withdrawable balance\n  (`GET /armada/margin`) before the wallet.\n- `slippageBps` — required on opens, `1`–`10000`; `0` is refused. Closes are exempt, so a\n  must-close is never blocked.\n- `marketPrice` — the price you expect, in micro-USD (`price × 1e6`; SOL at $64.94 is\n  `64940000`). Your slippage band is measured against it, so send a live price: a stale\n  one gets the order refused rather than filled.\n- `triggerPrice` and every price inside `extraData` are oracle scale (`price × 1e9`).\n- `closeBps` sizes a close as a fraction of the live position (`10000` = all). Prefer it to\n  echoing the open's `sizeUsd`.\n- `quoteId` — optional id from `GET /armada/quote`; the order is then priced from that quote.\n\nMinimums: an open must be at least one lot of the market (refused as too small otherwise; the\nfloor is waived on closes). A limit order must be at least $15.\n\nOne order executes at a time per profile. A market order sent while the previous one is\nstill confirming waits up to 15 seconds for it, then is refused without being placed or\ncharged; retry after a few seconds.\n\n### Order types\n\n`orderType` takes a numeric code:\n\n| Code | Name             | Notes                                                   |\n|-----:|------------------|---------------------------------------------------------|\n|    0 | Market           | `triggerPrice` ignored. Immediate-or-cancel within your slippage band. |\n|    1 | Limit            | Requires `triggerPrice`. Fills at your price or better and stays open until cancelled. |\n|    2 | StopLimit        | Requires `triggerPrice`. The usual type for TP/SL legs. |\n|    3 | LandMine         | Requires `triggerPrice`, `extraData.waitPrice`, `waitDuration` |\n|    4 | Ratchet          | Requires `extraData.worstPrice`, `ratchetSize`          |\n|    6 | RatchetEntry     | Same extras as Ratchet                                  |\n|    9 | Dca              | Requires `extraData.dcaStartPrice`, `dcaEndPrice`, `dcaNumLegs` |\n|   10 | FibRatchet       | Same extras as Ratchet                                  |\n|   11 | FibRatchetEntry  | Same extras as Ratchet                                  |\n|   12 | DcaClose         | Requires `extraData.dcaCloseStartPrice`, `dcaCloseEndPrice`, `dcaCloseNumLegs` |\n|   13 | DcaTimeClose     | Requires `extraData.dcaCloseIntervalSeconds`, `dcaCloseNumLegs` |\n|   14 | DcaRatchetClose  | Requires `extraData.dcaCloseNumLegs`, `dcaCloseRatchetSize` |\n|   15 | DcaTime          | Requires `extraData.dcaIntervalSeconds`, `dcaNumLegs`   |\n|   16 | DcaRatchet       | Requires `extraData.dcaNumLegs`, `dcaRatchetSize`       |\n\nCode `5` is retired and rejected.\n\n### Take profit and stop loss\n\nSend the entry and its exits together with `POST /mobile/orders/batch`: an `entry` plus\n`closeOrders`, each exit with `action: 1` (normally `orderType: 2`). An exit may name its role\nin `extraData.closeRole` (`\"tp\"` or `\"sl\"`); the trigger must then point the right way or the\nleg is refused. Exits stay on the same margin account as the entry. Triggers fire on the mark\nprice and close at market within the order's slippage band. A stop must sit before the\nposition's liquidation price.\n\nSuccessful resting orders return `orderPda`, which you can pass straight to\n`/mobile/orders/cancel` or `/mobile/orders/update`.\n\n### Reversing a position\n\n`POST /mobile/positions/reverse` flips an open position to the other side in one call: it\ncloses the position in full, then opens the same base on the other side. Send the position's\n`side`, `sunriseSeat` and its `openedAtSlot` as `positionEpoch`, with a live `marketPrice` and\na `slippageBps` that applies to both legs. A position that changed in the meantime, including\none a first press already reversed, is refused.\n\nBefore the close it cancels your open entry orders on the old side of that market, and their\nexits (listed in `cancelledOrderPdas`). The response is HTTP 200 with an `outcome`:\n\n- `reversed` — both legs settled; `newSide`, `newSizeUsd` and `newCollateralUsd` describe the\n  new position.\n- `not_placed` — refused before anything closed. Safe to retry.\n- `closed_only` — the close settled but the open was refused, so the account is flat. Never\n  retry automatically. `ordersLeftLive` lists your entry orders on the new side: they stay\n  live, so one that fills opens a position.\n- `unknown` — a leg's result is not known yet. Check `/positions` before doing anything else.\n\nThe reverse keeps the size. When the close leaves less margin than the old position had,\nleverage rises, never past what the account allows; the open is checked against those limits\nbefore anything closes. Where a thin market adds a close cost to the new position's\nliquidation line, the open posts enough margin to clear it, so its leverage can come out\nlower than before; if the account cannot cover that, the reverse is refused before anything\ncloses.\n\nYour entry orders on the profile that trigger mid-reverse wait for it, then fire against the\nnew position. On isolated, the new position can land on either isolated account, so take its\n`sunriseSeat` from `/positions` before closing or reversing it.\n\n`POST /mobile/positions/reverse/preflight` takes the same body and changes nothing. It shows\nthe reverse as it is expected to land at `marketPrice`, with the close's profit or loss and\nboth legs' fees counted: `reversible`, `newSizeUsd`, `newCollateralUsd`, `leverageBefore` and\n`leverageAfter` (e.g. `10.0` and `19.0`), `estimatedFeesUsd`, `ordersToCancel` and the\nrefusal, if any. Do not reverse with an opposite-side order instead: on an isolated account\nthat opens a second position beside the first.\n\n## Profiles and margin accounts\n\nEvery wallet has six implicit subaccounts indexed `0..5`. Balances and positions don't mix\nacross them. There is no \"create subaccount\" call — the on-chain profile PDA is created\nlazily on the first `/deposit/build-tx` or first `/mobile/orders`\nplacement that targets that `profileIndex`. `/mobile/balances` will return `usdc: 0` for\nevery uninitialized profile without erroring; that's a normal \"this index has never been\nused\" response, not a provisioning gate.\n\n`profileIndex` is required on every order, deposit, and balance call. Pick a convention\n(e.g. profile 0 for default, 1+ for strategy buckets) and stick with it — there's no\nserver-side notion of a \"primary\" profile.\n\nEach profile trades **cross** or **isolated**, never both at once:\n\n- The profile's margin mode decides where a new position opens: `unified` means cross. An\n  order may name its account with `extraData.sunriseSeat`, but only one of the profile's mode:\n  `0` (cross) on a unified profile, `1` (isolated) on an isolated one. With `1` the server\n  picks between the profile's two isolated accounts; `2` names the second one. A seat of the\n  other kind is a `400` with `errorCode` `MarginModeSeatMismatch`. Closes and reductions are\n  never refused this way.\n- `GET /passthrough/users/{wallet}/profiles` returns each profile's mode.\n  `PUT /passthrough/users/{wallet}/profiles/{index}/margin-mode` changes it, but only on a\n  **closed** profile: no open position, no live entry order, and no Armada open or close still\n  being filled. Take-profits and stop-losses don't count. The refusals:\n  - `409` `MarginModeSwitchNeedsClosedAccount` when anything is still open; the message names\n    what.\n  - `409` `MarginModeChanged` when the mode moved meanwhile.\n  - `503` when the switch can't be confirmed just then. The message says which case it is:\n    nothing changed, so retry; or the outcome is unknown, so read the mode again before\n    retrying.\n\n  Setting the mode a profile already has changes nothing and answers at once: `409`\n  `MarginModeChanged` if the mode moved meanwhile.\n\n  Deleting a cross profile's name, and naming a new profile straight into cross with\n  `marginModeOnCreate`, follow the same rule. An Armada order placed while a profile switches\n  waits for the switch, then runs under the mode it left.\n- Closes should carry the seat of the position they close. A position opened before these\n  rules can still sit on the other kind of account, so read its account from the position\n  (`directVenue.marginMode`), never from the profile's current mode.\n- Cross margin is checked across the whole account, with portfolio-margin credit for real\n  hedges; isolated positions each stand on their own collateral.\n- `GET /armada/margin` returns what an account holds and what is withdrawable now.\n  `GET /armada/liquidation-preview` projects the liquidation price an order would leave.\n- Each market's leverage and maintenance step down as position size grows; the tiers are in\n  `marginTiers` on `GET /armada/markets`. A tier change applies to new opens only.\n\n## Market halts\n\n`GET /armada/halt?asset=BTC` says whether a market is halted, since when, and whether the halt\nwas announced in advance. When a market is halted and not tradable, market orders are refused;\nretry once the halt ends. Closing is never blocked by Imperial-side limits, but nothing can fill\nwhile the market itself cannot trade.\n\n## Builder codes\n\nApps and bots (\"builders\") can charge their users a fee on top of Imperial's own by attaching a\nbuilder code to orders. The fee is a fixed rate of each fill's **notional**, set per code in\nsteps of 0.01 bps, at most 10 bps (for example 0.3 bps is $30 per $1M traded).\n\n1. Pass `builderCode` on `POST /mobile/orders` (or on every leg of `POST /mobile/orders/batch`\n   — all legs must carry the same code, or none). The rate is charged on **both** open and\n   close. Codes are case-insensitive; unknown or deactivated codes are rejected with `400`.\n2. Preview the fee: `GET /trade-preview?walletAddress=...&marketMint=...&collateralUsd=...&leverage=...&underwriter=7&marketPrice=...&builderCode=<CODE>`\n   adds `builderFeeUsd` and `builderFeeBps` to each side's estimate, folded into\n   `totalFeesUsd`.\n3. `GET /mobile/builder/summary?code=<CODE>` returns the code's rate (`feeBps`, and\n   `feeRate1e6` in millionths of notional), accrued, paid and claimable fees, and recent\n   payouts. The code itself is the credential; no JWT needed.\n\n- **Charged at the fill, on filled notional**, after Imperial's fee. If the account can't cover\n  it, the builder receives what is left rather than the trade failing.\n- **Max leverage is slightly lower**, because the fee counts against the leverage ceiling.\n- **Resting orders keep the code** and are charged when they execute. Liquidations never carry\n  a builder fee.\n- Accrued fees show in the summary once the fill is indexed, normally within seconds, and are\n  paid out periodically to the builder's payout wallet. Disclose the fee to your users.\n\n## Imperial points\n\n`GET /mobile/points` (JWT required) returns the wallet's points for the active season. Points\nare credited in weekly batches, so the figure changes weekly rather than per trade.\n\n## Rate limits\n\nUnified limit: **600 requests/minute sustained, burst of 120**. Keyed per-wallet when a valid\nJWT is present, else per-IP. Exceeding the budget returns `429 Too Many Requests` with a\n`Retry-After` header and `{ \"error\": \"rate_limited\", \"retry_after_seconds\": N }` body. The\n`/health`, `/ws`, and Telegram webhook endpoints are not rate limited.\n\n## WebSockets\n\nTwo endpoints. Both are unauthenticated and exempt from the rate limiter.\n\n### `GET /ws` — wallet-scoped position/order stream\n\nSubscribe by wallet — single `wallet`, or a `wallets` array to multiplex a fleet over ONE\nsocket. By default you get coalesced invalidation triggers only. Add `\"positionState\": true`\nto also have the full position rows pushed (so you never poll `/positions`), and\n`\"tradeEvents\": true` for typed settled close events (so you never poll `/trades` at close).\n\n```json\n{ \"type\": \"subscribe\", \"wallet\": \"<base58-pubkey>\", \"positionState\": true }\n{ \"type\": \"subscribe\", \"wallets\": [\"<pk1>\", \"<pk2>\"], \"tradeEvents\": true }\n```\n\nEvery `subscribe` REPLACES the connection's whole subscription set (the single-`wallet` form\nis a set of one — identical to the historical behavior), so a fleet client just resends its\nfull roster when wallets change; `\"wallets\": []` clears and there is no separate unsubscribe\nmessage. Caps: 200 wallets per connection; `positionState` is honored up to 25 subscribed\nwallets (each open wallet costs a periodic `/positions` computation; the per-second re-marks\nbetween are served from a local price cache) — beyond that the\nserver sends `{ \"type\": \"error\", \"code\": \"position_state_wallet_limit\", \"limit\": 25 }` once\nand disables it for the connection (triggers and `tradeEvents` still flow). Every\nwallet-scoped frame carries a top-level `wallet` field for demuxing.\n\n- `{ \"type\": \"position_state\", \"seq\": N, \"positions\": [ ... ] }` — **opt-in** (`positionState:\n  true`). The full `/positions` response rows (identical shape: `markPrice`, `pnlUsd`,\n  `pnlPercent`, `collateralUsd`, `ourLiquidationPriceUsd`, `sizeUsd`, `entryPrice`, `side`,\n  `status`, and any attached `stopLossPrice`/`takeProfitPrice`). `seq` is a per-connection\n  monotonic counter for ordering / gap detection across a reconnect. Cadence:\n  - one frame immediately on `subscribe` (snapshot) — this doubles as the subscribe ack;\n    there is no separate `subscribed` frame. The snapshot may be `positions: []` if the\n    wallet is currently flat — that's a valid frame, not an error.\n  - a frame on every position change (open / close / SL-TP fire / liquidation);\n  - while a position is open, a re-marked frame ~1×/s so live PnL / mark / liq track without\n    polling. **While the wallet is flat, no periodic frames are sent** (the socket goes quiet\n    until the next change), so an empty frame followed by silence means \"no open position\".\n- `{ \"type\": \"positions_updated\", \"wallet\": \"<pk>\" }` — the coalesced invalidation trigger,\n  always sent (also alongside `position_state` when opted in). Clients consuming\n  `position_state` can ignore it.\n- `{ \"type\": \"orders_updated\", \"wallet\": \"<pk>\" }` — fired on order creation, execution, and\n  cancellation, when a resting Armada limit first fills, and when a triggered order's fill\n  fails. Refetch `/orders`.\n- `{ \"type\": \"order_rejected\", \"wallet\": \"<pk>\", \"actionId\": \"<uuid>\", \"reasonCode\":\n  \"<code>\" }` — a specific order was rejected on-chain.\n- `{ \"type\": \"close_fill_failed\" | \"order_fill_failed\", \"wallet\": \"<pk>\", \"orderPda\": \"<pk>\",\n  \"reasonCode\": \"<code>\", \"error\": \"<text>\", \"errorDetails\": { ...UserErrorDetails } }` — a\n  triggered order was consumed on-chain but the venue filled none of it. `close_fill_failed`\n  is a close (take-profit, stop-loss, limit close): the position is still open and that order\n  no longer protects it. `order_fill_failed` is an open or an add to an open position: the\n  order did not fill and its collateral went back to the trading profile; a position it was\n  adding to is unchanged. Always follows an `orders_updated` for the same\n  order, and is sent once per order on a connection: a repeated notice sends only the\n  `orders_updated`. `reasonCode` is one of `venue_capacity`, `venue_limits`, `slippage_exceeded`,\n  `insufficient_collateral`, `venue_rejected`; new codes may appear.\n- `{ \"type\": \"position_closed\" | \"position_liquidated\", \"wallet\": \"<pk>\", \"lifecycleId\":\n  \"<uuid>\", \"closedAt\": <unix-seconds>, \"trade\": { ...LifecycleResponse } }` — **opt-in**\n  (`tradeEvents: true`). Fired once per closed lifecycle, only after the close has fully\n  SETTLED (every closing leg's sweep finalized), carrying the same row `/trades` would\n  return — `netCashPnlUsd`, `totalFeesUsd`, `fees`, per-action `userReceived`, `closedAt` —\n  so no close-time `/trades` re-poll is needed. Note the ordering: the instant the close\n  lands you get `positions_updated` (and a `position_state` frame in which the position is\n  gone); the typed event follows seconds later when settlement completes. Dedupe by\n  `lifecycleId` — delivery is at-least-once across reconnects.\n\nPing/pong keepalive: send `{ \"type\": \"ping\" }`, receive `{ \"type\": \"pong\" }`. On reconnect,\nre-`subscribe`; the snapshot `position_state` re-syncs current state (there is no server-side\nreplay buffer for missed intermediate frames).\n\n### `GET /ws/market` — public market-data stream\n\nOn every successful `subscribe_*` the server immediately pushes the current snapshot, then\npushes changes. Each push carries the full payload.\n\n```json\n{ \"type\": \"subscribe_armada_tickers\" }                     // every listed market\n{ \"type\": \"subscribe_armada_tickers\", \"symbols\": [\"SOL\"] } // filtered; replaces the set\n{ \"type\": \"subscribe_mark_prices\" }\n{ \"type\": \"subscribe_funding_rates\" }\n{ \"type\": \"unsubscribe_armada_tickers\" }\n{ \"type\": \"unsubscribe_mark_prices\" }\n{ \"type\": \"unsubscribe_funding_rates\" }\n{ \"type\": \"ping\" }\n```\n\n- `{ \"type\": \"armada_tickers\", \"tickers\": [{ \"symbol\": \"SOL\", \"mark_price\": <f64>,\n  \"daily_price_change_pct\": <f64|null>, \"observed_at_unix_ms\": <i64> }], \"removed\": [\"ETH\"] }`\n  — `symbol` as `/armada/markets` lists it. At most one event per second, carrying only the\n  markets whose mark or 24h change moved; the subscribe snapshot carries every market.\n  `removed` names markets that are no longer live.\n- `{ \"type\": \"mark_price_update\", \"symbol\": \"SOL\", \"venue\": \"index\", \"source\": \"pyth_lazer\",\n  \"price\": <f64>, \"fetchedAtUnixMs\": <i64> }` — use the `venue: \"index\"` entries: they are the\n  price Imperial marks positions with (PnL, liquidation, triggers). Other `venue` values are\n  legacy.\n- `{ \"type\": \"funding_rate_update\", ... }` — same shape as a per-venue entry on\n  `GET /funding-rates`. `longFundingRatePerHourPercent > 0` means longs pay shorts.\n\n## Responses and errors\n\n`POST /mobile/orders[/batch|/cancel|/collateral|/update]` returns HTTP 200 once the request was\nwell formed and reached order execution, **even if the order was rejected**. Read the body:\n\n- `success: true` — accepted; `signature` is the Solana transaction signature.\n- `success: false` — rejected. `error` is a message safe to show users, and `errorCode` is a\n  stable code to branch on. Codes include `ArmadaCapacity` (no capacity for this open right\n  now), `ArmadaSeatAtLeverageLimit`, `ArmadaSizeAboveMarketTable` (size above the market's\n  largest tier), `ArmadaOrderWouldLiquidate`, `InsufficientBalance`, `TradingPaused`,\n  `PositionAlreadyClosed`, and `UnknownTradeFailure` / `InternalError` when nothing more\n  specific applies.\n\nIf a response says the order **may still have gone through**, its confirmation was delayed:\ncheck `/positions` and `/orders` before retrying. Imperial never sends a duplicate.\n\nHTTP 4xx is reserved for malformed input or auth failures (missing/invalid JWT, mismatched\nwallet claim). HTTP 5xx is reserved for the server itself failing (database or order-bot\ntransport failures that aren't fully recoverable).\n","license":{"name":""},"title":"Imperial Trading API","version":"0.1.0"},"openapi":"3.1.0","paths":{"/api/v1/armada/fills":{"get":{"description":"Read from on-chain order records.\n\n- `medianBps` / `adverseBps`: fill price versus the price each order\n  stated, in bps. Positive is better for the trader. The reference is the\n  market price the client submitted with the order.\n- The counts and `rejects`: of the orders submitted on chain, how many\n  filled, and the reason each of the rest was rejected.","operationId":"get_armada_fills","parameters":[{"description":"Trailing window in hours. Clamped to `1..=8760`.","in":"query","name":"windowHours","required":false,"schema":{"format":"int32","type":["integer","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArmadaFillsResponse"}}},"description":"Per-market fill quality and settlement"}},"summary":"Armada fill quality and fill rates per market, over a trailing window.","tags":["armada"]}},"/api/v1/armada/halt":{"get":{"description":"A brief interruption is not reported as a halt; a halt is reported once it\nhas lasted about 20 seconds.","operationId":"get_armada_halt","parameters":[{"description":"Market symbol, e.g. `BTC`.","in":"query","name":"asset","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HaltStatus"}}},"description":"Halt state"},"400":{"description":"The market is not listed"},"503":{"description":"Armada is not enabled"}},"summary":"Whether an Armada market is halted, and whether the halt is planned.","tags":["armada"]}},"/api/v1/armada/lien/clear-tx":{"get":{"operationId":"get_armada_lien_clear_tx","parameters":[{"description":"Owner wallet address (base58).","in":"query","name":"wallet","required":true,"schema":{"type":"string"}},{"description":"Profile index; defaults to 0.","in":"query","name":"profileIndex","required":false,"schema":{"format":"int32","minimum":0,"type":"integer"}},{"description":"The isolated margin account to read: the asset symbol for the first\nisolated account (`ZEC`), or the symbol plus `#2` for the second\n(`ZEC#2`). Omit to read the cross-margin account.","in":"query","name":"asset","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArmadaLienClearTx"}}},"description":"Unsigned transaction clearing the account's loss lien"},"400":{"description":"Coded refusal: `ArmadaNoLien`, `ArmadaLienNotStale` (not yet old enough to clear), `ArmadaLienSeatLocked` (the account is being liquidated or is restricted); or an invalid wallet or asset"},"401":{"description":"Missing, invalid, or revoked JWT, or JWT wallet doesn't match `wallet`"}},"security":[{"bearer_jwt":[]}],"summary":"An unsigned transaction that clears the caller's own loss lien once it is\nold enough (see `lienClearableAt` on `/armada/margin`), for the wallet to\nsign and send.","tags":["armada"]}},"/api/v1/armada/liquidation-preview":{"get":{"operationId":"get_armada_liquidation_preview","parameters":[{"description":"Owner wallet address (base58).","in":"query","name":"wallet","required":true,"schema":{"type":"string"}},{"description":"Profile index; defaults to 0.","in":"query","name":"profileIndex","required":false,"schema":{"format":"int32","minimum":0,"type":"integer"}},{"description":"Market symbol, e.g. `BTC`.","in":"query","name":"asset","required":true,"schema":{"type":"string"}},{"in":"query","name":"side","required":true,"schema":{"$ref":"#/components/schemas/Side"}},{"description":"The entry's notional, USD.","in":"query","name":"sizeUsd","required":true,"schema":{"format":"double","type":"number"}},{"description":"Collateral this order deposits, USDC. Zero adds on existing margin.","in":"query","name":"collateralUsd","required":false,"schema":{"format":"double","type":"number"}},{"description":"A resting limit's price. Omitted, the entry fills at the live mark.","in":"query","name":"limitPrice","required":false,"schema":{"format":"double","type":["number","null"]}},{"description":"0 = cross, 1 or 2 = isolated. Omitted, the profile's margin mode.","in":"query","name":"seat","required":false,"schema":{"format":"int32","minimum":0,"type":["integer","null"]}},{"description":"Builder code whose fee applies to this order, if any.","in":"query","name":"builderCode","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArmadaLiquidationPreview"}}},"description":"Projected liquidation price after this entry fills"},"400":{"description":"Invalid size, collateral, price, seat or builder code"},"503":{"description":"Armada is not enabled"}},"summary":"Estimated liquidation price after this order fills, including a\ncross-margin account's other positions. Advisory; nothing is reserved.","tags":["armada"]}},"/api/v1/armada/liquidity":{"get":{"description":"A side is `thin` when closing `referenceUsd` costs `thinBps` or more, and\n`very_thin` at `veryThinBps` or when the book cannot take it at all. Costs\nare smoothed over 30 s; a status rises at once and falls only after two\nminutes below it. Refreshed every couple of seconds.","operationId":"get_armada_liquidity","parameters":[{"description":"One market's symbol. Omitted, every market.","in":"query","name":"asset","required":false,"schema":{"type":["string","null"]}},{"description":"Only markets with a `thin` or `very_thin` side.","in":"query","name":"flagged","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArmadaLiquidityResponse"}}},"description":""}},"summary":"Every Armada market's book depth as a liquidation sees it: the cost of\nclosing a position on each side against the mark, and whether that makes\nthe side thin.","tags":["armada"]}},"/api/v1/armada/liquidity/check":{"get":{"operationId":"get_armada_liquidity_check","parameters":[{"in":"query","name":"asset","required":true,"schema":{"type":"string"}},{"in":"query","name":"side","required":true,"schema":{"$ref":"#/components/schemas/Side"}},{"description":"The position's notional, USD.","in":"query","name":"sizeUsd","required":true,"schema":{"format":"double","type":"number"}},{"description":"The position's leverage. Omitted, the market's isolated maximum.","in":"query","name":"leverage","required":false,"schema":{"format":"double","type":["number","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArmadaLiquidityCheck"}}},"description":""},"400":{"description":"Invalid asset, size or leverage"},"404":{"description":"Armada does not list this market"},"503":{"description":"Armada is not enabled"}},"summary":"Whether one ticket's market is thin enough at its size and leverage that\nthe position could be liquidated early: what closing it would cost, how\nmuch of the room between entry and liquidation that takes, and the\nleverage that keeps it under half. Advisory, and an isolated seat's\narithmetic; nothing is reserved.","tags":["armada"]}},"/api/v1/armada/margin":{"get":{"operationId":"get_armada_margin","parameters":[{"description":"Owner wallet address (base58).","in":"query","name":"wallet","required":true,"schema":{"type":"string"}},{"description":"Profile index; defaults to 0.","in":"query","name":"profileIndex","required":false,"schema":{"format":"int32","minimum":0,"type":"integer"}},{"description":"The isolated margin account to read: the asset symbol for the first\nisolated account (`ZEC`), or the symbol plus `#2` for the second\n(`ZEC#2`). Omit to read the cross-margin account.","in":"query","name":"asset","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArmadaMarginResponse"}}},"description":"Account balance; every money field null when unreadable"},"400":{"description":"Invalid wallet or unknown asset"}},"summary":"One Armada margin account's balance, and what of it is withdrawable now.","tags":["armada"]}},"/api/v1/armada/markets":{"get":{"description":"The list is refreshed automatically, so markets can be added or removed\nwithout notice. A reduce-only market stays listed, marked `reduceOnly`,\nso open positions can still be shown and closed. May be briefly empty\nright after a server restart.","operationId":"get_armada_markets","responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ArmadaMarket"},"type":"array"}}},"description":"Listed markets"},"503":{"description":"Armada leverage limits are unavailable"}},"summary":"Every Armada market currently listed.","tags":["armada"]}},"/api/v1/armada/open-availability":{"get":{"operationId":"get_armada_open_availability","parameters":[{"description":"Market symbol, e.g. `BTC`.","in":"query","name":"asset","required":true,"schema":{"type":"string"}},{"in":"query","name":"side","required":true,"schema":{"$ref":"#/components/schemas/Side"}},{"description":"Order size, USD notional. Must be positive.","in":"query","name":"notionalUsd","required":true,"schema":{"format":"double","type":"number"}},{"description":"Collateral divided by notional (1 / leverage), e.g. `0.1` for 10x.\nWhen supplied, the check also covers this leverage; when omitted, that\npart is checked at execution.","in":"query","name":"openingMargin","required":false,"schema":{"format":"double","type":["number","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArmadaOpenAvailability"}}},"description":"Advisory availability for this side and size; execution checks account collateral and reserves before opening"},"400":{"description":"Invalid notional or asset"},"503":{"description":"Armada is not enabled"}},"summary":"Advisory admission for a new trade; placement rechecks before execution.","tags":["armada"]}},"/api/v1/armada/oracle-status":{"get":{"operationId":"get_oracle_status","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OracleStatusResponse"}}},"description":"Informational reference pricing status; unknown when unavailable"}},"tags":["armada"]}},"/api/v1/armada/orderbook":{"get":{"description":"The book is still returned for halted and reduce-only markets.\n`bookAgeMs` is the time since the book last changed, which grows in a quiet\nmarket; use `venueReachable` to tell whether the feed is live.","operationId":"get_armada_orderbook","parameters":[{"description":"Market symbol, e.g. `BTC`. An unlisted market is refused rather than\nreturned empty.","in":"query","name":"asset","required":true,"schema":{"type":"string"}},{"description":"Execution route: `0` (default) = automatic, `1` = the current route.\nOther values are rejected. Most clients should send `0`.","in":"query","name":"requestedHedgeVenue","required":false,"schema":{"format":"int32","minimum":0,"type":"integer"}},{"description":"Levels per side. Clamped to `1..=50`; defaults to 15.","in":"query","name":"depth","required":false,"schema":{"minimum":0,"type":["integer","null"]}},{"description":"Optional price bin width in USDC. Grouped before limiting depth.","in":"query","name":"priceStep","required":false,"schema":{"format":"double","type":["number","null"]}},{"description":"Also return the ungrouped levels, as `raw`.","in":"query","name":"includeRaw","required":false,"schema":{"type":"boolean"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArmadaOrderbook"}}},"description":"Aggregated levels with cumulative totals, the spread, and the market's mark, index and funding"},"400":{"description":"Refused, with a reason code"},"503":{"description":"Armada is not enabled"}},"summary":"Live order book depth Imperial prices this market from, with spread, mark,\nindex and funding, and the market's halt status.","tags":["armada"]}},"/api/v1/armada/quote":{"get":{"description":"The quoted price is the mark plus book slippage at this size, plus Armada's\nflat per-leg fee. The fee is fixed; the price varies with available\nliquidity at the requested size.\n\nThe returned `quoteId` may be sent with a `/mobile/orders` create to\nattach the quoted price to the order. It is optional: orders carry their\nown size, side, slippage and market price.","operationId":"get_armada_quote","parameters":[{"description":"Market symbol, e.g. `BTC`. An unlisted market is refused.","in":"query","name":"asset","required":true,"schema":{"type":"string"}},{"in":"query","name":"side","required":true,"schema":{"$ref":"#/components/schemas/Side"}},{"description":"`open` (default) or `close`. A close is priced against the opposite\nside of the book from an open.","in":"query","name":"leg","required":false,"schema":{"type":["string","null"]}},{"description":"Order size, USD notional. Must be positive.","in":"query","name":"notionalUsd","required":true,"schema":{"format":"double","type":"number"}},{"description":"Execution route: `0` (default) = automatic, `1` = the current route.\nOther values are rejected. Most clients should send `0`.","in":"query","name":"requestedHedgeVenue","required":false,"schema":{"format":"int32","minimum":0,"type":"integer"}},{"description":"Trader wallet address (base58).","in":"query","name":"wallet","required":true,"schema":{"type":"string"}},{"description":"Profile index; defaults to 0.","in":"query","name":"profileIndex","required":false,"schema":{"format":"int32","type":"integer"}},{"in":"query","name":"orderType","required":false,"schema":{"format":"int32","type":"integer"}},{"in":"query","name":"marketMint","required":false,"schema":{"type":["string","null"]}},{"description":"Id of the position being closed. Required when `leg=close`.","in":"query","name":"lifecycleId","required":false,"schema":{"format":"uuid","type":["string","null"]}},{"description":"All-in cost, bps of notional, of the best alternative price the caller\nalready has. When supplied, a quote that would cost more is declined\nwith `cheaper_elsewhere`.","in":"query","name":"bestAlternativeBps","required":false,"schema":{"format":"double","type":["number","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServedQuote"}}},"description":"Served quote"},"400":{"description":"Refused, with a reason code"},"503":{"description":"Armada is not enabled"}},"summary":"A server-priced Armada quote for one order.","tags":["armada"]}},"/api/v1/armada/risk-acceptances":{"get":{"operationId":"get_armada_risk_acceptances","parameters":[{"description":"Which warning: `thin_book`.","in":"query","name":"kind","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RiskAcceptancesResponse"}}},"description":""},"400":{"description":"Missing or unknown kind"},"401":{"description":"No valid wallet session"}},"security":[{"bearer_jwt":[]}],"summary":"What the session's wallet has accepted of one risk warning. The app\nshows the prompt for a market unless `all.version` or that market's\nversion is at least the warning's current version.","tags":["armada"]},"post":{"description":"A body that doesn't fit the request's shape (an unknown or missing field,\na `scope` or `device` outside its values, a negative or fractional\n`version`) is refused with 422 by the JSON extractor, before the session\nis checked. A body that fits but carries bad values gets 400.","operationId":"post_armada_risk_acceptance","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RiskAcceptanceRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RiskAcceptance"}}},"description":"Already the latest record for this scope; that record"},"201":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RiskAcceptance"}}},"description":"Recorded"},"400":{"description":"Malformed JSON, an unknown kind, an invalid version, text, locale or market, a textHash that does not match text, a market Armada does not list, a market with scope all, a market whose book is not thin (errorCode MarketNotThin), a wallet that has accepted the maximum number of different texts of this warning in the last 30 days (errorCode TooManyRiskTexts), or a scope that already holds the maximum number of records (errorCode TooManyRiskAcceptances)"},"401":{"description":"No valid wallet session, or a session minted by a trading delegate rather than the wallet itself"},"422":{"description":"The body doesn't fit the request's shape: an unknown or missing field, an unknown scope or device, or a negative or fractional version"},"503":{"description":"Market liquidity is loading, stale or unreadable, so a per-market record cannot be checked; retry"}},"security":[{"bearer_jwt":[]}],"summary":"Records that the session's wallet accepted a risk warning. Answers 201\nwith the new record, or 200 with the existing one when that scope's latest\nrecord already has the same version, text and locale.","tags":["armada"]}},"/api/v1/armada/status":{"get":{"operationId":"get_armada_status","parameters":[{"description":"Trailing window in hours. Clamped to `1..=8760`.","in":"query","name":"windowHours","required":false,"schema":{"format":"int32","type":["integer","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArmadaStatusResponse"}}},"description":"Market phases, quote statistics and fill statistics"}},"tags":["armada"]}},"/api/v1/close-slippage":{"get":{"operationId":"get_close_slippage","parameters":[{"description":"Raise the sample floor (clamped up to the server minimum)","in":"query","name":"minSamples","required":false,"schema":{"format":"int64","type":"integer"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloseSlippageResponse"}}},"description":"Per-market realized close-fill dispersion"}},"tags":["orders"]}},"/api/v1/deposit-history":{"get":{"operationId":"get_deposit_history","parameters":[{"description":"Base58 Solana wallet pubkey.","in":"query","name":"walletAddress","required":true,"schema":{"type":"string"}},{"description":"Page size, capped at 200 server-side. Default 50.","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Pagination offset.","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Token mint filter.","in":"query","name":"market","required":false,"schema":{"type":["string","null"]}},{"description":"`deposit`, `external_deposit`, `withdrawal`, or `transfer` (both\nlegs).","in":"query","name":"eventType","required":false,"schema":{"type":["string","null"]}},{"description":"Restrict to one profile (0-5).","in":"query","name":"profileIndex","required":false,"schema":{"format":"int32","type":["integer","null"]}},{"description":"Unix-seconds lower bound on event time.","in":"query","name":"from","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Unix-seconds upper bound on event time.","in":"query","name":"to","required":false,"schema":{"format":"int64","type":["integer","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DepositHistoryResponse"}}},"description":"Deposits, withdrawals, and own-profile transfers for the wallet, newest first, paginated, with in/out aggregates computed under the same filter."},"400":{"description":"Invalid wallet address or filter value"}},"tags":["reads"]}},"/api/v1/deposit/build-tx":{"post":{"operationId":"deposit_build_tx","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuildDepositTxRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuildDepositTxResponse"}}},"description":"A partially-signed sponsored transaction. For `mode: \"deposit\"`, it creates the user-account PDA (if needed) and the profile's USDC ATA, then transfers USDC from the wallet's USDC ATA into the profile. For `mode: \"withdraw\"`, it creates the wallet's USDC ATA (if needed) and withdraws USDC from the profile back to the wallet. Imperial pays the fee, rent and ATA creation and has signed as sponsor (unless `deferOperatorSignature` is set); the caller must sign with the wallet keypair before submission."},"400":{"description":"Coded refusal: `SponsorshipPaused` when sponsored deposits are paused, `SponsorshipLimit` when this wallet has used its sponsored transactions for now (a build with `deferOperatorSignature` draws on the allowance only at `/deposit/cosign-tx`), `WithdrawalBlockedByLoan` while a loan-backed position is open"},"500":{"description":"The transaction could not be built"}},"tags":["trading"]}},"/api/v1/funding-history":{"get":{"operationId":"get_funding_history","parameters":[{"description":"Base58 Solana wallet pubkey.","in":"query","name":"walletAddress","required":true,"schema":{"type":"string"}},{"description":"Restrict to one Imperial profile (0-5); omitted means all profiles.","in":"query","name":"profileIndex","required":false,"schema":{"format":"int32","type":["integer","null"]}},{"description":"Page size, capped at 200 server-side. Default 50.","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Pagination offset.","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Market mint filter.","in":"query","name":"market","required":false,"schema":{"type":["string","null"]}},{"description":"Underwriter filter. Pass the `underwriter` value returned on event rows.","in":"query","name":"underwriter","required":false,"schema":{"type":["string","null"]}},{"description":"`long` or `short`.","in":"query","name":"side","required":false,"schema":{"type":["string","null"]}},{"description":"`paid` (trader paid) or `received` (trader received).","in":"query","name":"direction","required":false,"schema":{"type":["string","null"]}},{"description":"Unix-seconds lower bound on event time.","in":"query","name":"from","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Unix-seconds upper bound on event time.","in":"query","name":"to","required":false,"schema":{"format":"int64","type":["integer","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FundingHistoryResponse"}}},"description":"Funding/borrow settlement events for the wallet, newest first, paginated, with paid/received aggregates computed under the same filter."},"400":{"description":"Invalid wallet address or filter value"}},"tags":["reads"]}},"/api/v1/funding-rates":{"get":{"operationId":"get_funding_rates_summary","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnifiedFundingRatesResponse"}}},"description":"Funding rates keyed by canonical symbol (`SOL`, `BTC`, `XAU`, ...). The `sunrise` entry is the Armada funding rate Imperial charges, read from chain; it is absent for markets with no rate in force. The `phoenix` entry is legacy (Phoenix is retired). Each entry's `source` marks whether it is live or a fallback."}},"tags":["reads"]}},"/api/v1/mobile/balances":{"get":{"operationId":"mobile_balances","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileBalancesResponse"}}},"description":"Per-subaccount USDC balances. Each entry is one Imperial profile (`profile_index` 0..5). USDC is held in the profile's USDC ATA in 6-decimal native units. Collateral already committed to positions or margin accounts is not included. Use this to size new orders before calling `/api/v1/mobile/orders`."},"401":{"description":"Missing, invalid, or revoked JWT"}},"security":[{"bearer_jwt":[]}],"tags":["trading"]}},"/api/v1/mobile/builder/summary":{"get":{"operationId":"builder_summary","parameters":[{"description":"Builder code, case-insensitive. The code itself is the credential.","in":"query","name":"code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuilderSummaryResponse"}}},"description":"Builder fee summary"},"404":{"description":"Unknown builder code"}},"summary":"Fee accrual and payout summary for a builder code. No authentication: the\ncode itself is the credential, so keep it private.","tags":["mobile"]}},"/api/v1/mobile/connect":{"post":{"operationId":"mobile_connect","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileConnectRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileConnectResponse"}}},"description":"One-time code to exchange for a JWT"},"400":{"description":"Invalid wallet, delegate, message format or nonce, or replayed nonce"},"401":{"description":"Signature verification failed"},"413":{"description":"Request body over 4 KiB"}},"tags":["auth"]}},"/api/v1/mobile/exchange":{"post":{"operationId":"mobile_exchange","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileExchangeRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileExchangeResponse"}}},"description":"JWT and expiry"},"401":{"description":"Invalid or expired connect code"}},"tags":["auth"]}},"/api/v1/mobile/orders":{"post":{"operationId":"mobile_create_order","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileCreateOrderRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileOrderResponse"}}},"description":"Order outcome. `success=false` with an `error` message is a rejected-but-valid response."},"400":{"description":"Validation error (e.g. missing `extraData` for ratchet/DCA order types)"},"401":{"description":"Missing, invalid, or revoked JWT, or JWT wallet doesn't match `wallet`"}},"security":[{"bearer_jwt":[]}],"tags":["trading"]}},"/api/v1/mobile/orders/batch":{"post":{"description":"Close orders are validated against the position the entry will open, so\nthey can be sent before that position exists. Submission is sequential:\nthe entry first, then each close in input order. If the entry fails, no\nclose orders are submitted. A failed close order does not roll back the\nentry; check each leg's `success`.","operationId":"mobile_create_order_batch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileCreateOrderBatchRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileCreateOrderBatchResponse"}}},"description":"Batch submitted (inspect per-leg `success` flags)"},"400":{"description":"Validation error on the bundle"},"401":{"description":"JWT missing, expired, or wallet mismatch"}},"security":[{"bearer_jwt":[]}],"summary":"Submit an entry order and its attached close orders (TP/SL/trailing\nstop/etc.) in one request.","tags":["trading"]}},"/api/v1/mobile/orders/cancel":{"post":{"operationId":"mobile_cancel_order","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileCancelOrderRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileOrderResponse"}}},"description":"Cancel outcome. `success=false` with an `error` message means the request was rejected or the order was already resolved. `OrderAlreadyResolved` does not prove cancellation or authorize a replacement order."},"400":{"description":"`orderPda` is not an order of this `wallet` and `profileIndex`"},"401":{"description":"Missing, invalid, or revoked JWT, or JWT wallet doesn't match `wallet`"}},"security":[{"bearer_jwt":[]}],"tags":["trading"]}},"/api/v1/mobile/orders/collateral":{"post":{"operationId":"mobile_collateral_edit","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileCollateralEditRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileOrderResponse"}}},"description":"Collateral-edit outcome. `success=false` with an `error` message means the edit was rejected (e.g. removing more collateral than available, leverage out of bounds). A removal without `exact` moves what can leave, up to the amount asked; with `exact` it moves all of it or nothing."},"400":{"description":"Invalid edit, or `exact` on a Phoenix removal"},"401":{"description":"Missing, invalid, or revoked JWT, or JWT wallet doesn't match `wallet`"}},"security":[{"bearer_jwt":[]}],"tags":["trading"]}},"/api/v1/mobile/orders/leverage":{"post":{"operationId":"set_position_leverage","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetPositionLeverageRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetPositionLeverageResponse"}}},"description":"The tag now on the position. Nothing on chain changed and no money moved."},"400":{"description":"Not an open Isolated Armada position, or leverage outside 1 to the market's cap. `errorCode`: `PositionNotOpen`, `PositionNotIsolated`, `LeverageTooLow`, `LeverageTooHigh`."},"401":{"description":"Missing, invalid, or revoked JWT, or JWT wallet doesn't match `wallet`"},"404":{"description":"No such position for this wallet"},"503":{"description":"The market's leverage limit is not loaded yet; retry"}},"security":[{"bearer_jwt":[]}],"tags":["trading"]}},"/api/v1/mobile/orders/preflight":{"post":{"description":"Takes the same body as `POST /api/v1/mobile/orders` and runs the same\nvalidation checks. Useful before multi-leg opens: check every leg first,\nthen place them. Has no side effects; nothing is placed or reserved.","operationId":"mobile_preflight_order","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileCreateOrderRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobilePreflightResponse"}}},"description":"Verdict. `ok=false` with `error` is a successful answer, not a failure."},"401":{"description":"Missing, invalid, or revoked JWT, or JWT wallet doesn't match `wallet`"}},"security":[{"bearer_jwt":[]}],"summary":"Ask whether an order would be accepted, without placing it.","tags":["trading"]}},"/api/v1/mobile/orders/update":{"post":{"operationId":"mobile_update_order","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileUpdateOrderRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileOrderResponse"}}},"description":"Update outcome. `success=false` with an `error` message means the update was rejected (e.g. order already filled or cancelled, native limit-order updates not supported)."},"401":{"description":"Missing, invalid, or revoked JWT, or JWT wallet doesn't match `wallet`"}},"security":[{"bearer_jwt":[]}],"tags":["trading"]}},"/api/v1/mobile/points":{"get":{"operationId":"mobile_points","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobilePointsResponse"}}},"description":"The wallet's Imperial points for the active season, read from the on-chain passthrough `UserAccount` PDA — the same balance the Imperial homepage displays. Points are credited in weekly batches, so the figure updates at each weekly close rather than per-trade. `0` when the wallet has never traded, no season is active, or the wallet has no credit yet this season."},"401":{"description":"Missing, invalid, or revoked JWT"}},"security":[{"bearer_jwt":[]}],"tags":["trading"]}},"/api/v1/mobile/positions/reverse":{"post":{"description":"Answers once both legs settled on chain or one failed. Every outcome is a\n200 carrying `outcome`; only authentication fails with a 4xx.","operationId":"mobile_reverse_position","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileReversePositionRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileReversePositionResponse"}}},"description":"Reverse outcome: `reversed`, `not_placed` (nothing closed), `closed_only` (the close settled, the open did not) or `unknown`."},"401":{"description":"Missing, invalid, or revoked JWT, or JWT wallet doesn't match `wallet`"}},"security":[{"bearer_jwt":[]}],"summary":"Reverse an open Armada position: close it in full, then open the same base\non the other side.","tags":["trading"]}},"/api/v1/mobile/positions/reverse/preflight":{"post":{"description":"Free of side effects, like `/mobile/orders/preflight`, and the same checks\nthe reverse itself makes before it closes. Use it to enable the button and\nto fill a confirmation with the new size, margin, fees and the orders a\nreverse would cancel.","operationId":"mobile_reverse_position_preflight","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileReversePositionRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileReversePreflightResponse"}}},"description":"Verdict. `reversible=false` with `errorDetails` is a successful answer, not a failure."},"401":{"description":"Missing, invalid, or revoked JWT, or JWT wallet doesn't match `wallet`"}},"security":[{"bearer_jwt":[]}],"summary":"Ask whether a position can be reversed, without reversing it.","tags":["trading"]}},"/api/v1/mobile/revoke":{"post":{"operationId":"mobile_revoke","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokeResponse"}}},"description":"JWT was added to the revocation list"},"401":{"description":"Missing or invalid Bearer token"}},"security":[{"bearer_jwt":[]}],"tags":["auth"]}},"/api/v1/order-history":{"get":{"operationId":"get_order_history","parameters":[{"description":"Base58 Solana wallet pubkey.","in":"query","name":"walletAddress","required":true,"schema":{"type":"string"}},{"description":"Restrict to one Imperial profile (0-5); omitted means all profiles.","in":"query","name":"profileIndex","required":false,"schema":{"format":"int32","type":["integer","null"]}},{"description":"Page size, capped at 200 server-side. Default 50.","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Pagination offset.","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Market mint filter.","in":"query","name":"market","required":false,"schema":{"type":["string","null"]}},{"description":"Underwriter filter. Pass the `underwriter` value returned on order rows.","in":"query","name":"underwriter","required":false,"schema":{"type":["string","null"]}},{"description":"`long` or `short`.","in":"query","name":"side","required":false,"schema":{"type":["string","null"]}},{"description":"Display status filter: `open`, `active`, `partially_filled`, `filled`,\n`triggered`, `completed`, `paused`, `canceled`, `rejected`, or `failed`.","in":"query","name":"status","required":false,"schema":{"type":["string","null"]}},{"description":"Order category: `standard`, `dca`, `trailing`, `rsi`.","in":"query","name":"category","required":false,"schema":{"type":["string","null"]}},{"description":"Unix-seconds lower bound on creation time.","in":"query","name":"from","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Unix-seconds upper bound on creation time.","in":"query","name":"to","required":false,"schema":{"format":"int64","type":["integer","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderHistoryResponse"}}},"description":"Order history for the wallet, newest first, paginated. Top-level rows only — strategy children live in the detail endpoint."},"400":{"description":"Invalid wallet address or filter value"}},"tags":["reads"]}},"/api/v1/order-history/{order_pda}":{"get":{"operationId":"get_order_history_detail","parameters":[{"description":"Order PDA","in":"path","name":"order_pda","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderHistoryDetailResponse"}}},"description":"Full order/strategy detail: config, child orders, fills, and the audit event log (empty for orders created before order-history tracking)."},"404":{"description":"Order not found"}},"tags":["reads"]}},"/api/v1/orders":{"get":{"operationId":"get_combined_orders","parameters":[{"description":"Base58 Solana wallet pubkey.","in":"query","name":"walletAddress","required":true,"schema":{"type":"string"}},{"description":"Optional underwriter filter (the `underwriter` value returned on rows).\nUnknown values yield 400.","in":"query","name":"underwriter","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CombinedOrdersResponse"}}},"description":"All open and recently resolved orders for the wallet, across all 6 profiles. `passthroughOrders` holds every order: TP/SL, limit, stop-limit, trailing, indicator and DCA. `jupiterOrders` is a legacy field and is always empty."},"400":{"description":"Invalid wallet address"}},"tags":["reads"]}},"/api/v1/passthrough/referrals/invite":{"post":{"operationId":"bind_personal_invite","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PersonalInviteRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PersonalInviteResponse"}}},"description":""},"400":{"description":"Invalid code, self-referral, owner mismatch or referral cycle"},"401":{"description":"Current owner session required"},"404":{"description":"Unknown invite code"},"429":{"description":"Referral attribution rate limit"},"503":{"description":"Referral updates paused or verification unavailable"}},"security":[{"bearer_jwt":[]}],"summary":"Record the authenticated wallet as referred by the owner of a personal\ninvite code. Personal codes are reusable and credit the code's owner as\nreferrer; they do not grant any trading access. A code always belongs to\nthe wallet that was issued it.","tags":["profiles"]}},"/api/v1/passthrough/users/{wallet}/orders":{"get":{"operationId":"get_passthrough_orders","parameters":[{"description":"Base58 wallet pubkey","in":"path","name":"wallet","required":true,"schema":{"type":"string"}},{"description":"Filter by status: `pending`, `executed`, `cancelled`, or `active` for\nevery order not yet in a terminal status.","in":"query","name":"status","required":false,"schema":{"type":["string","null"]}},{"description":"Max orders to return.","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Sub-account index (0..5).","in":"query","name":"profile_index","required":false,"schema":{"format":"int32","type":["integer","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PassthroughOrdersResponse"}}},"description":"List of passthrough orders (open, executed, cancelled)"}},"tags":["reads"]}},"/api/v1/passthrough/users/{wallet}/profiles":{"get":{"description":"Read this before submitting an order: `marginMode` is the default margin\nmode for new positions, and `venueLock` (when present) is the set of\nvenues the profile may open on.","operationId":"get_profiles","parameters":[{"description":"Base58 wallet pubkey","in":"path","name":"wallet","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfilesResponse"}}},"description":"All six profiles, indexed 0-5."},"400":{"description":"Invalid wallet address"}},"summary":"The wallet's six subaccounts, with each one's margin mode and venue lock.","tags":["reads"]}},"/api/v1/passthrough/users/{wallet}/profiles/{index}/margin-mode":{"put":{"description":"Under `\"unified\"`, new positions open on the cross margin account, where one\nbalance backs every position. An Armada order may name a seat with\n`extraData.sunriseSeat`, but only one of the profile's mode: a seat of the\nother kind is a `400` `MarginModeSeatMismatch`. See \"Profiles and margin\naccounts\" in the API overview.\n\nAuth is JWT (`Authorization: Bearer`) or a Solana signature over\n`imperial:margin-mode:{wallet}:{profileIndex}:{marginMode}` sent as\n`x-pubkey` + `x-signature`. The mode is part of the signed message, so a\ncaptured signature cannot be replayed to flip the profile the other way.\n\nThe profile must already have a name (`PUT .../profiles/{index}/name`).\n\nAn account is wholly cross or wholly isolated, so the mode changes only on a\nCLOSED account: no open position, no live entry order at any venue, and no\nArmada open or close still in flight. Take-profits, stop-losses and other\nclose-only orders do not count: they open nothing and are cancelled with\ntheir position. Anything else is a `409` with `errorCode`\n`MarginModeSwitchNeedsClosedAccount`, and the message names what is still\nopen. A `503` means the switch could not be confirmed just then, and its\nmessage says which case it is: nothing changed, so retry; or the outcome\nis unknown, so read the mode again before retrying. Setting the mode it\nalready has changes nothing, but it waits for any switch still running on\nthe account: `409` `MarginModeChanged` if that moved the mode, or a `503`\nto read the mode again if it cannot be confirmed. A Armada order placed on\nthe account while it switches waits for the switch, then runs under the\nmode it left. Positions opened before this rule can still sit on the other\nseat, so never infer an existing position's margin mode from this flag:\nread `directVenue.marginMode` off the position row instead.","operationId":"set_profile_margin_mode","parameters":[{"description":"Base58 wallet pubkey","in":"path","name":"wallet","required":true,"schema":{"type":"string"}},{"description":"Profile index, 0-5","in":"path","name":"index","required":true,"schema":{"format":"int32","minimum":0,"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetMarginModeRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarginModeResponse"}}},"description":"The mode now in force, with the routing lock it implies."},"400":{"description":"Unknown mode, profile index out of range, or the profile has no name yet."},"401":{"description":"Missing/invalid JWT or signature, or it doesn't match `wallet`"},"409":{"description":"The profile still holds an open position, a live entry order or an order in flight (`MarginModeSwitchNeedsClosedAccount`), or its mode changed while switching (`MarginModeChanged`)."},"503":{"description":"The switch could not be confirmed just now. The message says whether nothing changed (retry) or the outcome is unknown (read the mode again before retrying). For the mode the profile already has, it is always the second."}},"security":[{"bearer_jwt":[]}],"summary":"Switch a profile between isolated and unified (cross) margin.","tags":["trading"]}},"/api/v1/passthrough/users/{wallet}/referral-code":{"get":{"operationId":"get_referral_code","parameters":[{"description":"Wallet public key","in":"path","name":"wallet","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferralCodeResponse"}}},"description":""},"404":{"description":"No code exists"},"503":{"description":"Lookup unavailable"}},"tags":["reads"]},"put":{"operationId":"customize_referral_code","parameters":[{"description":"Must match the owner session wallet","in":"path","name":"wallet","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomizeReferralCodeRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferralCodeResponse"}}},"description":""},"400":{"description":"Invalid code"},"401":{"description":"Owner session required"},"409":{"description":"Code occupied or current code changed"},"429":{"description":"Reservation quota or cooldown"},"503":{"description":"Verification or persistence unavailable"}},"security":[{"bearer_jwt":[]}],"tags":["profiles"]}},"/api/v1/passthrough/users/{wallet}/referral-code/aliases":{"get":{"operationId":"owned_referral_aliases","parameters":[{"description":"Must match the owner session wallet","in":"path","name":"wallet","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwnedReferralAliasesResponse"}}},"description":""},"401":{"description":"Owner session required"},"503":{"description":"Verification or lookup unavailable"}},"security":[{"bearer_jwt":[]}],"tags":["profiles"]}},"/api/v1/passthrough/users/{wallet}/referral-code/ensure":{"post":{"operationId":"ensure_referral_code","parameters":[{"description":"Must match the verified session wallet","in":"path","name":"wallet","required":true,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferralCodeResponse"}}},"description":""},"401":{"description":"Wallet verification required"},"503":{"description":"Verification or persistence unavailable"}},"security":[{"bearer_jwt":[]}],"tags":["profiles"]}},"/api/v1/pnl-history":{"get":{"operationId":"get_pnl_history","parameters":[{"description":"Base58 Solana wallet pubkey.","in":"query","name":"walletAddress","required":true,"schema":{"type":"string"}},{"description":"Bucket size. Accepts `1h` or `1d`.","in":"query","name":"resolution","required":true,"schema":{"type":"string"}},{"description":"Inclusive start (unix seconds). Defaults to `now - 90d` for `1h` and\nthe wallet's earliest action for `1d` (within the underwriter filter\nwhen set).","in":"query","name":"since","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Inclusive end (unix seconds). Defaults to `now`.","in":"query","name":"until","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Optional underwriter filter (the `underwriter` value returned on\nposition rows). Unknown values yield 400. When set, every component\n(realized PnL, funding, fees, unrealized PnL) is scoped to it.","in":"query","name":"underwriter","required":false,"schema":{"type":["string","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/PnlHistoryPoint"},"type":"array"}}},"description":"Time-bucketed PnL history for the wallet, aggregated across every profile PDA. One row per `[since, until]` bucket (continuous — empty buckets carry forward the prior cumulative values). `unrealizedPnl` is populated only on the last bucket; earlier buckets serialize as null because historical mark-to-market is not supported."},"400":{"description":"Invalid wallet, resolution, range, or lookback exceeds the hourly cap (90 days)."}},"tags":["reads"]}},"/api/v1/positions":{"get":{"operationId":"get_jupiter_positions_with_ownership","parameters":[{"in":"query","name":"walletAddress","required":true,"schema":{"type":"string"}},{"in":"query","name":"underwriter","required":false,"schema":{"type":["string","null"]}},{"description":"Opt in to required-source coverage metadata. Currently only version 1.","in":"query","name":"accountReadVersion","required":false,"schema":{"format":"int32","minimum":0,"type":["integer","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PositionsResponse"}}},"description":"Open positions for the wallet across all profiles, with live PnL, leverage, entry price, liquidation price, accrued fees, and any attached TP/SL, trailing or DCA close orders. Numeric fields are strings to preserve precision. With `accountReadVersion=1` the response also reports which on-chain reads succeeded; partial coverage must not be treated as verified account state."},"400":{"description":"Invalid wallet address"}},"summary":"Open positions for the wallet, with live PnL.","tags":["reads"]}},"/api/v1/priority-fee":{"get":{"operationId":"get_priority_fee","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PriorityFeeResponse"}}},"description":"Suggested Solana priority fee for Imperial transactions. Median over recent blocks, refreshed every 30s, capped at 500,000 micro-lamports per compute unit."}},"tags":["reads"]}},"/api/v1/stats/armada/activity":{"get":{"operationId":"get_stats_armada_activity","parameters":[{"description":"Lookback window: `24h`, `7d`, `30d`, `90d`, `180d`, or `1y`. Default: `30d`.","in":"query","name":"period","required":false,"schema":{"type":"string"}},{"description":"Bucket size: `hour`, `day`, or `week`. Default: `hour` for 24h, `day` otherwise.","in":"query","name":"grouping","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArmadaActivityResponse"}}},"description":"Armada round-trip volume per bucket (buckets aligned to US Eastern time), and long/short open interest (entry notional) at each bucket's close."}},"tags":["reads"]}},"/api/v1/stats/markets":{"get":{"operationId":"get_stats_markets","parameters":[{"description":"Volume lookback window: `24h`, `7d`, or `30d`. Default: `24h`. OI is always a live snapshot.","in":"query","name":"period","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarketsResponse"}}},"description":"Per-asset volume and open-interest breakdown. Volume is round-trip notional (both legs). Symbols with either volume in the window or open interest appear; missing fields zero-fill."}},"tags":["reads"]}},"/api/v1/stats/open-interest":{"get":{"operationId":"get_stats_open_interest","parameters":[{"description":"Aggregation axis: `venue`, `asset`, `side`, or `venue_asset`. Default: `venue`. Venue labels match `/stats/summary`.","in":"query","name":"grouping","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpenInterestResponse"}}},"description":"Current open-interest snapshot. Each row carries long, short and total notional (total is the sum of long and short open interest) plus distinct-trader and position counts."}},"tags":["reads"]}},"/api/v1/stats/open-interest/history":{"get":{"operationId":"get_stats_open_interest_history","parameters":[{"description":"Lookback window: `24h`, `7d`, `30d`, `90d`, `180d`, `1y`, or `all`. Default: `30d`.","in":"query","name":"period","required":false,"schema":{"type":"string"}},{"description":"Bucket size: `hour`, `day`, or `week`. Default: `hour` for 24h, `day` otherwise.","in":"query","name":"grouping","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OiHistoryResponse"}}},"description":"Historical open-interest time series, rebuilt from recorded position size changes. `currentOiUsd` is the live current value."}},"tags":["reads"]}},"/api/v1/stats/summary":{"get":{"operationId":"get_stats_summary","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatsSummaryResponse"}}},"description":"Protocol-level snapshot: 24h/7d/all-time volume, current open interest, 24h active traders and fee revenue, plus a per-venue breakdown (historical rows may carry retired venue labels). All volume figures are round-trip notional (both legs of every trade), so they run roughly 2x an entries-only measure."}},"tags":["reads"]}},"/api/v1/stats/volume":{"get":{"operationId":"get_stats_volume","parameters":[{"description":"Lookback window: `24h`, `7d`, `30d`, `90d`, `180d`, or `1y`. Default: `7d`.","in":"query","name":"period","required":false,"schema":{"type":"string"}},{"description":"Bucket size: `hour`, `day`, or `week`. Default: `hour` for 24h, `week` for >30d, `day` otherwise.","in":"query","name":"grouping","required":false,"schema":{"type":"string"}},{"description":"Restrict to one venue, using a `venue` value from `/stats/summary`. Per-venue columns still appear (others zero-fill); `jupiterUsd`, `flashUsd`, `phoenixUsd` and `gmtradeUsd` are legacy columns for retired venues.","in":"query","name":"venue","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VolumeResponse"}}},"description":"Time-series round-trip notional volume bucketed over the requested window. Every position change contributes the absolute value of its size change (increases, decreases and liquidations alike), so a round trip counts twice its notional."}},"tags":["reads"]}},"/api/v1/stats/volume/range":{"get":{"operationId":"get_stats_volume_range","parameters":[{"description":"Window start, unix seconds UTC (inclusive).","in":"query","name":"startTs","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"Window end, unix seconds UTC (exclusive). At most 31 days after `startTs`.","in":"query","name":"endTs","required":true,"schema":{"format":"int64","type":"integer"}},{"description":"Restrict to one venue, using a `venue` value from `/stats/summary`.","in":"query","name":"venue","required":false,"schema":{"type":"string"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VolumeRangeResponse"}}},"description":"Round-trip notional volume over an exact UTC window, counted the same way as `/stats/volume`, plus the part of it from liquidation fills (`liquidationVolumeUsd`, included in `volumeUsd`) and the Imperial platform fees and builder (integrator) fees charged in that window."}},"tags":["reads"]}},"/api/v1/status":{"get":{"operationId":"get_status","responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}},"description":"Service health snapshot — always returns 200, inspect fields for the actual state."}},"tags":["system"]}},"/api/v1/trades":{"get":{"operationId":"get_jupiter_trades_with_ownership","parameters":[{"description":"Base58 Solana wallet pubkey.","in":"query","name":"walletAddress","required":true,"schema":{"type":"string"}},{"description":"Page size, capped at 200 server-side.","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Pagination offset.","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Optional underwriter filter (the `underwriter` value returned on rows).\nUnknown values yield 400.","in":"query","name":"underwriter","required":false,"schema":{"type":["string","null"]}},{"description":"`/trades` only: opt in to read coverage metadata. Currently only\nversion 1, which needs `limit` 1 to 200 and `offset` 0 or more.","in":"query","name":"accountReadVersion","required":false,"schema":{"format":"int32","minimum":0,"type":["integer","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TradesResponse"}}},"description":"Positions for the wallet (open and closed), newest first, paginated. Each one carries its full action history (open, increases, decreases, close). Historical rows may carry retired venue labels in `underwriter`. With `accountReadVersion=1` the response also carries `accountRead`, sent only when every required read for the page, its totals and the lifetime net PnL succeeded."},"400":{"description":"Invalid wallet address, or a page `accountReadVersion=1` cannot certify"},"503":{"description":"With `accountReadVersion=1`: a required read failed; retry"}},"summary":"Positions (open and closed) with their full action history, paginated.","tags":["reads"]}},"/api/v1/trades/lifecycle/{lifecycle_id}":{"get":{"operationId":"get_position_lifecycle","parameters":[{"description":"Position lifecycle id (the `id` of a position row)","in":"path","name":"lifecycle_id","required":true,"schema":{"format":"uuid","type":"string"}},{"description":"Base58 Solana wallet pubkey.","in":"query","name":"walletAddress","required":true,"schema":{"type":"string"}},{"description":"Page size, capped at 200 server-side.","in":"query","name":"limit","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Pagination offset.","in":"query","name":"offset","required":false,"schema":{"format":"int64","type":["integer","null"]}},{"description":"Optional underwriter filter (the `underwriter` value returned on rows).\nUnknown values yield 400.","in":"query","name":"underwriter","required":false,"schema":{"type":["string","null"]}},{"description":"`/trades` only: opt in to read coverage metadata. Currently only\nversion 1, which needs `limit` 1 to 200 and `offset` 0 or more.","in":"query","name":"accountReadVersion","required":false,"schema":{"format":"int32","minimum":0,"type":["integer","null"]}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExactLifecycleResponse"}}},"description":"The position and its action history"},"401":{"description":"Wallet verification required"},"503":{"description":"Position data temporarily unavailable; retry"}},"summary":"One position and its action history, looked up by lifecycle id. Only\nreturned to the wallet's verified owner.","tags":["reads"]}}},"servers":[{"description":"Production","url":"https://api.imperial.trade"},{"description":"Local","url":"http://localhost:8080"}],"tags":[{"description":"Connect a wallet, issue a JWT, revoke a JWT","name":"auth"},{"description":"Submit, cancel, and update orders. JWT required.","name":"trading"},{"description":"Public read endpoints. No auth required.","name":"reads"},{"description":"Health and status.","name":"system"}]}