-
-
Notifications
You must be signed in to change notification settings - Fork 288
/
Copy pathwebsocket-gemini-asyncapi.yml
301 lines (291 loc) · 8.7 KB
/
websocket-gemini-asyncapi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
asyncapi: 3.0.0
info:
title: Gemini Market Data Websocket API
version: 1.0.0
description: >
Market data is a public API that streams all the market data on a given
symbol.
You can quickly play with the API using
[websocat](https://github.com/vi/websocat#installation) like this:
```bash
websocat wss://api.gemini.com/v1/marketdata/btcusd?heartbeat=true -S
```
contact:
name: Gemini
url: 'https://www.gemini.com/'
externalDocs:
url: 'https://docs.sandbox.gemini.com/websocket-api/#market-data'
servers:
public:
host: api.gemini.com
protocol: wss
channels:
marketDataV1:
address: '/v1/marketdata/{symbol}'
messages:
marketData:
$ref: '#/components/messages/marketData'
parameters:
symbol:
enum:
- btcusd
- ethbtc
- ethusd
- zecusd
- zecbtc
- zeceth
- zecbch
- zecltc
- bchusd
- bchbtc
- bcheth
- ltcusd
- ltcbtc
- ltceth
- ltcbch
- batusd
- daiusd
- linkusd
- oxtusd
- batbtc
- linkbtc
- oxtbtc
- bateth
- linketh
- oxteth
- ampusd
- compusd
- paxgusd
- mkrusd
- zrxusd
- kncusd
- manausd
- storjusd
- snxusd
- crvusd
- balusd
- uniusd
- renusd
- umausd
- yfiusd
- btcdai
- ethdai
- aaveusd
- filusd
- btceur
- btcgbp
- etheur
- ethgbp
- btcsgd
- ethsgd
- sklusd
- grtusd
- bntusd
- 1inchusd
- enjusd
- lrcusd
- sandusd
- cubeusd
- lptusd
- bondusd
- maticusd
- injusd
- sushiusd
description: >
Symbols are formatted as CCY1CCY2 where prices are in CCY2 and
quantities are in CCY1. To read more click
[here](https://docs.sandbox.gemini.com/websocket-api/#symbols-and-minimums).
bindings:
ws:
bindingVersion: 0.1.0
query:
type: object
description: >
The semantics of entry type filtering is:
If any entry type is specified as true or false, all of them must be
explicitly flagged true to show up in the response
If no entry types filtering parameters are included in the url, then
all entry types will appear in the response
NOTE: top_of_book has no meaning and initial book events are empty
when only trades is specified
properties:
heartbeat:
type: boolean
default: false
description: >-
Optionally add this parameter and set to true to receive a
heartbeat every 5 seconds
top_of_book:
type: boolean
default: false
description: >-
If absent or false, receive full order book depth; if present
and true, receive top of book only. Only applies to bids and
offers.
bids:
type: boolean
default: true
description: Include bids in change events
offers:
type: boolean
default: true
description: Include asks in change events
trades:
type: boolean
default: true
description: Include trade events
auctions:
type: boolean
default: true
description: Include auction events
operations:
sendMarketData:
action: send
channel:
$ref: '#/channels/marketDataV1'
summary: Receive market updates on a given symbol
messages:
- $ref: '#/channels/marketDataV1/messages/marketData'
components:
messages:
marketData:
summary: Message with marked data information.
description: >
The initial response message will show the existing state of the order
book. Subsequent messages will show all executed trades, as well as all
other changes to the order book from orders placed or canceled.
payload:
$ref: '#/components/schemas/market'
examples:
- name: updateMessage
summary: >-
Example of an update message that contains a change in price
information.
payload:
type: update
eventId: 36902233362
timestamp: 1619769673
timestampms: 1619769673527
socket_sequence: 661
events:
- type: change
side: bid
price: 54350.40
remaining: 0.002
delta: 0.002
reason: place
- name: heartbeatMessage
summary: Example of additional heartbeat message when you enable them.
payload:
type: heartbeat
socket_sequence: 1656
schemas:
market:
type: object
oneOf:
- $ref: '#/components/schemas/heartbeat'
- $ref: '#/components/schemas/update'
heartbeat:
allOf:
- properties:
type:
type: string
const: heartbeat
required:
- type
- $ref: '#/components/schemas/default'
update:
allOf:
- properties:
type:
type: string
const: update
eventId:
type: integer
description: >-
A monotonically increasing sequence number indicating when this
change occurred. These numbers are persistent and consistent
between market data connections.
events:
$ref: '#/components/schemas/events'
timestamp:
type: number
description: >-
The timestamp in seconds for this group of events (included for
compatibility reasons). We recommend using the timestampms field
instead.
timestampms:
type: number
description: The timestamp in milliseconds for this group of events.
required:
- type
- eventId
- events
- timestamp
- timestampms
- $ref: '#/components/schemas/default'
default:
type: object
description: >-
This object is always part of the payload. In case of type=heartbeat,
these are the only fields.
required:
- type
- socket_sequence
properties:
socket_sequence:
type: integer
description: >-
zero-indexed monotonic increasing sequence number attached to each
message sent - if there is a gap in this sequence, you have missed a
message. If you choose to enable heartbeats, then heartbeat and
update messages will share a single increasing sequence. See
[Sequence
Numbers](https://docs.sandbox.gemini.com/websocket-api/#sequence-numbers)
for more information.
events:
type: array
description: >-
Either a change to the order book, or the indication that a trade has
occurred.
items:
type: object
additionalProperties: false
properties:
type:
type: string
enum:
- trade
- change
- 'auction, block_trade'
price:
type: number
multipleOf: 0.01
description: The price of this order book entry.
side:
type: string
enum:
- bid
- side
reason:
type: string
enum:
- place
- trade
- cancel
- initial
description: >-
Indicates why the change has occurred. initial is for the initial
response message, which will show the entire existing state of the
order book.
remaining:
type: number
description: >-
The quantity remaining at that price level after this change
occurred. May be zero if all orders at this price level have been
filled or canceled.
delta:
type: number
description: >-
The quantity changed. May be negative, if an order is filled or
canceled. For initial messages, delta will equal remaining.