{"asyncapi":"3.0.0","info":{"title":"Predict WebSocket API","version":"1.0.0","description":"Live market data and account activity over one WebSocket connection. Clients subscribe to\ntopics and the server pushes each topic's messages as they happen.\n\nAll frames are JSON text. Field names and values are case sensitive, and timestamps are\nepoch milliseconds (UTC).\n"},"defaultContentType":"application/json","servers":{"mainnet":{"host":"ws.predict.fun","protocol":"wss","title":"BNB Mainnet","security":[{"$ref":"#/components/securitySchemes/apiKeyHeader"},{"$ref":"#/components/securitySchemes/apiKeyQuery"}]},"testnet":{"host":"ws-testnet.predict.fun","protocol":"wss","title":"BNB Testnet","security":[{"$ref":"#/components/securitySchemes/apiKeyHeader"},{"$ref":"#/components/securitySchemes/apiKeyQuery"}]}},"channels":{"connection":{"address":"/ws","title":"Connection","messages":{"subscribe":{"$ref":"#/components/messages/subscribe"},"unsubscribe":{"$ref":"#/components/messages/unsubscribe"},"setLanguage":{"$ref":"#/components/messages/setLanguage"},"response":{"$ref":"#/components/messages/response"},"heartbeat":{"$ref":"#/components/messages/heartbeat"},"heartbeatReply":{"$ref":"#/components/messages/heartbeatReply"},"reconnect":{"$ref":"#/components/messages/reconnect"},"orderbook":{"$ref":"#/components/messages/orderbook"},"topOfBook":{"$ref":"#/components/messages/topOfBook"},"tradingStatus":{"$ref":"#/components/messages/tradingStatus"},"marketStatus":{"$ref":"#/components/messages/marketStatus"},"marketChanged":{"$ref":"#/components/messages/marketChanged"},"categoryChanged":{"$ref":"#/components/messages/categoryChanged"},"walletEvent":{"$ref":"#/components/messages/walletEvent"}}}},"operations":{"subscribe":{"action":"receive","channel":{"$ref":"#/channels/connection"},"title":"Subscribe","summary":"Start receiving a topic's messages.","description":"Subscribes to the topic in `params[0]`. The server answers with a response carrying the\nsame `requestId`. For topics that keep a latest value, that value follows right after the\nresponse as a normal message, then live updates. Treat it as best effort: it is absent\nwhen nothing has been cached yet.\n\nSubscribing again to a topic the connection already holds re-acknowledges it.\nSubscriptions do not carry over to a new connection, so subscribe again after\nreconnecting.\n","tags":[{"name":"Requests"}],"messages":[{"$ref":"#/channels/connection/messages/subscribe"}],"reply":{"channel":{"$ref":"#/channels/connection"},"messages":[{"$ref":"#/channels/connection/messages/response"}]}},"unsubscribe":{"action":"receive","channel":{"$ref":"#/channels/connection"},"title":"Unsubscribe","summary":"Stop receiving a topic's messages.","description":"Unsubscribes from the topic in `params[0]`. It succeeds whether or not the connection was\nsubscribed, and fails with `invalid_topic` only when the topic is malformed.\n","tags":[{"name":"Requests"}],"messages":[{"$ref":"#/channels/connection/messages/unsubscribe"}],"reply":{"channel":{"$ref":"#/channels/connection"},"messages":[{"$ref":"#/channels/connection/messages/response"}]}},"setLanguage":{"action":"receive","channel":{"$ref":"#/channels/connection"},"title":"Set language","summary":"Choose the language wallet events are written in.","description":"Sets the language of `details.outcomeName` in wallet events, from the next event on,\nincluding subscriptions that are already running. No other field or topic is translated.\n\nSupported codes: `ar`, `de`, `es`, `fr`, `hi`, `id`, `it`, `ja`, `pl`, `pt` (or `pt-br`),\n`ru`, `th`, `tr`, `uk`, `vi`, `zh-CN` (or `zh`, `zh-hans`) and `zh-Hant` (or `zh-hk`,\n`zh-tw`). English and any other code give the original text, and still succeed.\n","tags":[{"name":"Requests"}],"messages":[{"$ref":"#/channels/connection/messages/setLanguage"}],"reply":{"channel":{"$ref":"#/channels/connection"},"messages":[{"$ref":"#/channels/connection/messages/response"}]}},"heartbeat":{"action":"send","channel":{"$ref":"#/channels/connection"},"title":"Heartbeat","summary":"Answer the server's heartbeat to keep the connection open.","description":"Every 15 seconds the server sends a heartbeat carrying the current time. The first one\narrives about 15 seconds after the connection opens. Echo its `data` back before the next\none. A missing, late or different value closes the connection with code 1000 at the next\nheartbeat. The server does not respond to the echo.\n","tags":[{"name":"Connection"}],"messages":[{"$ref":"#/channels/connection/messages/heartbeat"}],"reply":{"channel":{"$ref":"#/channels/connection"},"messages":[{"$ref":"#/channels/connection/messages/heartbeatReply"}]}},"reconnect":{"action":"send","channel":{"$ref":"#/channels/connection"},"title":"Reconnect notice","summary":"The server is about to close this connection.","description":"Sent before a server shuts down, for example during a rollout. The connection keeps\ndelivering for about `graceMs`, then closes with code 1001 and reason `server draining`.\n\nOn receiving it:\n\n1. Open a new connection and subscribe to every topic again.\n2. Keep reading the old connection until it closes. Both deliver during the overlap, so\n   handle duplicates.\n3. If the new connection is refused, retry right away. The next attempt reaches a server\n   that is not shutting down.\n\nTreat the 1001 close as a reason to reconnect too, in case the notice was missed.\n`graceMs` is approximate, so do not schedule against it. `event` and `reason` may gain\nvalues, and an unknown one also means reconnect soon.\n","tags":[{"name":"Connection"}],"messages":[{"$ref":"#/channels/connection/messages/reconnect"}]},"orderbook":{"action":"send","channel":{"$ref":"#/channels/connection"},"title":"Order book","summary":"`predictOrderbook/{marketId}`: a market's order book, as price levels.","description":"Subscribe with `predictOrderbook/{marketId}`. Each message is the whole book. The latest\nbook is sent on subscribe.\n","tags":[{"name":"Topics"}],"messages":[{"$ref":"#/channels/connection/messages/orderbook"}]},"topOfBook":{"action":"send","channel":{"$ref":"#/channels/connection"},"title":"Top of book","summary":"`predictTopOfBook/{marketId}`: a market's best bid and best ask.","description":"Subscribe with `predictTopOfBook/{marketId}`. Each message holds the best bid, the best ask\nand the last settled order, taken from the market's order book. A message is sent only when\none of them changes, including the quantity at the best price. The latest value is sent on\nsubscribe.\n","tags":[{"name":"Topics"}],"messages":[{"$ref":"#/channels/connection/messages/topOfBook"}]},"tradingStatus":{"action":"send","channel":{"$ref":"#/channels/connection"},"title":"Trading status","summary":"`predictTradingStatus/{marketId}`: whether a market is matching orders.","description":"Subscribe with `predictTradingStatus/{marketId}`. The latest status is sent on subscribe.\n","tags":[{"name":"Topics"}],"messages":[{"$ref":"#/channels/connection/messages/tradingStatus"}]},"marketStatus":{"action":"send","channel":{"$ref":"#/channels/connection"},"title":"Market status","summary":"`predictMarketStatus/{marketId}`: a market's lifecycle status.","description":"Subscribe with `predictMarketStatus/{marketId}`. The latest status is sent on subscribe.\n","tags":[{"name":"Topics"}],"messages":[{"$ref":"#/channels/connection/messages/marketStatus"}]},"marketChanged":{"action":"send","channel":{"$ref":"#/channels/connection"},"title":"Market changed","summary":"`predictMarketChanged/{marketId}`: a market's data changed.","description":"Subscribe with `predictMarketChanged/{marketId}`. Refetch the market, or apply `patch`\nwhen the message carries one. Nothing is sent on subscribe.\n","tags":[{"name":"Topics"}],"messages":[{"$ref":"#/channels/connection/messages/marketChanged"}]},"categoryChanged":{"action":"send","channel":{"$ref":"#/channels/connection"},"title":"Category changed","summary":"`predictCategoryChanged/{categoryId}`: a category's data changed.","description":"Subscribe with `predictCategoryChanged/{categoryId}`. Refetch the category, or apply\n`patch` when the message carries one. Nothing is sent on subscribe.\n","tags":[{"name":"Topics"}],"messages":[{"$ref":"#/channels/connection/messages/categoryChanged"}]},"walletEvents":{"action":"send","channel":{"$ref":"#/channels/connection"},"title":"Wallet events","summary":"`predictWalletEvents/{jwt}`: your orders and trades as they happen.","description":"Subscribe with `predictWalletEvents/{jwt}`, where `jwt` is a wallet JWT from the REST API's\n`POST /auth`. A revoked, invalid or expired JWT is refused with `invalid_credentials`.\nNothing is sent on subscribe.\n","tags":[{"name":"Topics"}],"messages":[{"$ref":"#/channels/connection/messages/walletEvent"}]}},"components":{"securitySchemes":{"apiKeyHeader":{"type":"httpApiKey","name":"x-api-key","in":"header","description":"The API key in the handshake's `x-api-key` header. Use this where you can."},"apiKeyQuery":{"type":"httpApiKey","name":"apiKey","in":"query","description":"The API key as the `apiKey` query parameter, for clients that cannot set headers."}},"messages":{"subscribe":{"name":"subscribe","title":"Subscribe request","payload":{"$ref":"#/components/schemas/SubscribeRequest"},"examples":[{"name":"orderbook","payload":{"method":"subscribe","requestId":1,"params":["predictOrderbook/123"]}}]},"unsubscribe":{"name":"unsubscribe","title":"Unsubscribe request","payload":{"$ref":"#/components/schemas/UnsubscribeRequest"},"examples":[{"name":"orderbook","payload":{"method":"unsubscribe","requestId":2,"params":["predictOrderbook/123"]}}]},"setLanguage":{"name":"setLanguage","title":"Set language request","payload":{"$ref":"#/components/schemas/SetLanguageRequest"},"examples":[{"name":"spanish","payload":{"method":"setLanguage","requestId":3,"params":["es"]}}]},"response":{"name":"response","title":"Response","payload":{"$ref":"#/components/schemas/Response"},"examples":[{"name":"success","payload":{"type":"R","requestId":1,"success":true}},{"name":"unknown topic","payload":{"type":"R","requestId":1,"success":false,"error":{"code":"invalid_topic","message":"unknown topic: predictOrderbok"}}}]},"heartbeat":{"name":"heartbeat","title":"Heartbeat","payload":{"$ref":"#/components/schemas/Heartbeat"},"examples":[{"name":"heartbeat","payload":{"type":"M","topic":"heartbeat","data":1736696400000}}]},"heartbeatReply":{"name":"heartbeatReply","title":"Heartbeat echo","payload":{"$ref":"#/components/schemas/HeartbeatReply"},"examples":[{"name":"echo","payload":{"method":"heartbeat","data":1736696400000}}]},"reconnect":{"name":"reconnect","title":"Reconnect notice","payload":{"$ref":"#/components/schemas/ReconnectNotice"},"examples":[{"name":"shutdown","payload":{"type":"M","topic":"system","data":{"event":"reconnect","reason":"server_shutdown","graceMs":7431}}}]},"orderbook":{"name":"orderbook","title":"Order book","payload":{"$ref":"#/components/schemas/OrderbookMessage"},"examples":[{"name":"book","payload":{"type":"M","topic":"predictOrderbook/123","data":{"version":1,"marketId":123,"updateTimestampMs":1736696400000,"orderCount":42,"asks":[[0.62,1500],[0.63,800]],"bids":[[0.61,2000],[0.6,1200]],"lastOrderSettled":{"id":"987654321","price":"0.62","kind":"LIMIT","marketId":123,"side":"Ask","outcome":"Yes"},"settlementsPending":{"asks":[[0.62,310]],"bids":[]}}}}]},"topOfBook":{"name":"topOfBook","title":"Top of book","payload":{"$ref":"#/components/schemas/TopOfBookMessage"},"examples":[{"name":"quote","payload":{"type":"M","topic":"predictTopOfBook/123","data":{"marketId":123,"bestBid":[0.61,2000],"bestAsk":[0.62,1500],"lastOrderSettled":{"id":"987654321","price":"0.62","kind":"LIMIT","marketId":123,"side":"Ask","outcome":"Yes"}}}}]},"tradingStatus":{"name":"tradingStatus","title":"Trading status","payload":{"$ref":"#/components/schemas/TradingStatusMessage"},"examples":[{"name":"open","payload":{"type":"M","topic":"predictTradingStatus/123","data":{"kind":"tradingStatusUpdate","tsMs":1736696400000,"marketId":123,"tradingStatus":"OPEN"}}}]},"marketStatus":{"name":"marketStatus","title":"Market status","payload":{"$ref":"#/components/schemas/MarketStatusMessage"},"examples":[{"name":"resolved","payload":{"type":"M","topic":"predictMarketStatus/123","data":{"kind":"marketStatusUpdate","tsMs":1736696400000,"marketId":123,"status":"RESOLVED","marketOutcomes":[{"label":"Yes","indexSet":1,"price":"1000000000000000000","onChainId":"4567890123456789012345678901234567890"},{"label":"No","indexSet":2,"price":"0","onChainId":"9876543210987654321098765432109876543"}]}}}]},"marketChanged":{"name":"marketChanged","title":"Market changed","payload":{"$ref":"#/components/schemas/MarketChangedMessage"},"examples":[{"name":"changed","payload":{"type":"M","topic":"predictMarketChanged/123","data":{"kind":"marketChanged","patchKind":null,"tsMs":1736696400000,"marketId":123}}},{"name":"bulletin board update","payload":{"type":"M","topic":"predictMarketChanged/123","data":{"kind":"marketChanged","patchKind":"bulletinBoardUpdate","tsMs":1736696400000,"marketId":123,"patch":{"bulletinBoardUpdate":{"id":17,"marketId":123,"content":"The resolution source has been updated.","createdAt":"2026-01-12T15:40:00.000Z","updatedAt":null}}}}}]},"categoryChanged":{"name":"categoryChanged","title":"Category changed","payload":{"$ref":"#/components/schemas/CategoryChangedMessage"},"examples":[{"name":"changed","payload":{"type":"M","topic":"predictCategoryChanged/45","data":{"kind":"categoryChanged","patchKind":null,"tsMs":1736696400000,"categoryId":45,"slug":"politics"}}},{"name":"volume update","payload":{"type":"M","topic":"predictCategoryChanged/45","data":{"kind":"categoryChanged","patchKind":"volumeUpdate","tsMs":1736696400000,"categoryId":45,"slug":"politics","patch":{"volumeUpdate":{"volumeTotalUsd":125000.5}}}}}]},"walletEvent":{"name":"walletEvent","title":"Wallet event","payload":{"$ref":"#/components/schemas/WalletEventMessage"},"examples":[{"name":"order accepted","payload":{"type":"M","topic":"predictWalletEvents/eyJhbGciOi...","data":{"type":"orderAccepted","orderId":"123456789","orderHash":"0x3f1c...9a2b","walletAddress":"0x8ba1f109551bD432803012645Ac136ddd64DBA72","timestamp":1736696400000,"details":{"marketId":123,"outcomeIndex":1,"marketQuestion":"Will X happen?","outcome":"YES","outcomeName":"Yes","quoteType":"BID","quantity":"100.000","quantityFilled":"0.000","price":"0.620","value":"62.00","valueFilled":"0.00","strategyType":"LIMIT","categorySlug":"politics"}}}}]}},"schemas":{"RequestId":{"type":"integer","format":"int64","description":"A number you choose, echoed on the response so you can match the two. Use a\nnon-negative one: the server answers a frame it cannot read with `-1`.\n"},"Topic":{"type":"string","description":"A topic name and its parameter, such as `predictOrderbook/123`."},"SubscribeRequest":{"type":"object","required":["method","requestId","params"],"properties":{"method":{"type":"string","const":"subscribe"},"requestId":{"$ref":"#/components/schemas/RequestId"},"params":{"type":"array","minItems":1,"description":"The topic to subscribe to. Only the first entry is read.","items":{"$ref":"#/components/schemas/Topic"}}}},"UnsubscribeRequest":{"type":"object","required":["method","requestId","params"],"properties":{"method":{"type":"string","const":"unsubscribe"},"requestId":{"$ref":"#/components/schemas/RequestId"},"params":{"type":"array","description":"The topic to unsubscribe from. Only the first entry is read.","items":{"$ref":"#/components/schemas/Topic"}}}},"SetLanguageRequest":{"type":"object","required":["method","requestId","params"],"properties":{"method":{"type":"string","const":"setLanguage"},"requestId":{"$ref":"#/components/schemas/RequestId"},"params":{"type":"array","minItems":1,"description":"The language code. Only the first entry is read.","items":{"type":"string"}}}},"HeartbeatReply":{"type":"object","required":["method","data"],"properties":{"method":{"type":"string","const":"heartbeat"},"data":{"type":"integer","format":"int64","description":"The `data` of the latest heartbeat, unchanged."}}},"Response":{"type":"object","description":"The answer to a subscribe, unsubscribe or setLanguage request. A frame the server cannot\nread (invalid JSON, an unknown `method`, or a missing `requestId` or `params`) is\nanswered with `requestId` `-1` and the error `invalid_json`. A frame over 8 KiB closes\nthe connection.\n","required":["type","requestId","success"],"properties":{"type":{"type":"string","const":"R"},"requestId":{"$ref":"#/components/schemas/RequestId"},"success":{"type":"boolean"},"error":{"$ref":"#/components/schemas/Error"}}},"Error":{"type":"object","description":"Present only when `success` is `false`.","required":["code"],"properties":{"code":{"type":"string","enum":["invalid_json","invalid_topic","invalid_params","invalid_credentials","internal_server_error"],"description":"- `invalid_json`: the frame could not be read as a request.\n- `invalid_topic`: the topic is missing, unknown or has an invalid parameter.\n- `invalid_params`: setLanguage without a language code.\n- `invalid_credentials`: the wallet JWT is invalid, expired or revoked.\n- `internal_server_error`: the server failed to check the request.\n"},"message":{"type":"string","description":"What was wrong. Absent for `invalid_json`."}}},"Heartbeat":{"type":"object","required":["type","topic","data"],"properties":{"type":{"type":"string","const":"M"},"topic":{"type":"string","const":"heartbeat"},"data":{"type":"integer","format":"int64","description":"The server time, to echo back."}}},"ReconnectNotice":{"type":"object","required":["type","topic","data"],"properties":{"type":{"type":"string","const":"M"},"topic":{"type":"string","const":"system","description":"Reserved. It cannot be subscribed to, and its messages arrive unasked."},"data":{"type":"object","required":["event","reason","graceMs"],"properties":{"event":{"type":"string","description":"`reconnect`. Treat an unknown value as reconnect soon."},"reason":{"type":"string","description":"`server_shutdown`. Treat an unknown value as reconnect soon."},"graceMs":{"type":"integer","description":"Roughly how long the connection keeps delivering before it closes."}}}}},"TopicMessage":{"type":"object","required":["type","topic","data"],"properties":{"type":{"type":"string","const":"M"},"topic":{"type":"string","description":"The topic string the subscription was made with."}}},"OrderbookMessage":{"allOf":[{"$ref":"#/components/schemas/TopicMessage"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Orderbook"}}}]},"Orderbook":{"type":"object","required":["version","marketId","updateTimestampMs","orderCount","asks","bids","lastOrderSettled","settlementsPending"],"properties":{"version":{"type":"integer","const":1},"marketId":{"type":"integer","format":"int64"},"updateTimestampMs":{"type":"integer","format":"int64"},"orderCount":{"type":"integer"},"asks":{"type":"array","description":"Ask levels, lowest price first.","items":{"$ref":"#/components/schemas/PriceLevel"}},"bids":{"type":"array","description":"Bid levels, highest price first.","items":{"$ref":"#/components/schemas/PriceLevel"}},"lastOrderSettled":{"description":"The latest settled order, or `null` before the first settlement.","oneOf":[{"type":"null"},{"$ref":"#/components/schemas/SettledOrder"}]},"settlementsPending":{"type":"object","description":"The orders whose settlement is in flight, per price. `asks` holds the resting asks\nand `bids` the resting bids, with prices on the YES scale, so an ask for NO appears\nunder `asks` at its YES price.\n","required":["asks","bids"],"properties":{"asks":{"type":"array","items":{"$ref":"#/components/schemas/PendingSettlementLevel"}},"bids":{"type":"array","items":{"$ref":"#/components/schemas/PendingSettlementLevel"}}}}}},"TopOfBookMessage":{"allOf":[{"$ref":"#/components/schemas/TopicMessage"},{"type":"object","properties":{"data":{"$ref":"#/components/schemas/TopOfBook"}}}]},"TopOfBook":{"type":"object","description":"The first level on each side of the market's order book. It has no timestamp, because a\nmessage is only sent on a change. To know how fresh the book is, read the order book.\n","required":["marketId","bestBid","bestAsk","lastOrderSettled"],"properties":{"marketId":{"type":"integer","format":"int64"},"bestBid":{"description":"The highest bid, or `null` when there are no bids.","oneOf":[{"type":"null"},{"$ref":"#/components/schemas/PriceLevel"}]},"bestAsk":{"description":"The lowest ask, or `null` when there are no asks.","oneOf":[{"type":"null"},{"$ref":"#/components/schemas/PriceLevel"}]},"lastOrderSettled":{"description":"The latest settled order, or `null` before the first settlement.","oneOf":[{"type":"null"},{"$ref":"#/components/schemas/SettledOrder"}]}}},"PriceLevel":{"type":"array","description":"`[price, quantity]`. The price is the YES price between 0 and 1, the quantity is in shares.","minItems":2,"maxItems":2,"items":{"type":"number"}},"PendingSettlementLevel":{"type":"array","description":"`[price, value]`. The price is the YES price between 0 and 1. The value is in USDT: the\nshares being settled at that price, multiplied by the price.\n","minItems":2,"maxItems":2,"items":{"type":"number"}},"SettledOrder":{"type":"object","required":["id","price","kind","side","outcome","marketId"],"properties":{"id":{"type":"string"},"price":{"type":"string","description":"The YES price, with 2 decimals."},"kind":{"type":"string","enum":["LIMIT","MARKET"],"description":"The order's strategy."},"side":{"type":"string","enum":["Ask","Bid"]},"outcome":{"type":"string","enum":["Yes","No"]},"marketId":{"type":"integer","format":"int64"}}},"TradingStatusMessage":{"allOf":[{"$ref":"#/components/schemas/TopicMessage"},{"type":"object","properties":{"data":{"type":"object","required":["kind","tsMs","marketId","tradingStatus"],"properties":{"kind":{"type":"string","const":"tradingStatusUpdate"},"tsMs":{"type":"integer","format":"int64"},"marketId":{"type":"integer","format":"int64"},"tradingStatus":{"type":"string","enum":["OPEN","MATCHING_NOT_ENABLED","CANCEL_ONLY","CLOSED"]}}}}}]},"MarketStatusMessage":{"allOf":[{"$ref":"#/components/schemas/TopicMessage"},{"type":"object","properties":{"data":{"type":"object","required":["kind","tsMs","marketId","status"],"properties":{"kind":{"type":"string","const":"marketStatusUpdate"},"tsMs":{"type":"integer","format":"int64"},"marketId":{"type":"integer","format":"int64"},"status":{"type":"string","enum":["REGISTERED","PRICE_DISPUTED","RESOLVED"]},"marketOutcomes":{"type":"array","description":"Each outcome's final price. Sent with `RESOLVED`.","items":{"$ref":"#/components/schemas/ResolvedOutcome"}}}}}}]},"ResolvedOutcome":{"type":"object","required":["label","indexSet","price","onChainId"],"properties":{"label":{"type":"string"},"indexSet":{"type":"integer"},"price":{"type":"string","description":"The price in wei, where `1000000000000000000` is 1.","enum":["0","500000000000000000","1000000000000000000"]},"onChainId":{"type":"string","description":"The outcome's on-chain token ID, in decimal."}}},"MarketChangedMessage":{"allOf":[{"$ref":"#/components/schemas/TopicMessage"},{"type":"object","properties":{"data":{"type":"object","required":["kind","patchKind","tsMs","marketId"],"properties":{"kind":{"type":"string","const":"marketChanged"},"patchKind":{"description":"What changed. `null` for a general change. `marketRewards` comes without a\n`patch`. The other values come with one.\n","oneOf":[{"type":"null"},{"type":"string","enum":["marketRewards","translationUpdate","bulletinBoardUpdate","cryptoUpDownVariantData"]}]},"tsMs":{"type":"integer","format":"int64"},"marketId":{"type":"integer","format":"int64"},"patch":{"description":"The changed data, keyed by what it is.","oneOf":[{"$ref":"#/components/schemas/TranslationPatch"},{"type":"object","title":"bulletinBoardUpdate","required":["bulletinBoardUpdate"],"properties":{"bulletinBoardUpdate":{"type":"object","required":["id","marketId","content","createdAt","updatedAt"],"properties":{"id":{"type":"integer"},"marketId":{"type":"integer","format":"int64"},"content":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"oneOf":[{"type":"null"},{"type":"string","format":"date-time"}]}}}}},{"type":"object","title":"cryptoUpDownVariantData","required":["variantData"],"properties":{"variantData":{"type":"object","description":"The price feed of an up-or-down crypto market.","required":["priceFeedProvider","startPrice","endPrice","priceFeedId","priceFeedSymbol"],"properties":{"priceFeedProvider":{"type":"string","enum":["BINANCE","CHAINLINK","ATLAS"]},"startPrice":{"type":["number","null"]},"endPrice":{"type":["number","null"]},"priceFeedId":{"type":["string","null"],"description":"`null` for Binance, a hex feed ID otherwise."},"priceFeedSymbol":{"type":["string","null"]}}}}}]}}}}}]},"TranslationPatch":{"type":"object","title":"translationUpdate","required":["translationUpdate"],"properties":{"translationUpdate":{"type":"object","description":"A translation changed. Refetch the text in that language.","required":["languageCode","field"],"properties":{"languageCode":{"type":"string"},"field":{"type":"string"}}}}},"CategoryChangedMessage":{"allOf":[{"$ref":"#/components/schemas/TopicMessage"},{"type":"object","properties":{"data":{"oneOf":[{"type":"object","title":"Change","required":["kind","patchKind","tsMs","categoryId","slug"],"properties":{"kind":{"type":"string","const":"categoryChanged"},"patchKind":{"description":"What changed, `null` for a general change.","oneOf":[{"type":"null"},{"type":"string","enum":["translationUpdate","volumeUpdate","tradingSessionUpdate"]}]},"tsMs":{"type":"integer","format":"int64"},"categoryId":{"type":"integer","format":"int64"},"slug":{"type":"string"},"patch":{"description":"The changed data, keyed by what it is.","oneOf":[{"$ref":"#/components/schemas/TranslationPatch"},{"type":"object","title":"volumeUpdate","required":["volumeUpdate"],"properties":{"volumeUpdate":{"type":"object","required":["volumeTotalUsd"],"properties":{"volumeTotalUsd":{"type":"number"}}}}},{"type":"object","title":"tradingSessionUpdate","required":["tradingSessionUpdate"],"properties":{"tradingSessionUpdate":{"type":"object","required":["tradingSession"],"properties":{"tradingSession":{"description":"The current trading session, or `null` outside one.","oneOf":[{"type":"null"},{"type":"object","required":["opensAt","closesAt"],"properties":{"opensAt":{"type":"string","format":"date-time"},"closesAt":{"type":"string","format":"date-time"}}}]}}}}}]}}},{"type":"object","title":"Notice","description":"A change with no detail. Refetch the category.","required":["categoryId","tsMs"],"properties":{"categoryId":{"type":"integer","format":"int64"},"tsMs":{"type":"integer","format":"int64"}}}]}}}]},"WalletEventMessage":{"allOf":[{"$ref":"#/components/schemas/TopicMessage"},{"type":"object","properties":{"data":{"oneOf":[{"$ref":"#/components/schemas/OrderAccepted"},{"$ref":"#/components/schemas/OrderNotAccepted"},{"$ref":"#/components/schemas/OrderMarketMatchPlan"},{"$ref":"#/components/schemas/OrderExpired"},{"$ref":"#/components/schemas/OrderCancelled"},{"$ref":"#/components/schemas/OrderTransactionSubmitted"},{"$ref":"#/components/schemas/OrderTransactionSuccess"},{"$ref":"#/components/schemas/OrderTransactionFailed"}]}}}]},"WalletEvent":{"type":"object","description":"The fields every wallet event has.","required":["type","orderId","orderHash","timestamp","details"],"properties":{"type":{"type":"string"},"orderId":{"type":"string"},"orderHash":{"type":"string"},"walletAddress":{"type":"string","description":"The wallet's checksummed address. Absent when it could not be looked up."},"timestamp":{"type":"integer","format":"int64"},"details":{"$ref":"#/components/schemas/OrderDetails"}}},"OrderDetails":{"type":"object","required":["marketId","outcomeIndex","quoteType","quantity","quantityFilled","price","value","valueFilled","marketQuestion","categorySlug","strategyType","outcome","outcomeName"],"properties":{"marketId":{"type":"integer","format":"int64"},"outcomeIndex":{"type":"integer","description":"The outcome's index set, `1` or `2` in a binary market."},"quoteType":{"type":"string","enum":["BID","ASK"]},"quantity":{"type":"string","description":"Shares, with 3 decimals."},"quantityFilled":{"type":"string","description":"Shares, with 3 decimals."},"price":{"type":"string","description":"With 3 decimals."},"value":{"type":"string","description":"With 2 decimals."},"valueFilled":{"type":"string","description":"With 2 decimals."},"marketQuestion":{"type":"string"},"categorySlug":{"type":"string"},"strategyType":{"type":"string","enum":["MARKET","LIMIT"]},"outcome":{"type":"string","enum":["YES","NO"]},"outcomeName":{"type":"string","description":"The outcome's name, in the language chosen with setLanguage."}}},"Fill":{"type":"object","required":["executedPriceWei","executedSizeWei","executedValueWei"],"properties":{"executedPriceWei":{"type":"string"},"executedSizeWei":{"type":"string"},"executedValueWei":{"type":"string","description":"The price times the size, divided by 1e18."}}},"OrderAccepted":{"title":"orderAccepted","description":"The order was placed in the book.","allOf":[{"$ref":"#/components/schemas/WalletEvent"},{"type":"object","properties":{"type":{"const":"orderAccepted"}}}]},"OrderNotAccepted":{"title":"orderNotAccepted","description":"The order was rejected.","allOf":[{"$ref":"#/components/schemas/WalletEvent"},{"type":"object","required":["reason"],"properties":{"type":{"const":"orderNotAccepted"},"reason":{"type":"string","enum":["noMarketMatch","rejectedDuplicate","rejectedPostOnly"]},"settlementId":{"description":"Sent with `noMarketMatch`: the settlement that failed, or `null` when nothing\nmatched.\n","type":["string","null"]}}}]},"OrderMarketMatchPlan":{"title":"orderMarketMatchPlan","description":"How a market order is going to be filled.","allOf":[{"$ref":"#/components/schemas/WalletEvent"},{"type":"object","required":["amount","amountFilled","plannedFill","remainderCancelled","settlementIds"],"properties":{"type":{"const":"orderMarketMatchPlan"},"amount":{"type":"string","description":"In wei."},"amountFilled":{"type":"string","description":"In wei."},"plannedFill":{"type":"string","description":"In wei."},"remainderCancelled":{"type":"string","description":"In wei."},"settlementIds":{"type":"array","items":{"type":"string"}}}}]},"OrderExpired":{"title":"orderExpired","description":"The order reached its end time.","allOf":[{"$ref":"#/components/schemas/WalletEvent"},{"type":"object","properties":{"type":{"const":"orderExpired"}}}]},"OrderCancelled":{"title":"orderCancelled","description":"The order was cancelled.","allOf":[{"$ref":"#/components/schemas/WalletEvent"},{"type":"object","properties":{"type":{"const":"orderCancelled"},"reason":{"type":"string","const":"selfTradePrevention","description":"Present when self-trade prevention cancelled the order."}}}]},"OrderTransactionSubmitted":{"title":"orderTransactionSubmitted","description":"The order matched and its settlement was submitted on-chain. When two of the wallet's own\norders trade with each other, each one gets an event, one as taker and one as maker.\n","allOf":[{"$ref":"#/components/schemas/WalletEvent"},{"type":"object","required":["settlementId","kind","isMaker","fill"],"properties":{"type":{"const":"orderTransactionSubmitted"},"settlementId":{"type":"string"},"kind":{"type":"string","enum":["PURCHASE","SALE"]},"isMaker":{"type":"boolean"},"fill":{"$ref":"#/components/schemas/Fill"}}}]},"OrderTransactionSuccess":{"title":"orderTransactionSuccess","description":"The settlement succeeded on-chain.","allOf":[{"$ref":"#/components/schemas/WalletEvent"},{"type":"object","required":["settlementId","fill"],"properties":{"type":{"const":"orderTransactionSuccess"},"settlementId":{"type":"string"},"fill":{"$ref":"#/components/schemas/Fill"},"isMaker":{"type":"boolean"},"fee":{"type":"object","required":["amountWei","type"],"properties":{"amountWei":{"type":"string"},"type":{"type":"string","enum":["COLLATERAL","SHARES"]}}}}}]},"OrderTransactionFailed":{"title":"orderTransactionFailed","description":"The settlement failed on-chain.","allOf":[{"$ref":"#/components/schemas/WalletEvent"},{"type":"object","required":["settlementId","fill"],"properties":{"type":{"const":"orderTransactionFailed"},"settlementId":{"type":"string"},"fill":{"$ref":"#/components/schemas/Fill"}}}]}}}}