diff --git a/README.md b/README.md index 438a1b25..f65fc5e9 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ Hints: - [x] [correlation-id-asyncapi.yml](https://github.com/asyncapi/spec/blob/master/examples/correlation-id-asyncapi.yml) - [x] [gitter-streaming-asyncapi.yml](https://github.com/asyncapi/spec/blob/master/examples/gitter-streaming-asyncapi.yml) - [x] [kraken-websocket-request-reply-message-filter-in-reply-asyncapi.yml](https://github.com/asyncapi/spec/blob/master/examples/kraken-websocket-request-reply-message-filter-in-reply-asyncapi.yml) -- [ ] [kraken-websocket-request-reply-multiple-channels-asyncapi.yml](https://github.com/asyncapi/spec/blob/master/examples/kraken-websocket-request-reply-multiple-channels-asyncapi.yml) +- [x] [kraken-websocket-request-reply-multiple-channels-asyncapi.yml](https://github.com/asyncapi/spec/blob/master/examples/kraken-websocket-request-reply-multiple-channels-asyncapi.yml) - [x] [mercure-asyncapi.yml](https://github.com/asyncapi/spec/blob/master/examples/mercure-asyncapi.yml) - [x] [not-asyncapi.yml](https://github.com/asyncapi/spec/blob/master/examples/not-asyncapi.yml) - [x] [oneof-asyncapi.yml](https://github.com/asyncapi/spec/blob/master/examples/oneof-asyncapi.yml) diff --git a/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI.kt b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI.kt new file mode 100644 index 00000000..72d8c433 --- /dev/null +++ b/asyncapi-core/src/test/kotlin/com/asyncapi/examples/v3/_0_0/KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI.kt @@ -0,0 +1,561 @@ +package com.asyncapi.examples.v3._0_0 + +import com.asyncapi.v3.Reference +import com.asyncapi.v3._0_0.model.channel.Channel +import com.asyncapi.v3._0_0.model.channel.message.CorrelationId +import com.asyncapi.v3._0_0.model.channel.message.Message +import com.asyncapi.v3._0_0.model.channel.message.MessageExample +import com.asyncapi.v3._0_0.model.component.Components +import com.asyncapi.v3._0_0.model.info.Info +import com.asyncapi.v3._0_0.model.operation.Operation +import com.asyncapi.v3._0_0.model.operation.OperationAction +import com.asyncapi.v3._0_0.model.operation.reply.OperationReply +import com.asyncapi.v3.schema.Schema + +class KrakenWebsocketRequestReplyMultipleChannelsAsyncAPI: AbstractExampleValidationTest() { + + override fun specificationLocation(): String = "/examples/v3.0.0/kraken-websocket-request-reply-multiple-channels-asyncapi.yml" + + override fun expectedInfo(): Info { + return Info.builder() + .title("Kraken Websockets API") + .version("1.8.0") + .description( + "WebSockets API offers real-time market data updates. WebSockets is a bidirectional protocol offering fastest real-time data, helping you build real-time applications. The public message types presented below do not require authentication. Private-data messages can be subscribed on a separate authenticated endpoint. \n" + + "\n" + + "### General Considerations\n" + + "\n" + + "- TLS with SNI (Server Name Indication) is required in order to establish a Kraken WebSockets API connection. See Cloudflare's [What is SNI?](https://www.cloudflare.com/learning/ssl/what-is-sni/) guide for more details.\n" + + "- All messages sent and received via WebSockets are encoded in JSON format\n" + + "- All decimal fields (including timestamps) are quoted to preserve precision.\n" + + "- Timestamps should not be considered unique and not be considered as aliases for transaction IDs. Also, the granularity of timestamps is not representative of transaction rates.\n" + + "- At least one private message should be subscribed to keep the authenticated client connection open.\n" + + "- Please use REST API endpoint [AssetPairs](https://www.kraken.com/features/api#get-tradable-pairs) to fetch the list of pairs which can be subscribed via WebSockets API. For example, field 'wsname' gives the supported pairs name which can be used to subscribe.\n" + + "- Cloudflare imposes a connection/re-connection rate limit (per IP address) of approximately 150 attempts per rolling 10 minutes. If this is exceeded, the IP is banned for 10 minutes.\n" + + "- Recommended reconnection behaviour is to (1) attempt reconnection instantly up to a handful of times if the websocket is dropped randomly during normal operation but (2) after maintenance or extended downtime, attempt to reconnect no more quickly than once every 5 seconds. There is no advantage to reconnecting more rapidly after maintenance during cancel_only mode.\n" + ) + .build() + } + + override fun expectedServers(): Map = emptyMap() + + override fun expectedChannels(): Map { + return mapOf( + Pair("ping", + Channel.builder() + .address("/") + .messages(mapOf( + Pair("ping", Reference("#/components/messages/ping")), + )) + .build() + ), + Pair("pong", + Channel.builder() + .address("/") + .messages(mapOf( + Pair("pong", Reference("#/components/messages/pong")), + )) + .build() + ), + Pair("heartbeat", + Channel.builder() + .address("/") + .messages(mapOf( + Pair("heartbeat", Reference("#/components/messages/heartbeat")), + )) + .build() + ), + Pair("systemStatus", + Channel.builder() + .address("/") + .messages(mapOf( + Pair("systemStatus", Reference("#/components/messages/systemStatus")), + )) + .build() + ), + Pair("currencyInfo", + Channel.builder() + .address("/") + .messages(mapOf( + Pair("subscriptionStatus", Reference("#/components/messages/subscriptionStatus")), + Pair("dummyCurrencyInfo", Reference("#/components/messages/dummyCurrencyInfo")), + )) + .build() + ), + Pair("subscribe", + Channel.builder() + .address("/") + .messages(mapOf( + Pair("subscribe", Reference("#/components/messages/subscribe")), + )) + .build() + ), + Pair("unsubscribe", + Channel.builder() + .address("/") + .messages(mapOf( + Pair("unsubscribe", Reference("#/components/messages/unsubscribe")), + )) + .build() + ) + ) + } + + override fun expectedOperations(): Map { + return mapOf( + Pair("receivePing", Operation.builder() + .action(OperationAction.RECEIVE) + .channel(Reference("#/channels/ping")) + .reply(OperationReply( + null, + Reference("#/channels/pong"), + null + )) + .build() + ), + Pair("heartbeat", Operation.builder() + .action(OperationAction.SEND) + .channel(Reference("#/channels/heartbeat")) + .build() + ), + Pair("systemStatus", Operation.builder() + .action(OperationAction.SEND) + .channel(Reference("#/channels/systemStatus")) + .build() + ), + Pair("subscribe", Operation.builder() + .action(OperationAction.RECEIVE) + .channel(Reference("#/channels/subscribe")) + .reply(OperationReply( + null, + Reference("#/channels/currencyInfo"), + null + )) + .build() + ), + Pair("unsubscribe", Operation.builder() + .action(OperationAction.RECEIVE) + .channel(Reference("#/channels/unsubscribe")) + .reply(OperationReply( + null, + Reference("#/channels/currencyInfo"), + listOf(Reference("#/channels/currencyInfo/messages/subscriptionStatus")) + )) + .build() + ), + ) + } + + override fun expectedComponents(): Components? { + return Components.builder() + .messages(mapOf( + Pair("dummyCurrencyInfo", Message.builder() + .summary("Dummy message with no real life details") + .description("It is here in this example to showcase that there is an additional message that normally is of a complex structure. It represents actually currency exchange value to show a reply to operation receiveSubscribeRequest with more than one possible message.") + .payload(Schema.builder() + .type("object") + .properties(mapOf( + Pair("event", Schema.builder() + .type("string") + .constValue("currencyInfo") + .build() + ), + Pair("reqid", Schema.builder() + .ref("#/components/schemas/reqid") + .build() + ), + Pair("data", Schema.builder() + .type("object") + .build() + ), + )) + .required(listOf("event")) + .build() + ) + .correlationId(CorrelationId(null, "\$message.payload#/reqid")) + .build() + ), + Pair("ping", Message.builder() + .summary("Ping server to determine whether connection is alive") + .description("Client can ping server to determine whether connection is alive, server responds with pong. This is an application level ping as opposed to default ping in websockets standard which is server initiated") + .payload(Reference("#/components/schemas/ping")) + .correlationId(CorrelationId(null, "\$message.payload#/reqid")) + .build() + ), + Pair("pong", Message.builder() + .summary("Pong is a response to ping message") + .description("Server pong response to a ping to determine whether connection is alive. This is an application level pong as opposed to default pong in websockets standard which is sent by client in response to a ping") + .payload(Reference("#/components/schemas/pong")) + .correlationId(CorrelationId(null, "\$message.payload#/reqid")) + .build() + ), + Pair("subscribe", Message.builder() + .description("Subscribe to a topic on a single or multiple currency pairs.") + .payload(Reference("#/components/schemas/subscribe")) + .correlationId(CorrelationId(null, "\$message.payload#/reqid")) + .build() + ), + Pair("unsubscribe", Message.builder() + .description("Unsubscribe, can specify a channelID or multiple currency pairs.") + .payload(Reference("#/components/schemas/unsubscribe")) + .correlationId(CorrelationId(null, "\$message.payload#/reqid")) + .build() + ), + Pair("subscriptionStatus", Message.builder() + .description("Subscription status response to subscribe, unsubscribe or exchange initiated unsubscribe.") + .payload(Reference("#/components/schemas/subscriptionStatus")) + .examples(listOf( + MessageExample.builder() + .payload(mapOf( + Pair("channelID", 10001), + Pair("channelName", "ohlc-5"), + Pair("event", "subscriptionStatus"), + Pair("pair", "XBT/EUR"), + Pair("reqid", 42), + Pair("status", "unsubscribed"), + Pair("subscription", mapOf( + Pair("interval", 5), + Pair("name", "ohlc") + )), + )) + .build(), + MessageExample.builder() + .payload(mapOf( + Pair("errorMessage", "Subscription depth not supported"), + Pair("event", "subscriptionStatus"), + Pair("pair", "XBT/USD"), + Pair("status", "error"), + Pair("subscription", mapOf( + Pair("depth", 42), + Pair("name", "book") + )), + )) + .build() + )) + .build() + ), + Pair("systemStatus", Message.builder() + .description("Status sent on connection or system status changes.") + .payload(Reference("#/components/schemas/systemStatus")) + .build() + ), + Pair("heartbeat", Message.builder() + .description("Server heartbeat sent if no subscription traffic within 1 second (approximately)") + .payload(Reference("#/components/schemas/heartbeat")) + .build() + ), + )) + .schemas(mapOf( + Pair("ping", Schema.builder() + .type("object") + .properties(mapOf( + Pair("event", Schema.builder() + .type("string") + .constValue("ping") + .build() + ), + Pair("reqid", Schema.builder() + .ref("#/components/schemas/reqid") + .build() + ) + )) + .required(listOf("event")) + .build() + ), + Pair("heartbeat", Schema.builder() + .type("object") + .properties(mapOf( + Pair("event", Schema.builder() + .type("string") + .constValue("heartbeat") + .build() + ) + )) + .build() + ), + Pair("pong", Schema.builder() + .type("object") + .properties(mapOf( + Pair("event", Schema.builder() + .type("string") + .constValue("pong") + .build() + ), + Pair("reqid", Schema.builder() + .ref("#/components/schemas/reqid") + .build() + ) + )) + .build() + ), + Pair("systemStatus", Schema.builder() + .type("object") + .properties(mapOf( + Pair("event", Schema.builder() + .type("string") + .constValue("systemStatus") + .build() + ), + Pair("connectionID", Schema.builder() + .type("integer") + .description("The ID of the connection") + .build() + ), + Pair("status", Schema.builder() + .ref("#/components/schemas/status") + .build() + ), + Pair("version", Schema.builder() + .type("string") + .build() + ) + )) + .build() + ), + Pair("status", Schema.builder() + .type("string") + .enumValue(listOf( + "online", "maintenance", "cancel_only", "limit_only", "post_only" + )) + .build() + ), + Pair("subscribe", Schema.builder() + .type("object") + .properties(mapOf( + Pair("event", Schema.builder() + .type("string") + .constValue("subscribe") + .build() + ), + Pair("reqid", Schema.builder() + .ref("#/components/schemas/reqid") + .build() + ), + Pair("pair", Schema.builder() + .ref("#/components/schemas/pair") + .build() + ), + Pair("subscription", Schema.builder() + .type("object") + .properties(mapOf( + Pair("depth", Schema.builder() + .ref("#/components/schemas/depth") + .build() + ), + Pair("interval", Schema.builder() + .ref("#/components/schemas/interval") + .build() + ), + Pair("name", Schema.builder() + .ref("#/components/schemas/name") + .build() + ), + Pair("ratecounter", Schema.builder() + .ref("#/components/schemas/ratecounter") + .build() + ), + Pair("snapshot", Schema.builder() + .ref("#/components/schemas/snapshot") + .build() + ), + Pair("token", Schema.builder() + .ref("#/components/schemas/token") + .build() + ) + )) + .required(listOf("name")) + .build() + ) + )) + .required(listOf("event")) + .build() + ), + Pair("unsubscribe", Schema.builder() + .type("object") + .properties(mapOf( + Pair("event", Schema.builder() + .type("string") + .constValue("unsubscribe") + .build() + ), + Pair("reqid", Schema.builder() + .ref("#/components/schemas/reqid") + .build() + ), + Pair("pair", Schema.builder() + .ref("#/components/schemas/pair") + .build() + ), + Pair("subscription", Schema.builder() + .type("object") + .properties(mapOf( + Pair("depth", Schema.builder() + .ref("#/components/schemas/depth") + .build() + ), + Pair("interval", Schema.builder() + .ref("#/components/schemas/interval") + .build() + ), + Pair("name", Schema.builder() + .ref("#/components/schemas/name") + .build() + ), + Pair("token", Schema.builder() + .ref("#/components/schemas/token") + .build() + ) + )) + .required(listOf("name")) + .build() + ) + )) + .required(listOf("event")) + .build() + ), + Pair("subscriptionStatus", Schema.builder() + .type("object") + .oneOf(listOf( + Schema.builder().ref("#/components/schemas/subscriptionStatusError").build(), + Schema.builder().ref("#/components/schemas/subscriptionStatusSuccess").build() + )) + .build() + ), + Pair("subscriptionStatusError", Schema.builder() + .allOf(listOf( + Schema.builder() + .properties(mapOf( + Pair("errorMessage", Schema.builder().type("string").build()) + )) + .required(listOf("errorMessage")) + .build(), + Schema.builder().ref("#/components/schemas/subscriptionStatusCommon").build() + )) + .build() + ), + Pair("subscriptionStatusSuccess", Schema.builder() + .allOf(listOf( + Schema.builder() + .properties(mapOf( + Pair("channelID", Schema.builder() + .type("integer") + .description("ChannelID on successful subscription, applicable to public messages only.") + .build() + ), + Pair("channelName", Schema.builder() + .type("string") + .description("Channel Name on successful subscription. For payloads 'ohlc' and 'book', respective interval or depth will be added as suffix.") + .build() + ) + )) + .required(listOf("channelID", "channelName")) + .build(), + Schema.builder().ref("#/components/schemas/subscriptionStatusCommon").build() + )) + .build() + ), + Pair("subscriptionStatusCommon", Schema.builder() + .type("object") + .required(listOf("event")) + .properties(mapOf( + Pair("event", Schema.builder() + .type("string") + .constValue("subscriptionStatus") + .build() + ), + Pair("reqid", Schema.builder() + .ref("#/components/schemas/reqid") + .build() + ), + Pair("pair", Schema.builder() + .ref("#/components/schemas/pair") + .build() + ), + Pair("status", Schema.builder() + .ref("#/components/schemas/status") + .build() + ), + Pair("subscription", Schema.builder() + .type("object") + .required(listOf("name")) + .properties(mapOf( + Pair("depth", Schema.builder().ref("#/components/schemas/depth").build()), + Pair("interval", Schema.builder().ref("#/components/schemas/interval").build()), + Pair("maxratecount", Schema.builder().ref("#/components/schemas/maxratecount").build()), + Pair("name", Schema.builder().ref("#/components/schemas/name").build()), + Pair("token", Schema.builder().ref("#/components/schemas/token").build()), + )) + .build() + ) + )) + .build() + ), + Pair("interval", Schema.builder() + .type("integer") + .description("Time interval associated with ohlc subscription in minutes.") + .defaultValue(1) + .enumValue(listOf( + 1, 5, 15, 30, 60, 240, 1440, 10080, 21600 + )) + .build() + ), + Pair("name", Schema.builder() + .type("string") + .description("The name of the channel you subscribe too.") + .enumValue(listOf( + "book", "ohlc", "openOrders", "ownTrades", "spread", "ticker", "trade" + )) + .build() + ), + Pair("token", Schema.builder() + .type("string") + .description("base64-encoded authentication token for private-data endpoints.") + .build() + ), + Pair("depth", Schema.builder() + .type("integer") + .defaultValue(10) + .description("Depth associated with book subscription in number of levels each side.") + .enumValue(listOf( + 10, 25, 100, 500, 1000 + )) + .build() + ), + Pair("maxratecount", Schema.builder() + .type("integer") + .description("Max rate-limit budget. Compare to the ratecounter field in the openOrders updates to check whether you are approaching the rate limit.") + .build() + ), + Pair("ratecounter", Schema.builder() + .type("boolean") + .defaultValue(false) + .description("Whether to send rate-limit counter in updates (supported only for openOrders subscriptions)") + .build() + ), + Pair("snapshot", Schema.builder() + .type("boolean") + .defaultValue(true) + .description("Whether to send historical feed data snapshot upon subscription (supported only for ownTrades subscriptions)") + .build() + ), + Pair("reqid", Schema.builder() + .type("integer") + .description("client originated ID reflected in response message.") + .build() + ), + Pair("pair", Schema.builder() + .type("array") + .description("Array of currency pairs.") + .items(Schema.builder() + .type("string") + .description("Format of each pair is \"A/B\", where A and B are ISO 4217-A3 for standardized assets and popular unique symbol if not standardized.") + .pattern("[A-Z\\s]+\\/[A-Z\\s]+") + .build() + ) + .build() + ), + )) + .build() + } + +} \ No newline at end of file diff --git a/asyncapi-core/src/test/resources/examples/v3.0.0/kraken-websocket-request-reply-multiple-channels-asyncapi.yml b/asyncapi-core/src/test/resources/examples/v3.0.0/kraken-websocket-request-reply-multiple-channels-asyncapi.yml new file mode 100644 index 00000000..d3c1c257 --- /dev/null +++ b/asyncapi-core/src/test/resources/examples/v3.0.0/kraken-websocket-request-reply-multiple-channels-asyncapi.yml @@ -0,0 +1,394 @@ +asyncapi: 3.0.0 + +info: + title: Kraken Websockets API + version: '1.8.0' + description: | + WebSockets API offers real-time market data updates. WebSockets is a bidirectional protocol offering fastest real-time data, helping you build real-time applications. The public message types presented below do not require authentication. Private-data messages can be subscribed on a separate authenticated endpoint. + + ### General Considerations + + - TLS with SNI (Server Name Indication) is required in order to establish a Kraken WebSockets API connection. See Cloudflare's [What is SNI?](https://www.cloudflare.com/learning/ssl/what-is-sni/) guide for more details. + - All messages sent and received via WebSockets are encoded in JSON format + - All decimal fields (including timestamps) are quoted to preserve precision. + - Timestamps should not be considered unique and not be considered as aliases for transaction IDs. Also, the granularity of timestamps is not representative of transaction rates. + - At least one private message should be subscribed to keep the authenticated client connection open. + - Please use REST API endpoint [AssetPairs](https://www.kraken.com/features/api#get-tradable-pairs) to fetch the list of pairs which can be subscribed via WebSockets API. For example, field 'wsname' gives the supported pairs name which can be used to subscribe. + - Cloudflare imposes a connection/re-connection rate limit (per IP address) of approximately 150 attempts per rolling 10 minutes. If this is exceeded, the IP is banned for 10 minutes. + - Recommended reconnection behaviour is to (1) attempt reconnection instantly up to a handful of times if the websocket is dropped randomly during normal operation but (2) after maintenance or extended downtime, attempt to reconnect no more quickly than once every 5 seconds. There is no advantage to reconnecting more rapidly after maintenance during cancel_only mode. + + +channels: + ping: + address: / + messages: + ping: + $ref: '#/components/messages/ping' + pong: + address: / + messages: + pong: + $ref: '#/components/messages/pong' + + heartbeat: + address: / + messages: + heartbeat: + $ref: '#/components/messages/heartbeat' + + systemStatus: + address: / + messages: + systemStatus: + $ref: '#/components/messages/systemStatus' + + currencyInfo: + address: / + messages: + subscriptionStatus: + $ref: '#/components/messages/subscriptionStatus' + dummyCurrencyInfo: + $ref: '#/components/messages/dummyCurrencyInfo' + + subscribe: + address: / + messages: + subscribe: + $ref: '#/components/messages/subscribe' + + unsubscribe: + address: / + messages: + unsubscribe: + $ref: '#/components/messages/unsubscribe' + +operations: + receivePing: + action: receive + channel: + $ref: '#/channels/ping' + reply: + channel: + $ref: '#/channels/pong' + heartbeat: + action: send + channel: + $ref: '#/channels/heartbeat' + systemStatus: + action: send + channel: + $ref: '#/channels/systemStatus' + subscribe: + action: receive + channel: + $ref: '#/channels/subscribe' + reply: + channel: + $ref: '#/channels/currencyInfo' + unsubscribe: + action: receive + channel: + $ref: '#/channels/unsubscribe' + reply: + channel: + $ref: '#/channels/currencyInfo' + messages: + - $ref: '#/channels/currencyInfo/messages/subscriptionStatus' + + +components: + messages: + dummyCurrencyInfo: + summary: Dummy message with no real life details + description: It is here in this example to showcase that there is an additional message that normally is of a complex structure. It represents actually currency exchange value to show a reply to operation receiveSubscribeRequest with more than one possible message. + payload: + type: object + properties: + event: + type: string + const: currencyInfo + reqid: + $ref: '#/components/schemas/reqid' + data: + type: object + required: + - event + correlationId: + location: '$message.payload#/reqid' + ping: + summary: Ping server to determine whether connection is alive + description: Client can ping server to determine whether connection is alive, server responds with pong. This is an application level ping as opposed to default ping in websockets standard which is server initiated + payload: + $ref: '#/components/schemas/ping' + correlationId: + location: $message.payload#/reqid + + pong: + summary: Pong is a response to ping message + description: Server pong response to a ping to determine whether connection is alive. This is an application level pong as opposed to default pong in websockets standard which is sent by client in response to a ping + payload: + $ref: '#/components/schemas/pong' + correlationId: + location: $message.payload#/reqid + + subscribe: + description: Subscribe to a topic on a single or multiple currency pairs. + payload: + $ref: '#/components/schemas/subscribe' + correlationId: + location: $message.payload#/reqid + unsubscribe: + description: Unsubscribe, can specify a channelID or multiple currency pairs. + payload: + $ref: '#/components/schemas/unsubscribe' + correlationId: + location: $message.payload#/reqid + subscriptionStatus: + description: Subscription status response to subscribe, unsubscribe or exchange initiated unsubscribe. + payload: + $ref: '#/components/schemas/subscriptionStatus' + examples: + - payload: + channelID: 10001 + channelName: ohlc-5 + event: subscriptionStatus + pair: XBT/EUR + reqid: 42 + status: unsubscribed + subscription: + interval: 5 + name: ohlc + - payload: + errorMessage: Subscription depth not supported + event: subscriptionStatus + pair: XBT/USD + status: error + subscription: + depth: 42 + name: book + + systemStatus: + description: Status sent on connection or system status changes. + payload: + $ref: '#/components/schemas/systemStatus' + + heartbeat: + description: Server heartbeat sent if no subscription traffic within 1 second (approximately) + payload: + $ref: '#/components/schemas/heartbeat' + + + schemas: + ping: + type: object + properties: + event: + type: string + const: ping + reqid: + $ref: '#/components/schemas/reqid' + required: + - event + heartbeat: + type: object + properties: + event: + type: string + const: heartbeat + pong: + type: object + properties: + event: + type: string + const: pong + reqid: + $ref: '#/components/schemas/reqid' + systemStatus: + type: object + properties: + event: + type: string + const: systemStatus + connectionID: + type: integer + description: The ID of the connection + status: + $ref: '#/components/schemas/status' + version: + type: string + status: + type: string + enum: + - online + - maintenance + - cancel_only + - limit_only + - post_only + subscribe: + type: object + properties: + event: + type: string + const: subscribe + reqid: + $ref: '#/components/schemas/reqid' + pair: + $ref: '#/components/schemas/pair' + subscription: + type: object + properties: + depth: + $ref: '#/components/schemas/depth' + interval: + $ref: '#/components/schemas/interval' + name: + $ref: '#/components/schemas/name' + ratecounter: + $ref: '#/components/schemas/ratecounter' + snapshot: + $ref: '#/components/schemas/snapshot' + token: + $ref: '#/components/schemas/token' + required: + - name + required: + - event + unsubscribe: + type: object + properties: + event: + type: string + const: unsubscribe + reqid: + $ref: '#/components/schemas/reqid' + pair: + $ref: '#/components/schemas/pair' + subscription: + type: object + properties: + depth: + $ref: '#/components/schemas/depth' + interval: + $ref: '#/components/schemas/interval' + name: + $ref: '#/components/schemas/name' + token: + $ref: '#/components/schemas/token' + required: + - name + required: + - event + subscriptionStatus: + type: object + oneOf: + - $ref: '#/components/schemas/subscriptionStatusError' + - $ref: '#/components/schemas/subscriptionStatusSuccess' + subscriptionStatusError: + allOf: + - properties: + errorMessage: + type: string + required: + - errorMessage + - $ref: '#/components/schemas/subscriptionStatusCommon' + subscriptionStatusSuccess: + allOf: + - properties: + channelID: + type: integer + description: ChannelID on successful subscription, applicable to public messages only. + channelName: + type: string + description: Channel Name on successful subscription. For payloads 'ohlc' and 'book', respective interval or depth will be added as suffix. + required: + - channelID + - channelName + - $ref: '#/components/schemas/subscriptionStatusCommon' + subscriptionStatusCommon: + type: object + required: + - event + properties: + event: + type: string + const: subscriptionStatus + reqid: + $ref: '#/components/schemas/reqid' + pair: + $ref: '#/components/schemas/pair' + status: + $ref: '#/components/schemas/status' + subscription: + required: + - name + type: object + properties: + depth: + $ref: '#/components/schemas/depth' + interval: + $ref: '#/components/schemas/interval' + maxratecount: + $ref: '#/components/schemas/maxratecount' + name: + $ref: '#/components/schemas/name' + token: + $ref: '#/components/schemas/token' + interval: + type: integer + description: Time interval associated with ohlc subscription in minutes. + default: 1 + enum: + - 1 + - 5 + - 15 + - 30 + - 60 + - 240 + - 1440 + - 10080 + - 21600 + name: + type: string + description: The name of the channel you subscribe too. + enum: + - book + - ohlc + - openOrders + - ownTrades + - spread + - ticker + - trade + token: + type: string + description: base64-encoded authentication token for private-data endpoints. + depth: + type: integer + default: 10 + enum: + - 10 + - 25 + - 100 + - 500 + - 1000 + description: Depth associated with book subscription in number of levels each side. + maxratecount: + type: integer + description: Max rate-limit budget. Compare to the ratecounter field in the openOrders updates to check whether you are approaching the rate limit. + ratecounter: + type: boolean + default: false + description: Whether to send rate-limit counter in updates (supported only for openOrders subscriptions) + snapshot: + type: boolean + default: true + description: Whether to send historical feed data snapshot upon subscription (supported only for ownTrades subscriptions) + reqid: + type: integer + description: client originated ID reflected in response message. + pair: + type: array + description: Array of currency pairs. + items: + type: string + description: Format of each pair is "A/B", where A and B are ISO 4217-A3 for standardized assets and popular unique symbol if not standardized. + pattern: '[A-Z\s]+\/[A-Z\s]+' \ No newline at end of file