{
    "openapi": "3.1.0",
    "info": {
        "title": "Osiris Trader API",
        "version": "1.0.0",
        "summary": "Computed crypto perpetual futures data: candles, metrics, order book walls, market structure and alerts.",
        "description": "The same real-time engine the Osiris screener runs on, over plain REST. Every endpoint reads the exact data the site renders, at the same freshness: candles flush within 300 ms, the market snapshot recomputes every 10 s, metric families every 30 s, density walls every 2 s.\n\nAuthenticate with an API key (`osk_...`) as a bearer token. Keys are issued on the Developer plan under Settings \u2192 Developer. Every response carries your rate-limit position in `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-Quota-Daily-Limit` and `X-Quota-Daily-Used` headers; a 429 names the wait in `Retry-After` seconds.\n\nTimestamps are Unix milliseconds. Symbols are uppercase pair names (requests accept any case). A metric that cannot be computed yet is absent, not null or 0. Fields are added over time within v1; parsers should ignore unknown keys. Human-readable docs: https://osiristrader.com/developers/introduction",
        "contact": {
            "name": "Osiris Trader",
            "url": "https://osiristrader.com/contact"
        },
        "termsOfService": "https://osiristrader.com/tos"
    },
    "externalDocs": {
        "description": "API documentation",
        "url": "https://osiristrader.com/developers/introduction"
    },
    "servers": [
        {
            "url": "https://osiristrader.com/api"
        }
    ],
    "security": [
        {
            "apiKey": []
        }
    ],
    "tags": [
        {
            "name": "Market data",
            "description": "Symbols, candles and whole-market snapshots."
        },
        {
            "name": "Computed metrics",
            "description": "Metric families, rankings, levels, densities and funding."
        },
        {
            "name": "Streaming",
            "description": "Connection tokens for the WebSocket stream."
        },
        {
            "name": "Alerts",
            "description": "Price alerts with webhook delivery."
        }
    ],
    "paths": {
        "/v1/symbols": {
            "get": {
                "tags": [
                    "Market data"
                ],
                "operationId": "listSymbols",
                "summary": "Tracked pairs for one venue",
                "description": "Every perpetual pair the venue is tracked on, with base/quote assets and price precision. Each venue lists pairs the others do not.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/exchange"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "exchange": {
                                            "type": "string"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "symbol": {
                                                        "type": "string"
                                                    },
                                                    "baseAsset": {
                                                        "type": [
                                                            "string",
                                                            "null"
                                                        ]
                                                    },
                                                    "quoteAsset": {
                                                        "type": "string"
                                                    },
                                                    "pricePrecision": {
                                                        "type": [
                                                            "integer",
                                                            "null"
                                                        ]
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/v1/candles/{symbol}": {
            "get": {
                "tags": [
                    "Market data"
                ],
                "operationId": "getCandles",
                "summary": "OHLCV bars, newest page by default",
                "description": "Closed bars plus the live in-flight bar. Page back through history with `before` (pass the oldest `time` of the previous page).",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/symbol"
                    },
                    {
                        "$ref": "#/components/parameters/interval"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "description": "Bars per page.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000,
                            "default": 300
                        }
                    },
                    {
                        "name": "before",
                        "in": "query",
                        "description": "Unix ms cursor: return bars strictly older than this open time.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/exchange"
                    }
                ],
                "responses": {
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "symbol": {
                                            "type": "string"
                                        },
                                        "exchange": {
                                            "type": "string"
                                        },
                                        "interval": {
                                            "type": "string"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Candle"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/v1/market": {
            "get": {
                "tags": [
                    "Market data"
                ],
                "operationId": "getMarket",
                "summary": "Whole-market snapshot",
                "description": "A live summary row per tracked pair (price, 24h change, rolling volumes, volatility, taker delta, funding, BTC correlation, open interest and the last hour of liquidations \u2014 oi and liq are null until their sweeps cover the pair, or on venues without a feed), recomputed every 10 s.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/exchange"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "exchange": {
                                            "type": "string"
                                        },
                                        "asOf": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ],
                                            "description": "Snapshot time, Unix ms."
                                        },
                                        "data": {
                                            "type": "object",
                                            "description": "Pair name => summary row.",
                                            "additionalProperties": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/v1/market/overview": {
            "get": {
                "tags": [
                    "Market data"
                ],
                "operationId": "getMarketOverview",
                "summary": "Market regime dashboard",
                "description": "Breadth, the futures fear and greed composite, BTC/ETH volume dominance, 24h forced-liquidation totals (widgets.liquidations; null when no venue in view publishes a feed), total open interest with its 24h move (widgets.openInterest; null until the venue aggregates report), the 24h volume compared with yesterday (widgets.volDelta; null until the history covers it) and ranked top-N sections (gainers, losers, volume, volatility, funding, trades, volSpikes, pressure).",
                "parameters": [
                    {
                        "name": "count",
                        "in": "query",
                        "description": "Rows per ranked section.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 25,
                            "default": 10
                        }
                    },
                    {
                        "name": "coverage",
                        "in": "query",
                        "description": "`all` merges every venue into one board; `single` reads the requested venue.",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "single",
                                "all"
                            ],
                            "default": "single"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/exchange"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "additionalProperties": true
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/v1/market/{symbol}": {
            "get": {
                "tags": [
                    "Market data"
                ],
                "operationId": "getMarketSymbol",
                "summary": "One pair's market summary",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/symbol"
                    },
                    {
                        "$ref": "#/components/parameters/exchange"
                    }
                ],
                "responses": {
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "symbol": {
                                            "type": "string"
                                        },
                                        "exchange": {
                                            "type": "string"
                                        },
                                        "asOf": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ]
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/v1/book/{symbol}": {
            "get": {
                "tags": [
                    "Computed metrics"
                ],
                "operationId": "getBook",
                "summary": "Live order book snapshot for one pair",
                "description": "Raw top-of-book levels best-first, a server-grouped depth histogram covering about 1% around the mid, and the tracked walls, refreshed every second. Asking for a book is what makes the engine start flattening it, so the very first call can answer with `asOf: null` while the snapshot warms up; retry within a couple of seconds. Books exist for crypto perpetuals only: other asset classes answer 422.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/symbol"
                    },
                    {
                        "$ref": "#/components/parameters/exchange"
                    },
                    {
                        "name": "levels",
                        "in": "query",
                        "required": false,
                        "description": "Cap on raw levels returned per side, 1 to 1000. The depth histogram is always complete.",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 1000,
                            "default": 1000
                        }
                    }
                ],
                "responses": {
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "symbol": {
                                            "type": "string"
                                        },
                                        "exchange": {
                                            "type": "string"
                                        },
                                        "asOf": {
                                            "type": [
                                                "integer",
                                                "null"
                                            ],
                                            "description": "Snapshot time in ms; null while the book warms up."
                                        },
                                        "bids": {
                                            "type": "array",
                                            "description": "[price, qty] best-first (descending).",
                                            "items": {
                                                "type": "array",
                                                "items": {
                                                    "type": "number"
                                                }
                                            }
                                        },
                                        "asks": {
                                            "type": "array",
                                            "description": "[price, qty] best-first (ascending).",
                                            "items": {
                                                "type": "array",
                                                "items": {
                                                    "type": "number"
                                                }
                                            }
                                        },
                                        "depth": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "description": "Corridor histogram: step is 1, 2 or 5 times a power of ten; bids floor-anchored, asks ceil-anchored.",
                                            "properties": {
                                                "step": {
                                                    "type": "number"
                                                },
                                                "bids": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "number"
                                                        }
                                                    }
                                                },
                                                "asks": {
                                                    "type": "array",
                                                    "items": {
                                                        "type": "array",
                                                        "items": {
                                                            "type": "number"
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        "walls": {
                                            "type": "array",
                                            "description": "Same wall objects the densities endpoints serve.",
                                            "items": {
                                                "type": "object",
                                                "additionalProperties": true
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/v1/densities": {
            "get": {
                "tags": [
                    "Computed metrics"
                ],
                "operationId": "listDensities",
                "summary": "Every detected order book wall",
                "description": "Large resting walls across the whole venue, rescanned every 2 s, with size and distance from price.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/exchange"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "exchange": {
                                            "type": "string"
                                        },
                                        "data": {
                                            "type": "object",
                                            "description": "Pair name => detected walls.",
                                            "additionalProperties": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/v1/densities/{symbol}": {
            "get": {
                "tags": [
                    "Computed metrics"
                ],
                "operationId": "getDensitiesSymbol",
                "summary": "One pair's order book walls",
                "description": "A 404 means no walls are detected for the pair right now, not an unknown pair.",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/symbol"
                    },
                    {
                        "$ref": "#/components/parameters/exchange"
                    }
                ],
                "responses": {
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "symbol": {
                                            "type": "string"
                                        },
                                        "exchange": {
                                            "type": "string"
                                        },
                                        "data": {
                                            "type": "object",
                                            "additionalProperties": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/v1/metrics": {
            "get": {
                "tags": [
                    "Computed metrics"
                ],
                "operationId": "getMetricsBulk",
                "summary": "Metric sets for up to 50 pairs in one request",
                "parameters": [
                    {
                        "name": "symbols",
                        "in": "query",
                        "required": true,
                        "description": "Comma-separated pair names, at most 50. Unknown pairs are skipped, not errors.",
                        "schema": {
                            "type": "string"
                        },
                        "example": "BTCUSDT,ETHUSDT"
                    },
                    {
                        "$ref": "#/components/parameters/interval"
                    },
                    {
                        "$ref": "#/components/parameters/exchange"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "exchange": {
                                            "type": "string"
                                        },
                                        "interval": {
                                            "type": "string"
                                        },
                                        "data": {
                                            "type": "object",
                                            "description": "Pair name => metric set.",
                                            "additionalProperties": {
                                                "$ref": "#/components/schemas/MetricSet"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/v1/metrics/{symbol}": {
            "get": {
                "tags": [
                    "Computed metrics"
                ],
                "operationId": "getMetrics",
                "summary": "Every computed metric family for one pair",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/symbol"
                    },
                    {
                        "$ref": "#/components/parameters/interval"
                    },
                    {
                        "$ref": "#/components/parameters/exchange"
                    }
                ],
                "responses": {
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "symbol": {
                                            "type": "string"
                                        },
                                        "exchange": {
                                            "type": "string"
                                        },
                                        "interval": {
                                            "type": "string"
                                        },
                                        "data": {
                                            "$ref": "#/components/schemas/MetricSet"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/v1/levels": {
            "get": {
                "tags": [
                    "Computed metrics"
                ],
                "operationId": "listLevels",
                "summary": "Market structure levels for every tracked pair",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/exchange"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "exchange": {
                                            "type": "string"
                                        },
                                        "data": {
                                            "type": "object",
                                            "description": "Pair name => computed levels.",
                                            "additionalProperties": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/v1/levels/{symbol}": {
            "get": {
                "tags": [
                    "Computed metrics"
                ],
                "operationId": "getLevelsSymbol",
                "summary": "One pair's support and resistance levels",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/symbol"
                    },
                    {
                        "$ref": "#/components/parameters/exchange"
                    }
                ],
                "responses": {
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "symbol": {
                                            "type": "string"
                                        },
                                        "exchange": {
                                            "type": "string"
                                        },
                                        "data": {
                                            "type": [
                                                "object",
                                                "null"
                                            ],
                                            "additionalProperties": true
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/v1/funding/{symbol}/history": {
            "get": {
                "tags": [
                    "Computed metrics"
                ],
                "operationId": "getFundingHistory",
                "summary": "Actually paid fundings, newest first",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/symbol"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 200,
                            "default": 200
                        }
                    },
                    {
                        "$ref": "#/components/parameters/exchange"
                    }
                ],
                "responses": {
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "symbol": {
                                            "type": "string"
                                        },
                                        "exchange": {
                                            "type": "string"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "time": {
                                                        "type": "integer",
                                                        "description": "Settlement time, Unix ms."
                                                    },
                                                    "rate": {
                                                        "type": "number",
                                                        "description": "The paid rate as a fraction (0.0001 = 0.01%)."
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/v1/rankings/{category}": {
            "get": {
                "tags": [
                    "Computed metrics"
                ],
                "operationId": "getRankings",
                "summary": "Every pair sorted by a computed metric",
                "description": "The screener as an API. Allowed metrics per category: `volatility`: NATR, RR, PK, GK, RS, YZ, SURGE (default NATR); `volsurge`: SCORE, VOL_RATIO, TR_RATIO, RET_ZSCORE (default SCORE); `volume`: USDT_VOLUME, AVG_VOLUME, VOL_STDDEV, VOL_GROWTH, VWAP, VWAP_DIST, OBV (default USDT_VOLUME); `trades`: TC_GROWTH, QV_GROWTH, TC_ZSCORE, QV_ZSCORE, FLOW, BUY_RATIO, SIZE_GROWTH, AVG_TRADE_SIZE (default TC_GROWTH); `correlation`: retCorr, realTimeVol, natrRatio, surgeRatio (default retCorr); `funding`: RATE, PREMIUM, AVG_24H, TREND, APR (default RATE); `liquidations`: TOTAL_5M, LONG_5M, SHORT_5M, TOTAL_1H, LONG_1H, SHORT_1H, MAX_1H, CASCADE_X (default TOTAL_5M); `oi`: OI_USD, CHG_1H, CHG_4H, CHG_24H, DIV_1H (default OI_USD); `trend`: LOCAL_SCORE, GLOBAL_SCORE, ALIGNMENT, DIVERGENCE, CONSENSUS, MOMENTUM (default LOCAL_SCORE). `funding`, `liquidations`, `oi` and `trend` ignore the interval; liquidation windows are fixed (5m/1h) and venues without a public liquidation feed return no rows for that category. `oi` windows are fixed too (1h/4h/24h): notional ranks by size, the change and divergence metrics by magnitude.",
                "parameters": [
                    {
                        "name": "category",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "volatility",
                                "volsurge",
                                "volume",
                                "trades",
                                "correlation",
                                "funding",
                                "liquidations",
                                "oi",
                                "trend"
                            ]
                        }
                    },
                    {
                        "name": "metric",
                        "in": "query",
                        "description": "The sort metric; defaults to the category's first allowed metric. A 422 lists the allowed set.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/interval"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 500,
                            "default": 50
                        }
                    },
                    {
                        "$ref": "#/components/parameters/exchange"
                    }
                ],
                "responses": {
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "category": {
                                            "type": "string"
                                        },
                                        "metric": {
                                            "type": "string"
                                        },
                                        "exchange": {
                                            "type": "string"
                                        },
                                        "interval": {
                                            "type": [
                                                "string",
                                                "null"
                                            ]
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "type": "object",
                                                "properties": {
                                                    "symbol": {
                                                        "type": "string"
                                                    },
                                                    "value": {
                                                        "type": "number"
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/v1/ws-token": {
            "post": {
                "tags": [
                    "Streaming"
                ],
                "operationId": "createWsToken",
                "summary": "Short-lived WebSocket connection token",
                "description": "The token authorizes new connections to the live stream for 5 minutes and may be reused for reconnects within that window. The response carries the full connection URL.",
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "token": {
                                            "type": "string"
                                        },
                                        "expiresIn": {
                                            "type": "integer",
                                            "description": "Seconds the token stays valid for new connections."
                                        },
                                        "url": {
                                            "type": "string",
                                            "description": "Ready-to-use wss:// connection URL."
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/v1/alerts": {
            "get": {
                "tags": [
                    "Alerts"
                ],
                "operationId": "listAlerts",
                "summary": "Your price alerts",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "active",
                                "triggered",
                                "all"
                            ],
                            "default": "active"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Alert"
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            },
            "post": {
                "tags": [
                    "Alerts"
                ],
                "operationId": "createAlert",
                "summary": "Create a price alert, optionally with a webhook",
                "description": "Same rules and plan caps as the web UI. With a `webhook_url`, the trigger payload is POSTed to your server the moment the alert fires; the URL must be publicly reachable.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "symbol",
                                    "type",
                                    "direction"
                                ],
                                "properties": {
                                    "symbol": {
                                        "type": "string",
                                        "description": "A tracked pair, any case."
                                    },
                                    "exchange": {
                                        "type": "string",
                                        "enum": [
                                            "binance",
                                            "bybit",
                                            "okx",
                                            "bitget"
                                        ],
                                        "description": "The venue whose feed evaluates the alert; omitted, it resolves to the venue that lists the pair."
                                    },
                                    "type": {
                                        "type": "string",
                                        "enum": [
                                            "price",
                                            "pct"
                                        ]
                                    },
                                    "direction": {
                                        "type": "string",
                                        "enum": [
                                            "above",
                                            "below",
                                            "up",
                                            "down",
                                            "any"
                                        ],
                                        "description": "`above`/`below` for price alerts, `up`/`down`/`any` for pct alerts."
                                    },
                                    "price": {
                                        "type": "number",
                                        "exclusiveMinimum": 0,
                                        "description": "The level; required for price alerts and must be on the stated side of the live price."
                                    },
                                    "pct": {
                                        "type": "number",
                                        "minimum": 0.1,
                                        "maximum": 500,
                                        "description": "Move size in percent; required for pct alerts."
                                    },
                                    "window": {
                                        "type": "string",
                                        "enum": [
                                            "5m",
                                            "15m",
                                            "1h",
                                            "4h",
                                            "1d",
                                            "1w"
                                        ],
                                        "description": "Rolling window the move is measured over; required for pct alerts."
                                    },
                                    "repeat": {
                                        "type": "boolean",
                                        "description": "Re-arm after triggering (plan-gated)."
                                    },
                                    "note": {
                                        "type": "string",
                                        "maxLength": 200
                                    },
                                    "webhook_url": {
                                        "type": "string",
                                        "format": "uri",
                                        "maxLength": 500
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/components/schemas/Alert"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        },
        "/v1/alerts/{id}": {
            "delete": {
                "tags": [
                    "Alerts"
                ],
                "operationId": "deleteAlert",
                "summary": "Delete one of your alerts",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "404": {
                        "$ref": "#/components/responses/NotFound"
                    },
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "ok": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Unauthorized"
                    },
                    "422": {
                        "$ref": "#/components/responses/ValidationError"
                    },
                    "429": {
                        "$ref": "#/components/responses/RateLimited"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "apiKey": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "osk_...",
                "description": "An Osiris API key, created under Settings \u2192 Developer: `Authorization: Bearer osk_YOUR_KEY`."
            }
        },
        "parameters": {
            "exchange": {
                "name": "exchange",
                "in": "query",
                "required": false,
                "description": "The venue to read. Omitted, the default venue (binance) answers. The same pair is a different instrument on each venue; an unknown venue id is a 422.",
                "schema": {
                    "type": "string",
                    "enum": [
                        "binance",
                        "bybit",
                        "okx",
                        "bitget"
                    ],
                    "default": "binance"
                }
            },
            "interval": {
                "name": "interval",
                "in": "query",
                "required": false,
                "description": "Candle timeframe the data is computed on.",
                "schema": {
                    "type": "string",
                    "enum": [
                        "1m",
                        "5m",
                        "15m",
                        "1h",
                        "4h",
                        "1d",
                        "1w"
                    ],
                    "default": "5m"
                }
            },
            "symbol": {
                "name": "symbol",
                "in": "path",
                "required": true,
                "description": "Pair name, e.g. BTCUSDT. Any case is accepted.",
                "schema": {
                    "type": "string"
                }
            }
        },
        "responses": {
            "Unauthorized": {
                "description": "Missing, malformed or revoked API key.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "NotFound": {
                "description": "Unknown symbol, resource or route.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "ValidationError": {
                "description": "A parameter is out of range or malformed; the message names what and lists the allowed values.",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            },
            "RateLimited": {
                "description": "Burst or daily quota exceeded. Honor Retry-After; rejected requests do not count against the daily quota.",
                "headers": {
                    "Retry-After": {
                        "description": "Seconds to wait before retrying.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                },
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "message": {
                        "type": "string"
                    }
                }
            },
            "Candle": {
                "type": "object",
                "description": "One OHLCV bar. The newest bar is the live in-flight one and keeps changing until its bucket closes.",
                "properties": {
                    "time": {
                        "type": "integer",
                        "description": "Bucket open time, Unix ms, aligned to the timeframe (UTC)."
                    },
                    "open": {
                        "type": "number"
                    },
                    "high": {
                        "type": "number"
                    },
                    "low": {
                        "type": "number"
                    },
                    "close": {
                        "type": "number"
                    },
                    "volume": {
                        "type": "number",
                        "description": "Base-asset volume for the bucket."
                    }
                },
                "required": [
                    "time",
                    "open",
                    "high",
                    "low",
                    "close",
                    "volume"
                ]
            },
            "MetricSet": {
                "type": "object",
                "description": "Every computed metric family for one pair. A metric that cannot be computed yet is absent; treat missing as unknown, not zero.",
                "properties": {
                    "volatility": {
                        "type": "object",
                        "description": "Volatility estimators on the requested interval (RR, PK, GK, RS, YZ, NATR, SURGE).",
                        "additionalProperties": {
                            "type": "number"
                        }
                    },
                    "volsurge": {
                        "type": "object",
                        "description": "Volatility surge detection.",
                        "additionalProperties": true
                    },
                    "volume": {
                        "type": "object",
                        "description": "Volume analytics, VWAP and OBV.",
                        "additionalProperties": true
                    },
                    "trades": {
                        "type": "object",
                        "description": "Trade count, order flow and taker statistics.",
                        "additionalProperties": true
                    },
                    "correlation": {
                        "type": "object",
                        "description": "BTC correlation and relative volatility.",
                        "additionalProperties": true
                    },
                    "funding": {
                        "type": "object",
                        "description": "Current funding rate, premium, 24h average, trend and APR.",
                        "additionalProperties": true
                    },
                    "liquidations": {
                        "type": "object",
                        "description": "Forced-liquidation notionals (USDT) over fixed windows: LONG_5M, SHORT_5M, TOTAL_5M, LONG_1H, SHORT_1H, TOTAL_1H, LONG_24H, SHORT_24H, TOTAL_24H, MAX_1H (largest single print), CASCADE_X (latest minute vs the recent norm) and CASCADE (1 while a cascade is running). Empty on venues without a public liquidation feed; absent means no feed, never zero liquidations.",
                        "additionalProperties": true
                    },
                    "oi": {
                        "type": "object",
                        "description": "Open interest: OI (base units), OI_USD (notional), CHG_1H / CHG_4H / CHG_24H (OI change over the window, % of base units, so a pure price move never reads as positioning), PX_1H (price change over the same hour) and DIV_1H (equals CHG_1H when OI and price moved meaningfully in opposite directions over the hour: positive = OI building into a falling price, negative = OI unwinding into a rising price; 0 when they agree). Change fields are absent until the engine has collected enough OI history for the window.",
                        "additionalProperties": true
                    },
                    "trend": {
                        "type": [
                            "object",
                            "null"
                        ],
                        "description": "Trend engine labels per horizon plus numeric scores under `scores`.",
                        "additionalProperties": true
                    }
                }
            },
            "Alert": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "symbol": {
                        "type": "string"
                    },
                    "exchange": {
                        "type": "string"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "price",
                            "pct"
                        ]
                    },
                    "direction": {
                        "type": "string",
                        "enum": [
                            "above",
                            "below",
                            "up",
                            "down",
                            "any"
                        ]
                    },
                    "price": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "description": "The level, for price alerts."
                    },
                    "pct": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "description": "The move size in percent, for pct alerts."
                    },
                    "window": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "description": "The rolling window a pct move is measured over."
                    },
                    "repeat": {
                        "type": "boolean"
                    },
                    "note": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "webhookUrl": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "active",
                            "triggered"
                        ]
                    },
                    "createdPrice": {
                        "type": [
                            "number",
                            "null"
                        ],
                        "description": "Live price at creation."
                    },
                    "lastTriggeredAt": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    },
                    "triggerCount": {
                        "type": "integer"
                    },
                    "createdAt": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "format": "date-time"
                    }
                }
            }
        }
    }
}