-
Notifications
You must be signed in to change notification settings - Fork 1
/
hashkey_rest_openapi.yaml
4657 lines (4524 loc) · 132 KB
/
hashkey_rest_openapi.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
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.1
info:
title: Hashkey Exchange
version: 1.0.0
description: |
servers:
- url: https://api-pro.sim.hashkeydev.com
description: REST API Url
- url: wss://stream-pro.sim.hashkeydev.com
description: Public Websocket API
paths:
/api/v1/spot/orderTest:
post:
description: 'Submits a validation request to test endpoint'
tags:
- Order Management
parameters:
- name: symbol
in: query
required: true
schema:
type: string
- name: side
in: query
required: true
schema:
type: string
enum: [BUY, SELL]
- name: type
in: query
required: true
schema:
type: string
enum: [LIMIT, MARKET, LIMIT_MAKER]
- name: quantity
in: query
required: true
schema:
type: number
format: decimal
- name: price
in: query
required: true
schema:
type: number
format: decimal
- name: newClientOrderId
in: query
schema:
type: string
- name: timeInForce
in: query
schema:
type: string
enum: [GTC, IOC]
- name: recvWindow
in: query
schema:
type: integer
format: int64
- name: timestamp
in: query
schema:
type: integer
format: int64
- name: signature
in: query
schema:
type: string
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/OrderTest"
responses:
'200':
description: OK
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/spot/order:
post:
description: 'Creates a single order for Spot Trading on the Exchange. When an order is placed, the required funds from your account will be ringfenced for the duration of the order'
tags:
- Order Management
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SpotOrderRequest'
responses:
'200':
description: Request Successful
content:
application/json:
schema:
$ref: '#/components/schemas/SpotOrderResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
delete:
description: 'Cancel an existing order. Either orderId or clientOrderId must be sent.'
tags:
- Order Management
parameters:
- in: query
name: orderId
schema:
type: integer
format: int64
description: Order ID
example: 1483370868616793088
required: false
- in: query
name: clientOrderId
schema:
type: string
description: An ID defined by the client for the order
example: "123456789"
required: false
- in: query
name: timestamp
schema:
type: integer
format: int64
description: Timestamp
example: 1707493157004
required: true
responses:
'200':
description: Request Successful
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteOrderResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
get:
description: 'Check a single order information'
tags:
- Order Management
parameters:
- in: query
name: orderId
schema:
type: integer
format: int64
description: Order ID
example: 1453750674374393344
required: false
- in: query
name: origClientOrderId
schema:
type: string
description: Client order ID
example: "168803658506716316"
required: false
- in: query
name: accountId
schema:
type: string
description: Account ID
example: "1453450776554918656"
required: false
- in: query
name: timestamp
schema:
type: integer
format: int64
description: Millisecond timestamp
example: 1707493669694
required: true
responses:
'200':
description: Request Successful
content:
application/json:
schema:
$ref: '#/components/schemas/SingleOrderResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1.1/spot/order:
post:
description: 'Creates a single order for Spot Trading on the Exchange. When an order is placed, the required funds from your account will be ringfenced for the duration of the order'
tags:
- Order Management
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SpotOrderRequest'
responses:
'200':
description: Request Successful
content:
application/json:
schema:
$ref: '#/components/schemas/SpotOrderResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/spot/openOrders:
delete:
description: 'Cancel all open orders'
tags:
- Order Management
parameters:
- in: query
name: symbol
schema:
type: string
description: Name of instrument, e.g., "BTCUSDT", "ETHUSDT"
example: "BTCUSDC"
required: true
- in: query
name: side
schema:
type: string
enum:
- BUY
- SELL
description: BUY or SELL
example: "BUY"
required: false
- in: query
name: timestamp
schema:
type: integer
format: int64
description: Millisecond Timestamp
example: 1714311403031
required: true
responses:
'200':
description: Request Successful
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteAllOrderResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
get:
description: 'Query current active orders.In regards to master API key. The request parameters of "side" and "accountId". If "accountId" is passed, it will only query the orders under the current account. If not passed, it will first query the main account, and if the results are less than 500, it will then query the sub-accounts.'
tags:
- Order Management
parameters:
- in: query
name: orderId
schema:
type: integer
format: int64
description: Order ID
example: 1470930457684189696
required: false
- in: query
name: symbol
schema:
type: string
description: Currency pair
example: "BTCUSD"
required: false
- in: query
name: side
schema:
type: string
description: Side (BUY or SELL)
example: "BUY"
required: false
- in: query
name: limit
schema:
type: integer
format: int32
description: Default 500; Maximum 1000
example: 20
required: false
- in: query
name: timestamp
schema:
type: integer
format: int64
description: Millisecond timestamp
example: 1707493971279
required: true
responses:
'200':
description: Request Successful
content:
application/json:
schema:
$ref: '#/components/schemas/GetAllOrderResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/spot/cancelOrderByIds:
delete:
description: 'Cancel orders in batches according to order ID (Maximum of 100 orders in a single batch).
**Note**:A return code of 0 from the code indicates that the cancel order request has been executed. To determine if it was successful, you need to check the results in the result field. If the result is null, it means all were successful. If it is non empty, theorderId represents the ID of the order that failed to cancel, and code represents the reason for the cancellation failure'
tags:
- Order Management
parameters:
- in: query
name: ids
schema:
type: string
description: Order id (multiple, separated)
example: "202212231234567895,202212231234567896"
required: true
- in: query
name: timestamp
schema:
type: integer
format: int64
description: Millisecond timestamp
example: 1714311403031
required: true
responses:
'200':
description: Request Successful
content:
application/json:
schema:
$ref: '#/components/schemas/DeleteMultiOrderResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/spot/batchOrders:
post:
description: 'Create orders in batches up to 20 orders at a time. Currently only support for same symbol'
tags:
- Order Management
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/BatchOrderRequest'
responses:
'200':
description: Orders created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/BatchOrderResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/spot/tradeOrders:
get:
description: 'Retrieve all traded orders.In regards to master API key. The request parameters of "side" and "accountId". If "accountId" is passed, it will only query the orders under the current account. If not passed, it will first query the main account, and if the results are less than 500, it will then query the sub-accounts'
tags:
- Order Management
parameters:
- name: accountId
in: query
required: false
schema:
type: string
description: Account ID
- name: orderId
in: query
required: false
schema:
type: integer
format: int64
description: Order ID
- name: symbol
in: query
required: true
schema:
type: string
description: Currency pair
- name: startTime
in: query
required: true
schema:
type: integer
format: int64
description: Start Timestamp
- name: endTime
in: query
required: true
schema:
type: integer
format: int64
description: End Timestamp. Only supports the last 90 days timeframe
- name: side
in: query
required: false
schema:
type: string
description: Side
- name: limit
in: query
required: false
schema:
type: integer
default: 500
maximum: 1000
description: Default 500, max 1000
- name: timestamp
in: query
required: true
schema:
type: integer
format: int64
description: Timestamp
responses:
'200':
description: Request Successful
content:
application/json:
schema:
$ref: '#/components/schemas/tradeOrderResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/account/vipInfo:
get:
description: 'Retrieve VIP Level and Trading fee rates'
tags:
- Account
parameters:
- name: symbol
in: query
required: false
schema:
type: string
description: Trading pair
- name: timestamp
in: query
required: true
schema:
type: integer
format: int64
example: 1707494885079
description: Timestamp query params
- name: signature
in: query
required: true
schema:
type: string
example: b07580900f899f21c49bf0ab3486ca8a670b78148b82993d54726322417b18e5
description: Signature for the request
responses:
'200':
description: Request Successful
content:
application/json:
schema:
$ref: '#/components/schemas/TradingResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/account:
get:
description: 'Retrieve Account balance'
tags:
- Account
parameters:
- name: accountId
in: query
required: false
schema:
type: integer
format: int64
example: 1234567890
description: Account ID, for Master Key only
- name: timestamp
in: query
required: true
schema:
type: integer
format: int64
example: 1707494885079
description: Timestamp
- name: signature
in: query
required: true
schema:
type: string
example: b07580900f899f21c49bf0ab3486ca8a670b78148b82993d54726322417b18e5
description: Signature for the request
responses:
'200':
description: Request Successful
content:
application/json:
schema:
$ref: '#/components/schemas/AccountBalanceResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/account/trades:
get:
description: 'Query account history and transaction records <br>
<ul>
<li>
If there is only fromId, It will return trades with IDs bigger than fromId, sorted in descending order.</li>
<li>
If there is only toId. It will return trades with IDs less than toId, sorted in descending order</li>
<li>
If both fromId and toId are provided. It will return trades between fromId and toId, sorted in descending order</li>
<li>
If neither fromId or toId is provided, it will return the latest trade records, sorted in descending order.</li>
</ul>'
tags:
- Account
parameters:
- name: symbol
in: query
required: false
schema:
type: string
description: |
Trading pair
*(e.g., BTCUSD)*
- name: startTime
in: query
required: false
schema:
type: integer
format: int64
description: |
Start Timestamp
*(e.g., 1690084620567)*
- name: endTime
in: query
required: false
schema:
type: integer
format: int64
description: |
End Timestamp
*(Only supports the last 30 days timeframe)*
- name: clientOrderId
in: query
required: false
schema:
type: string
example: 99999999980088
description: |
Client Order ID
*(Defaults to 99999999980088 if not provided)*
- name: fromId
in: query
required: false
schema:
type: integer
format: int64
description: |
Starting ID
*(e.g., 1470930841345474561)*
- name: toId
in: query
required: false
schema:
type: integer
format: int64
description: |
End ID
*(e.g., 1470930841211329280)*
- name: limit
in: query
required: false
schema:
type: integer
format: int32
description: |
Limit of records
*(Number of items displayed per page)*
- name: accountId
in: query
required: false
schema:
type: integer
format: int64
description: |
Account ID
*(e.g., 1545583349011201280)*
- name: timestamp
in: query
required: true
schema:
type: integer
format: int64
example: 1707495043379
description: |
Timestamp
*(Millisecond timestamp)*
- name: signature
in: query
required: true
schema:
type: string
example: 10b108a6cf8162d70bb644a2a8403cd36bcf92468289f3514582182e20f87813
description: |
Signature
*(Use HMAC SHA256 to generate the signature)*
responses:
'200':
description: Request Successful
content:
application/json:
schema:
$ref: '#/components/schemas/TransactionQueryResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/account/types:
get:
description: 'Get account types.'
tags:
- Account
parameters:
- name: timestamp
in: query
required: true
schema:
type: integer
format: int64
example: 1707495123486
description: |
Timestamp
*(Millisecond timestamp)*
- name: signature
in: query
required: true
schema:
type: string
example: 37b4e53468b64ff5eb28fa71d20f855e87b654c22d471a74672117844bcd1d32
description: |
Signature
*(Use HMAC SHA256 to generate the signature)*
responses:
'200':
description: Request Successful
content:
application/json:
schema:
$ref: '#/components/schemas/AccountTypesResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/account/assetTransfer:
post:
description: 'Internal asset account transfer'
tags:
- Account
parameters:
- name: fromAccountId
in: query
required: true
schema:
type: string
example: 1467296062716909568
description: |
Source Account ID
*(Defaults to 1471090223379184386)*
- name: toAccountId
in: query
required: true
schema:
type: string
example: 1473231491689395200
description: |
Destination Account ID
*(Defaults to 1481989333430941184)*
- name: coin
in: query
required: true
schema:
type: string
example: USDT
description: |
Coin to be transferred
*(Defaults to USD)*
- name: quantity
in: query
required: true
schema:
type: number
format: double
example: 20
description: |
Transfer amount
*(Defaults to 0.01)*
- name: remark
in: query
required: false
schema:
type: string
example: TestingRemark
description: |
Remark
*(Optional)*
- name: clientOrderId
in: query
required: false
schema:
type: string
example: 12345678
description: |
Client unique order identifier
*(Optional)*
- name: timestamp
in: query
required: true
schema:
type: integer
format: int64
example: 1712317312973
description: |
Timestamp
*(Millisecond timestamp, defaults to 1707495335455)*
- name: signature
in: query
required: true
schema:
type: string
example: e66e9eda02861b759716ac2553e3e3b30475ee248e6d8ed63e986b53f9a82d5a
description: |
Signature
*(Use HMAC SHA256 to generate the signature)*
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AssetTransferRequest'
responses:
'200':
description: Orders created successfully
content:
application/json:
schema:
$ref: '#/components/schemas/AssetTransferResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/account/checkApiKey:
get:
description: 'Get API Key Type'
tags:
- Account
parameters:
- name: timestamp
in: query
required: true
schema:
type: integer
format: int64
example: 1707495123486
description: |
Timestamp
*(Millisecond timestamp)*
responses:
'200':
description: Request Successful
content:
application/json:
schema:
$ref: '#/components/schemas/CheckApiKeyResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/account/fiat/history:
get:
description: 'Get Fiat History'
tags:
- Account
parameters:
- name: type
in: query
required: true
schema:
type: string
enum:
- deposit
- withdraw
description: |
Transaction type
- "deposit"
- "withdraw"
- name: status
in: query
required: false
schema:
type: string
enum:
- under_review
- processing
- successful
- failed
- withdraw_return
- return
description: |
Transaction status.
**For deposit:**
- "under_review"
- "processing"
- "successful"
- "failed"
**For withdraw:**
- "under_review"
- "processing"
- "successful"
- "failed"
- "withdraw_return"
- "return"
- name: startTime
in: query
required: true
schema:
type: integer
format: int64
example: 16260408000000
description: Start timestamp
- name: endTime
in: query
required: true
schema:
type: integer
format: int64
example: 16881408000000
description: End timestamp
- name: channel
in: query
required: false
schema:
type: string
enum:
- auto
- manual
description: |
Transaction channel.
*(Defaults to "auto")*
**Note:** For transactions prior to 09/01/2023, please use "manual" channel.
- name: remark
in: query
required: false
schema:
type: string
example: "Optional remark here"
description: Remark
- name: limit
in: query
required: false
schema:
type: integer
example: 50
description: Limit of records
- name: recvWindow
in: query
required: false
schema:
type: integer
format: int64
example: 5000
description: Recv Window
- name: timestamp
in: query
required: true
schema:
type: integer
format: int64
example: 1707495506093
description: Millisecond timestamp
- name: signature
in: query
required: true
schema:
type: string
example: d06ec958490617748bf68e22a2951310bc3ae2437e1f532340076f1970dd350f
description: Signature generated using HMAC SHA256
responses:
'200':
description: Request Successful
content:
application/json:
schema:
$ref: '#/components/schemas/HistoryResponse'
'400':
description: Bad Request
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
/api/v1/account/balanceFlow:
get:
description: '<ul> <li>Only master account Master API key can call this interface, sub-accounts will return insufficient prvilege type error code</li><li>All orders returned are final</li><li>
Deposit, Withdrawal failed will not be return
Query of trade history supports the past 7 days time range. The other types support maximum 30 days. Exceeded amount will return error code "Exceed maximum time range of N days"</li><li>
Remark can only support up to 128 characters</li>'
tags:
- Account
parameters:
- name: accountId
in: query
required: false
schema:
type: integer
format: int64
example: 1234567890123456789
description: Account ID
- name: type
in: query
required: true
schema:
type: string
enum:
- trade
- deposit
- fiatDeposit
- withdraw
- fiatWithdraw
- transfer
description: |
Transaction type:
- "trade"
- "deposit"
- "fiatDeposit"
- "withdraw"
- "fiatWithdraw"
- "transfer"
- name: clientOrderId
in: query
required: false
schema:
type: string
example: "abc1234567890"
description: 'Corresponds to types: "trade", "fiatWithdraw", "transfer"'
- name: remark
in: query
required: false