-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhashkey_ws_asyncapi.yaml
849 lines (849 loc) · 24.7 KB
/
hashkey_ws_asyncapi.yaml
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
asyncapi: 3.0.0
info:
title: Hashkey Websocket API
version: 2.0.0
description: >-
WebSocket endpoints are available for real-time data streaming on Hashkey
exchange.
servers:
Sandbox Public Streams:
host: stream-pro.sim.hashkeydev.com
pathname: /quote/ws/v1
protocol: wss
Sandbox Private Streams:
host: stream-pro.sim.hashkeydev.com
pathname: "/api/v1/ws/{listenKey}"
protocol: wss
Production Private Streams:
host: stream-pro.hashkey.com
pathname: /quote/ws/v1
protocol: wss
Production Public Streams:
host: stream-pro.hashkey.com
pathname: "/api/v1/ws/{listenKey}"
protocol: wss
channels:
/:
address: /
messages:
publish.message.0:
$ref: "#/components/messages/PingMessage"
publish.message.1:
$ref: "#/components/messages/KlineSubscriptionRequest"
publish.message.2:
$ref: "#/components/messages/RealtimesSubscriptionRequest"
publish.message.3:
$ref: "#/components/messages/TradeSubscriptionRequest"
publish.message.4:
$ref: "#/components/messages/DepthSubscriptionRequest"
subscribe.message.0:
$ref: "#/components/messages/PongMessage"
subscribe.message.1:
$ref: "#/components/messages/KlineUpdateResponse"
subscribe.message.2:
$ref: "#/components/messages/RealtimesUpdateResponse"
subscribe.message.3:
$ref: "#/components/messages/TradeUpdateResponse"
subscribe.message.4:
$ref: "#/components/messages/DepthUpdateResponse"
subscribe.message.5:
$ref: "#/components/messages/AccountUpdateMessage"
subscribe.message.6:
$ref: "#/components/messages/OrderUpdateMessage"
subscribe.message.7:
$ref: "#/components/messages/TicketPushMessage"
description: Main communication channel for the WebSocket connection.
operations:
/.publish:
action: receive
channel:
$ref: "#/channels/~1"
summary: Messages received at server
description: >-
The client sends a ping message with a timestamp to keep the WebSocket
connection alive.
messages:
- $ref: "#/channels/~1/messages/publish.message.0"
- $ref: "#/channels/~1/messages/publish.message.1"
- $ref: "#/channels/~1/messages/publish.message.2"
- $ref: "#/channels/~1/messages/publish.message.3"
- $ref: "#/channels/~1/messages/publish.message.4"
/.subscribe:
action: send
channel:
$ref: "#/channels/~1"
description: Message send by server
messages:
- $ref: "#/channels/~1/messages/subscribe.message.0"
- $ref: "#/channels/~1/messages/subscribe.message.1"
- $ref: "#/channels/~1/messages/subscribe.message.2"
- $ref: "#/channels/~1/messages/subscribe.message.3"
- $ref: "#/channels/~1/messages/subscribe.message.4"
- $ref: "#/channels/~1/messages/subscribe.message.5"
- $ref: "#/channels/~1/messages/subscribe.message.6"
- $ref: "#/channels/~1/messages/subscribe.message.7"
components:
messages:
PingMessage:
name: PingMessage
title: Ping Message
summary: A ping message sent by the client.
contentType: application/json
payload:
type: object
properties:
ping:
type: integer
description: The client's session ID timestamp.
example: 1691473241907
PongMessage:
name: PongMessage
title: Pong Message
summary: A pong message sent by the server in response to a ping.
contentType: application/json
payload:
$ref: "#/components/schemas/PongPayload"
KlineSubscriptionRequest:
name: KlineSubscriptionRequest
title: Kline Subscription Request
summary: >-
The request sent by the client to subscribe to Kline data for a currency
pair.
contentType: application/json
payload:
type: object
properties:
symbol:
type: string
description: The currency pair symbol.
example: BTCUSDT
topic:
type: string
description: The topic for Kline data.
example: kline_1m
event:
type: string
description: The event type for the subscription.
example: sub
params:
$ref: "#/components/schemas/SubscriptionParams"
id:
type: integer
description: Unique ID for the subscription request.
example: 1
KlineUpdateResponse:
name: KlineUpdateResponse
title: Kline Update Response
summary: The server response containing Kline data updates.
contentType: application/json
payload:
$ref: "#/components/schemas/KlinePayload"
RealtimesSubscriptionRequest:
name: RealtimesSubscriptionRequest
title: Realtimes Subscription Request
summary: >-
The request sent by the client to subscribe to Realtimes data for a
currency pair.
contentType: application/json
payload:
type: object
properties:
symbol:
type: string
description: The currency pair symbol.
example: BTCUSDT
topic:
type: string
description: The topic for Realtimes data.
example: realtimes
event:
type: string
description: The event type for the subscription.
example: sub
params:
$ref: "#/components/schemas/RealtimeParams"
id:
type: integer
description: Unique ID for the subscription request.
example: 1
RealtimesUpdateResponse:
name: RealtimesUpdateResponse
title: Realtimes Update Response
summary: The server response containing Realtimes data updates.
contentType: application/json
payload:
$ref: "#/components/schemas/RealtimePayload"
TradeSubscriptionRequest:
name: TradeSubscriptionRequest
title: Trade Subscription Request
summary: >-
The request sent by the client to subscribe to Trade data for a currency
pair.
contentType: application/json
payload:
type: object
properties:
symbol:
type: string
description: The currency pair symbol.
example: BTCUSDT
topic:
type: string
description: The topic for Trade data.
example: trade
event:
type: string
description: The event type for the subscription.
example: sub
params:
$ref: "#/components/schemas/TradeParams"
id:
type: integer
description: Unique ID for the subscription request.
example: 1
TradeUpdateResponse:
name: TradeUpdateResponse
title: Trade Update Response
summary: The server response containing Trade data updates.
contentType: application/json
payload:
$ref: "#/components/schemas/TradePayload"
DepthSubscriptionRequest:
name: DepthSubscriptionRequest
title: Depth Subscription Request
summary: >-
The request sent by the client to subscribe to Depth data for a currency
pair.
contentType: application/json
payload:
type: object
properties:
symbol:
type: string
description: The currency pair symbol.
example: BTCUSDT
topic:
type: string
description: The topic for Depth data.
example: depth
event:
type: string
description: The event type for the subscription.
example: sub
params:
$ref: "#/components/schemas/DepthParams"
id:
type: integer
description: Unique ID for the subscription request.
example: 1
DepthUpdateResponse:
name: DepthUpdateResponse
title: Depth Update Response
summary: The server response containing Depth data updates.
contentType: application/json
payload:
$ref: "#/components/schemas/DepthPayload"
AccountUpdateMessage:
name: AccountUpdateMessage
title: Account Update
summary: Message sent when there is a change in account balance.
contentType: application/json
payload:
type: array
items:
$ref: "#/components/schemas/AccountSchema"
OrderUpdateMessage:
name: OrderUpdateMessage
title: Order Update
summary: Message sent when there is an update on an order.
contentType: application/json
payload:
type: array
items:
$ref: "#/components/schemas/OrderSchema"
TicketPushMessage:
name: TicketPushMessage
title: Ticket Push
summary: Message sent when a ticket update occurs.
contentType: application/json
payload:
type: array
items:
$ref: "#/components/schemas/TicketSchema"
schemas:
SubscriptionParams:
type: object
properties:
binary:
type: boolean
description: Whether to return binary data.
example: false
KlineParams:
type: object
properties:
realtimeInterval:
type: string
description: The interval for real-time data.
example: 24h
klineType:
type: string
description: The type of Kline interval.
example: 1m
binary:
type: boolean
description: Whether the data is in binary format.
example: false
KlineData:
type: object
properties:
t:
type: integer
description: Timestamp in milliseconds.
example: 1688199660000
s:
type: string
description: The symbol of the currency pair.
example: BTCUSDT
sn:
type: string
description: The name of the currency pair.
example: BTCUSDT
c:
type: string
description: The close price.
example: 10002
h:
type: string
description: The high price.
example: 10002
l:
type: string
description: The low price.
example: 10002
o:
type: string
description: The open price.
example: 10002
v:
type: string
description: The base asset volume.
example: 0
RealtimeParams:
type: object
properties:
realtimeInterval:
type: string
description: The interval for real-time data.
example: 24h
binary:
type: boolean
description: Whether the data is in binary format.
example: false
dumpScale:
type: integer
description: Number of layers in either of order book sides.
example: 10
RealtimeData:
type: object
properties:
t:
type: integer
description: Timestamp in milliseconds.
example: 1688199300011
s:
type: string
description: The symbol of the currency pair.
example: BTCUSDT
sn:
type: string
description: The name of the currency pair.
example: BTCUSDT
c:
type: string
description: The close price.
example: 10002
h:
type: string
description: The high price.
example: 10002
l:
type: string
description: The low price.
example: 10002
o:
type: string
description: The open price.
example: 10002
v:
type: string
description: Total traded base asset volume.
example: 0
qv:
type: string
description: Total traded quote asset volume.
example: 0
m:
type: string
description: 24H Range.
example: 0
e:
type: integer
description: Exchange ID.
example: 301
TradeParams:
type: object
properties:
realtimeInterval:
type: string
description: The interval for real-time data.
example: 24h
binary:
type: boolean
description: Whether the data is in binary format.
example: false
TradeData:
type: object
properties:
v:
type: string
description: Transaction record ID.
example: "1447335405363150849"
t:
type: integer
description: Timestamp corresponding to the transaction time in milliseconds.
example: 1687271825415
p:
type: string
description: Traded price.
example: "10001"
q:
type: string
description: Traded quantity.
example: "0.001"
m:
type: boolean
description: Indicates whether it is a maker or taker order.
example: false
DepthParams:
type: object
properties:
realtimeInterval:
type: string
description: The interval for real-time data.
example: 24h
binary:
type: boolean
description: Whether the data is in binary format.
example: false
DepthData:
type: object
properties:
e:
type: integer
description: Latest transaction record ID.
example: 301
s:
type: string
description: The symbol of the currency pair.
example: BTCUSDT
t:
type: integer
description: Timestamp corresponding to the data time in milliseconds.
example: 1688199202314
v:
type: string
description: Base asset volume.
example: "6881_18"
b:
type: array
description: List of bid prices and quantities.
items:
type: array
items:
type: string
example:
- "10004"
- "0.001"
a:
type: array
description: List of ask prices and quantities.
items:
type: array
items:
type: string
example:
- "10004"
- "0.001"
AccountSchema:
type: object
properties:
e:
$ref: "#/components/schemas/AccountEnum"
example: outboundAccountInfo
E:
type: integer
description: Event time
example: 1499405658849
T:
type: boolean
description: Can trade
example: true
W:
type: boolean
description: Can withdraw
example: true
D:
type: boolean
description: Can deposit
example: true
B:
type: array
description: Balances that changed
items:
$ref: "#/components/schemas/AccountArray"
AccountArray:
type: object
properties:
a:
type: string
description: Asset name
example: LTC
f:
type: string
description: Free amount
example: "17366.18538083"
l:
type: string
description: Locked amount
example: "0.00000000"
OrderSchema:
type: object
properties:
e:
type: string
description: Event type
example: executionReport
E:
type: integer
description: Event time
example: 1499405658658
s:
type: string
description: Symbol of the order
example: ETHBTC
c:
type: string
description: Client order ID
example: 1000087761
S:
type: string
description: Order side
example: BUY
o:
type: string
description: Order type
example: LIMIT
f:
type: string
description: Time in force
example: GTC
q:
type: string
description: Order quantity
example: "1.00000000"
p:
type: string
description: Order price
example: "0.10264410"
reqAmt:
type: string
description: Requested cash amount (to be released)
example: "1000"
X:
$ref: "#/components/schemas/OrderEnum"
example: NEW
d:
type: string
description: Execution ID
example: 1234567890123456800
i:
type: integer
description: Order ID
example: 4293153
l:
type: string
description: Last executed quantity
example: "0.00000000"
r:
type: string
description: Unfilled quantity
example: "0"
z:
type: string
description: Cumulative filled quantity
example: "0.00000000"
L:
type: string
description: Last executed price
example: "0.00000000"
V:
type: string
description: Average executed price
example: "26105.5"
"n":
type: string
description: Commission amount
example: "0"
"N":
type: string
description: Commission asset
example: null
u:
type: boolean
description: Is the trade normal?
example: true
w:
type: boolean
description: Is the order working?
example: true
m:
type: boolean
description: Is this trade on the maker side?
example: false
O:
type: integer
description: Order creation time
example: 1499405658657
Z:
type: string
description: Cumulative quote asset transacted quantity
example: "0.00000000"
x:
type: string
description: Order cancel reject reason
example: USER_CANCEL
TicketSchema:
type: object
properties:
e:
type: string
description: Event type
example: ticketInfo
E:
type: string
description: >-
Event time (latest order info update time when the message is
created)
example: "1668693440976"
s:
type: string
description: Symbol
example: BTCUSDT
q:
type: string
description: Quantity
example: "0.205"
t:
type: string
description: Order created time
example: "1668693440899"
p:
type: string
description: Price
example: "441.0"
T:
type: string
description: Ticket ID
example: "1291488620385157122"
o:
type: string
description: Order ID
example: "1291488620167835136"
c:
type: string
description: Client order ID
example: "1668693440093"
O:
type: string
description: Match order ID
example: "1291354087841869312"
a:
type: string
description: Account ID
example: "1286424214388204801"
A:
type: integer
description: Ignore (for future use)
example: 0
m:
type: boolean
description: Is maker
example: false
S:
type: string
description: Side of the order (SELL or BUY)
example: SELL
OrderEnum:
type: string
description: Current order status
enum:
- NEW
- PARTIALLY_FILLED
- FILLED
- PARTIALLY_CANCELED
- CANCELED
- REJECTED
AccountEnum:
type: string
description: Event type
enum:
- outboundAccountInfo
- outboundCustodyAccountInfo
- outboundFiatAccountInfo
PongPayload:
type: object
properties:
pong:
type: integer
description: The server's current timestamp.
example: 1691473283965
KlinePayload:
type: object
properties:
symbol:
type: string
description: The currency pair symbol.
example: BTCUSDT
symbolName:
type: string
description: The name of the currency pair.
example: BTCUSDT
topic:
type: string
description: The Kline topic.
example: kline
params:
$ref: "#/components/schemas/KlineParams"
data:
type: array
items:
$ref: "#/components/schemas/KlineData"
f:
type: boolean
description: Whether it is the first return value.
example: true
sendTime:
type: integer
description: The timestamp when the message was sent.
example: 1688199705619
id:
type: string
description: The message ID.
example: 1
DepthPayload:
type: object
properties:
symbol:
type: string
description: The currency pair symbol.
example: BTCUSDT
symbolName:
type: string
description: The name of the currency pair.
example: BTCUSDT
topic:
type: string
description: The Depth topic.
example: depth
params:
$ref: "#/components/schemas/DepthParams"
data:
type: array
items:
$ref: "#/components/schemas/DepthData"
f:
type: boolean
description: Whether it is the first return value.
example: true
sendTime:
type: integer
description: The timestamp when the message was sent.
example: 1688199482822
shared:
type: boolean
description: Whether the message is shared.
example: false
id:
type: string
description: The message ID.
example: 1
TradePayload:
type: object
properties:
symbol:
type: string
description: The currency pair symbol.
example: BTCUSDT
symbolName:
type: string
description: The name of the currency pair.
example: BTCUSDT
topic:
type: string
description: The Trade topic.
example: trade
params:
$ref: "#/components/schemas/TradeParams"
data:
type: array
items:
$ref: "#/components/schemas/TradeData"
f:
type: boolean
description: Whether it is the first return value.
example: true
sendTime:
type: integer
description: The timestamp when the message was sent.
example: 1688198964293
shared:
type: boolean
description: Whether the message is shared.
example: false
id:
type: string
description: The message ID.
example: 1
RealtimePayload:
type: object
properties:
symbol:
type: string
description: The currency pair symbol.
example: BTCUSDT
symbolName:
type: string
description: The name of the currency pair.
example: BTCUSDT
topic:
type: string
description: The Realtimes topic.
example: realtimes
params:
$ref: "#/components/schemas/RealtimeParams"
data:
type: array
items:
$ref: "#/components/schemas/RealtimeData"
f:
type: boolean
description: Whether it is the first return value.
example: true
sendTime:
type: integer
description: The timestamp when the message was sent.
example: 1688199337756
id:
type: string
description: The message ID.
example: 1