-
Notifications
You must be signed in to change notification settings - Fork 157
/
openapi.json
3033 lines (3033 loc) · 91.2 KB
/
openapi.json
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.0",
"info": {
"title": "Backpack Exchange API",
"description": "\n# Introduction\n\nWelcome to the Backpack Exchange API. This API is for programmatic trade execution. All of the endpoints require requests to be signed with an ED25519 keypair for authentication.\n\nThe API is hosted at `https://api.backpack.exchange/` and the WS API is hosted at `wss://ws.backpack.exchange/`.\n\n# Authentication\n\n\n## Signing requests\n\nSigned requests are required for any API calls that mutate state. Additionally, some read only requests can be performed by signing or via session authentication.\n\nSigned requests require the following additional headers:\n\n- `X-Timestamp` - Unix time in ms that the request was sent.\n- `X-Window` - Time window in milliseconds that the request is valid for.\n- `X-API-Key` - Base64 encoded verifying key of the ED25519 keypair.\n- `X-Signature` - Base64 encoded signature of the request body.\n\nTo generate a signature perform the following:\n\n1) The key/values of the request body or query parameters should be ordered alphabetically and then turned into query string format.\n\n2) Append the header values for the timestamp and receive window to the above generated string in the format `×tamp=<timestamp>&window=<window>`. If no `X-Window` header is passed the default value of 5000 still needs to be added to the signing string.\n\nEach request also has an instruction type, valid instructions are:\n\n```\nbalanceQuery\ndepositAddressQuery\ndepositQueryAll\nfillHistoryQueryAll\norderCancel\norderCancelAll\norderExecute\norderHistoryQueryAll\norderQuery\norderQueryAll\nwithdraw\nwithdrawalQueryAll\n```\n\nThe correct instruction type should be prefixed to the signing string. The instruction types for each request are documented alongside the request.\n\nFor example, an API request to cancel an order with the following body:\n\n```json\n{\n \"orderId\": 28\n \"symbol\": \"BTC_USDT\",\n}\n```\n\nWould require the following to be signed:\n\n```text\ninstruction=orderExecute&orderId=28&symbol=BTC_USDT×tamp=1614550000000&window=5000\n```\n\nIf the API endpoint requires query parameters instead of a request body, the same procedure should be used on the query parameters. If the API endpoint does not have a request body or query parameters, only the timestamp and receive window need to be signed.\n\nThis message should be signed using the private key of the ED25519 keypair that corresponds to the public key in the `X-API-Key` header. The signature should then be base64 encoded and submitted in the `X-Signature` header.\n\n\n<br><br>\n***\n ",
"version": "1.0"
},
"servers": [
{
"url": "https://api.backpack.exchange"
}
],
"tags": [
{
"name": "Capital",
"description": "Capital management."
},
{
"name": "History",
"description": "Historical account data."
},
{
"name": "Markets",
"description": "Public market data."
},
{
"name": "Order",
"description": "Order management."
},
{
"name": "System",
"description": "Exchange system status."
},
{
"name": "Trades",
"description": "Public trade data."
},
{
"name": "Websocket Streams",
"description": "# Subscribing\n\nTo use the websocket API, connect to\n`wss://ws.backpack.exchange/stream`.\n\nTo subscribe to a stream with the name `stream` send a text frame\nover the websocket connection with the following JSON payload:\n\n```\n{\n \"method\": \"SUBSCRIBE\",\n \"params\": [\"stream\"]\n}\n```\n\nSimilarly, to unsubscribe from a stream with the name `stream`:\n\n```\n{\n \"method\": \"UNSUBSCRIBE\",\n \"params\": [\"stream\"]\n}\n```\n\nAll data from streams is wrapped in a JSON object of the following form:\n\n```\n{\n \"stream\": <stream>\n \"data\": <payload>\n}\n```\n\nThe following command can be used to test subscribing to a stream:\n```\n(sleep 1; \\\necho '{\"method\":\"SUBSCRIBE\",\"params\":[\"SOL_USDC@depth\"]}';\\\ncat) |\\\nwscat -c wss://ws.backpack.exchange/stream\n```\n\nTo keep the connection alive, a `Ping` frame will be sent from the\nserver every 60s, and a `Pong` is expected to be received from the\nclient. If a `Pong` is not received within 120s, a `Close` frame will be\nsent and the connection will be closed.\n\nIf the server is shutting down, a `Close` frame will be sent and then a\ngrace period of 30s will be given before the connection is closed. The\nclient should reconnect after receiving the `Close` frame. The client\nwill be reconnected to a server that is not shutting down.\n\nThe payloads for each stream time are outlined below.\n\n# Private\n\nSubscribing to a private stream requires a valid signature generated\nfrom an ED25519 keypair. For stream subscriptions, the signature\nshould be of the form:\n\n```text\ninstruction=accountQuery×tamp=1614550000000&window=5000\n```\n\nPrivate streams are prefixed with `account.` and require signature data\nto be submitted in the subscribe parameters. The verifying key and\nsignature should be base64 encoded.\n\n```json\n{\n \"method\": \"SUBSCRIBE\",\n \"params\": [\"stream\", <verifying key>, <signature>, <timestamp>, <window>]\n}\n````\n\n## Order update stream\n\nOn any mutation to an order the order will be pushed to the order update\nstream. The event type of the order update will be one of the\nfollowing:\n\n- `orderAccepted`\n- `orderCancelled`\n- `orderExpired`\n- `orderFill`\n\nStream name format: `account.orderUpdate`\n\n```\n{\n \"e\": \"orderAccepted\", // Event type\n \"E\": 1694687692980, // Event time in ms\n \"s\": \"SOL_USD\", // Symbol\n \"c\": \"123\", // Client order ID\n \"S\": \"Bid\", // Side\n \"o\": \"LIMIT\", // Order type\n \"f\": \"GTC\", // Time in force\n \"q\": \"32123\", // Quantity\n \"Q\": \"32123\", // Quantity in quote\n \"p\": \"20\", // Price\n \"P\": \"21\", // Trigger price\n \"X\": \"Filled\", // Order state\n \"i\": \"1111343026172067\" // Order id\n \"l\": \"1.23\", // Fill quantity\n \"z\": \"321\", // Executed quantity\n \"Z\": \"123\", // Executed quantity in quote\n \"L\": \"20\", // Fill price\n \"m\": true, // Whether the order was maker\n \"n\": \"23\", // Fee\n \"N\": \"1.23\", // Fee symbol\n \"V\": \"RejectTaker\", // Self trade prevention\n}\n```\n\nSome fields are conditional on the order settings or event type:\n\n- `c` - Only present if the order has a client order ID.\n- `q` - Only present if the order has a quantity set.\n- `Q` - Only present if the order is reverse market order.\n- `p` - Only present if the order is a limit order.\n- `P` - Only present if the order is a trigger order.\n- `l` - Only present if the event is a `orderFill` event.\n- `L` - Only present if the event is a `orderFill` event.\n- `m` - Only present if the event is a `orderFill` event.\n- `n` - Only present if the event is a `orderFill` event.\n- `N` - Only present if the event is a `orderFill` event.\n\n# Public\n\n## K-Line stream\n\nStream name format: `<symbol>@kline_<interval>`\n```\n{\n \"e\": \"kline\", // Event type\n \"E\": 1694687692980, // Event time in ms\n \"s\": \"SOL_USD\", // Symbol\n \"k\": {\n \"t\": 123400000, // K-Line start time\n \"T\": 123460000, // K-Line close time\n \"o\": \"18.75\", // Open price\n \"c\": \"19.25\", // Close price\n \"h\": \"19.80\", // High price\n \"l\": \"18.50\", // Low price\n \"v\": \"32123\", // Base asset volume\n \"n\": 93828, // Number of trades\n \"x\": false, // Is this k-line closed?\n}\n```\n\n## Ticker stream\n\nThe ticker stream pushes 24hr rolling statistics for a single symbol.\n\nStream name format: `<symbol>@ticker`\n\n```\n{\n \"e\": \"ticker\", // Event type\n \"E\": 1694687692980, // Event time in ms\n \"s\": \"SOL_USD\", // Symbol\n \"o\": \"18.75\", // First price\n \"c\": \"19.24\", // Last price\n \"h\": \"19.80\", // High price\n \"l\": \"18.50\", // Low price\n \"v\": \"32123\", // Base asset volume\n \"n\": 93828, // Number of trades\n}\n```\n\n## Trade stream\n\nStream name format: `<symbol>@trade`\n```\n{\n \"e\": \"trade\", // Event type\n \"E\": 1694688638091, // Event time in ms\n \"s\": \"SOL_USDC\", // Symbol\n \"p\": \"18.68\", // Price\n \"q\": \"0.122\", // Quantity\n \"b\": \"111063114377265150\", // Buyer order ID\n \"a\": \"111063114585735170\", // Seller order ID\n \"T\": 1694688638089, // Trade time in ms\n \"m\": true // Is the buyer the maker?\n}\n```\n\n## Depth stream\n\nStream name format: `<symbol>@depth`\n```\n{\n \"e\": \"depthUpdate\", // Event type\n \"E\": 1694687965941, // Event time in ms\n \"s\": \"SOL_USDC\", // Symbol\n \"a\": [ // Asks\n [\n \"18.70\",\n \"0.000\"\n ]\n ],\n \"b\": [ // Bids\n [\n \"18.67\",\n \"0.832\"\n ],\n [\n \"18.68\",\n \"0.000\"\n ]\n ],\n \"U\": \"111063070477058050\", // First update ID in event\n \"u\": \"111063070525358080\" // Final update ID in event\n}\n```\n\n## Book Ticker stream\n\nStream name format: `<symbol>@bookTicker`\n```\n{\n \"e\": \"bookTicker\", // Event type\n \"E\": 1694687965941, // Event time in ms\n \"s\": \"SOL_USDC\", // Symbol\n \"a\": \"18.70\", // Inside ask price\n \"A\": \"1.000\", // Inside ask quantity\n \"b\": \"18.67\", // Inside bid price\n \"B\": \"2.000\", // Inside bid quantity\n \"u\": \"111063070525358080\" // Update ID of event\n}\n```"
}
],
"paths": {
"/api/v1/capital": {
"get": {
"tags": [
"Capital"
],
"summary": "Get balances.",
"description": "Retrieves account balances and the state of the balances (locked or\navailable).\n\nLocked assets are those that are currently in an open order.\n\n**Instruction:** `balanceQuery`",
"parameters": [
{
"name": "X-API-KEY",
"schema": {
"type": "string"
},
"in": "header",
"description": "API key",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-SIGNATURE",
"schema": {
"type": "string"
},
"in": "header",
"description": "Signature of the request",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-TIMESTAMP",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "header",
"description": "Timestamp of the request in milliseconds",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-WINDOW",
"schema": {
"type": "integer",
"format": "uint64"
},
"in": "header",
"description": "Time the request is valid for in milliseconds (default `5000`)",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "subaccountId",
"schema": {
"type": "integer",
"format": "int32"
},
"in": "query",
"description": "Filter for a subaccount (unsigned requests).",
"required": false,
"deprecated": false,
"explode": true
}
],
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"type": "object",
"additionalProperties": {
"$ref": "#/components/schemas/Balance"
}
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"text/plain; charset=utf-8": {
"schema": {
"type": "string"
}
}
}
}
},
"operationId": "get_balances"
}
},
"/wapi/v1/capital/deposits": {
"get": {
"tags": [
"Capital"
],
"summary": "Get deposits.",
"description": "Retrieves deposit history.\n\n**Instruction:** `depositQueryAll`",
"parameters": [
{
"name": "X-API-KEY",
"schema": {
"type": "string"
},
"in": "header",
"description": "API key",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-SIGNATURE",
"schema": {
"type": "string"
},
"in": "header",
"description": "Signature of the request",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-TIMESTAMP",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "header",
"description": "Timestamp of the request in milliseconds",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-WINDOW",
"schema": {
"type": "integer",
"format": "uint64"
},
"in": "header",
"description": "Time the request is valid for in milliseconds (default `5000`)",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "subaccountId",
"schema": {
"type": "integer",
"format": "int32"
},
"in": "query",
"description": "Filter for a subaccount (unsigned requests).",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "limit",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "query",
"description": "Maximum number to return. Default 100, maximum 1000.",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "offset",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "query",
"description": "Offset. Default 0.",
"required": false,
"deprecated": false,
"explode": true
}
],
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Deposit"
}
}
}
}
}
},
"operationId": "get_deposits"
}
},
"/wapi/v1/capital/deposit/address": {
"get": {
"tags": [
"Capital"
],
"summary": "Get deposit address.",
"description": "Retrieves the user specific deposit address if the user were to deposit\non the specified blockchain.\n\n**Instruction:** `depositAddressQuery`",
"parameters": [
{
"name": "X-API-KEY",
"schema": {
"type": "string"
},
"in": "header",
"description": "API key",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-SIGNATURE",
"schema": {
"type": "string"
},
"in": "header",
"description": "Signature of the request",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-TIMESTAMP",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "header",
"description": "Timestamp of the request in milliseconds",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-WINDOW",
"schema": {
"type": "integer",
"format": "uint64"
},
"in": "header",
"description": "Time the request is valid for in milliseconds (default `5000`)",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "blockchain",
"schema": {
"$ref": "#/components/schemas/Blockchain"
},
"in": "query",
"description": "Blockchain symbol to get a deposit address for.",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "subaccountId",
"schema": {
"type": "integer",
"format": "int32"
},
"in": "query",
"description": "Subaccount to get a deposit address for (unsigned requests).",
"required": false,
"deprecated": false,
"explode": true
}
],
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/DepositAddress"
}
}
}
}
},
"operationId": "get_deposit_address"
}
},
"/wapi/v1/history/orders": {
"get": {
"tags": [
"History"
],
"summary": "Get order history.",
"description": "Retrieves the order history for the user. This includes orders that have\nbeen filled and are no longer on the book. It may include orders\nthat are on the book, but the `/orders` endpoint contains more up to\ndate data.\n\n**Instruction:** `orderHistoryQueryAll`",
"parameters": [
{
"name": "X-API-KEY",
"schema": {
"type": "string"
},
"in": "header",
"description": "API key",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-SIGNATURE",
"schema": {
"type": "string"
},
"in": "header",
"description": "Signature of the request",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-TIMESTAMP",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "header",
"description": "Timestamp of the request in milliseconds",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-WINDOW",
"schema": {
"type": "integer",
"format": "uint64"
},
"in": "header",
"description": "Time the request is valid for in milliseconds (default `5000`)",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "subaccountId",
"schema": {
"type": "integer",
"format": "int32"
},
"in": "query",
"description": "Filter for a subaccount (unsigned requests).",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "symbol",
"schema": {
"type": "string"
},
"in": "query",
"description": "Filter to the given symbol.",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "offset",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "query",
"description": "Maximum number to return. Default `100`, maximum `1000`.",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "limit",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "query",
"description": "Offset. Default 0.",
"required": false,
"deprecated": false,
"explode": true
}
],
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/OrderRow"
}
}
}
}
}
},
"operationId": "get_order_history"
}
},
"/wapi/v1/history/fills": {
"get": {
"tags": [
"History"
],
"summary": "Get fill history.",
"description": "Retrieves historical fills, with optional filtering for a specific order\nor symbol.\n\n**Instruction:** `fillHistoryQueryAll`",
"parameters": [
{
"name": "X-API-KEY",
"schema": {
"type": "string"
},
"in": "header",
"description": "API key",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-SIGNATURE",
"schema": {
"type": "string"
},
"in": "header",
"description": "Signature of the request",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-TIMESTAMP",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "header",
"description": "Timestamp of the request in milliseconds",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-WINDOW",
"schema": {
"type": "integer",
"format": "uint64"
},
"in": "header",
"description": "Time the request is valid for in milliseconds (default `5000`)",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "subaccountId",
"schema": {
"type": "integer",
"format": "int32"
},
"in": "query",
"description": "Filter for a subaccount (unsigned requests).",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "orderId",
"schema": {
"type": "string"
},
"in": "query",
"description": "Filter to the given order.",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "symbol",
"schema": {
"type": "string"
},
"in": "query",
"description": "Filter to the given symbol.",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "limit",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "query",
"description": "Maximum number to return. Default `100`, maximum `1000`.",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "offset",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "query",
"description": "Offset. Default 0.",
"required": false,
"deprecated": false,
"explode": true
}
],
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/OrderFillRow"
}
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"text/plain; charset=utf-8": {
"schema": {
"type": "string"
}
}
}
}
},
"operationId": "get_fills"
}
},
"/api/v1/assets": {
"get": {
"tags": [
"Markets"
],
"summary": "Get assets.",
"description": "Retrieves all the assets that are supported by the exchange.",
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Asset"
}
}
}
}
}
},
"operationId": "get_assets"
}
},
"/api/v1/markets": {
"get": {
"tags": [
"Markets"
],
"summary": "Get markets.",
"description": "Retrieves all the markets that are supported by the exchange.",
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Market"
}
}
}
}
}
},
"operationId": "get_markets"
}
},
"/api/v1/ticker": {
"get": {
"tags": [
"Markets"
],
"summary": "Get ticker.",
"description": "Retrieves summarised statistics for the last 24 hours.",
"parameters": [
{
"name": "symbol",
"schema": {
"type": "string"
},
"in": "query",
"required": true,
"deprecated": false,
"explode": true
}
],
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/Ticker"
}
}
}
},
"204": {
"description": "No ticker data found."
}
},
"operationId": "get_ticker"
}
},
"/api/v1/depth": {
"get": {
"tags": [
"Markets"
],
"summary": "Get order book depth.",
"description": "Retrieves the order book depth for a given market symbol.",
"parameters": [
{
"name": "symbol",
"schema": {
"type": "string"
},
"in": "query",
"required": true,
"deprecated": false,
"explode": true
}
],
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/Depth"
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"text/plain; charset=utf-8": {
"schema": {
"type": "string"
}
}
}
}
},
"operationId": "get_depth"
}
},
"/api/v1/klines": {
"get": {
"tags": [
"Markets"
],
"summary": "Get K-lines.",
"description": "Get K-Lines for the given market symbol, optionally providing a\n`startTime` and `endTime`. If no `startTime` is provided, the interval\nduration will be used. If no `endTime` is provided, the current time\nwill be used.",
"parameters": [
{
"name": "symbol",
"schema": {
"type": "string"
},
"in": "query",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "interval",
"schema": {
"$ref": "#/components/schemas/KlineInterval"
},
"in": "query",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "startTime",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "query",
"description": "UTC timestamp in seconds.",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "endTime",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "query",
"description": "UTC timestamp in seconds.",
"required": false,
"deprecated": false,
"explode": true
}
],
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Kline"
}
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"text/plain; charset=utf-8": {
"schema": {
"type": "string"
}
}
}
}
},
"operationId": "get_klines"
}
},
"/api/v1/order": {
"get": {
"tags": [
"Order"
],
"summary": "Get open order.",
"description": "Retrieves an open order from the order book. This only returns the order\nif it is resting on the order book (i.e. has not been completely filled,\nexpired, or cancelled).\n\nOne of `orderId` or `clientId` must be specified. If both are specified,\nthen `orderId` takes precedence.\n\n**Instruction:** `orderQuery`",
"parameters": [
{
"name": "X-API-KEY",
"schema": {
"type": "string"
},
"in": "header",
"description": "API key",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-SIGNATURE",
"schema": {
"type": "string"
},
"in": "header",
"description": "Signature of the request",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-TIMESTAMP",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "header",
"description": "Timestamp of the request in milliseconds",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "X-WINDOW",
"schema": {
"type": "integer",
"format": "uint64"
},
"in": "header",
"description": "Time the request is valid for in milliseconds (default `5000`)",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "clientId",
"schema": {
"type": "integer",
"format": "uint32"
},
"in": "query",
"description": "Client ID of the order.",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "orderId",
"schema": {
"type": "string"
},
"in": "query",
"description": "ID of the order.",
"required": false,
"deprecated": false,
"explode": true
},
{
"name": "symbol",
"schema": {
"type": "string"
},
"in": "query",
"description": "Market symbol for the order.",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "subaccountId",
"schema": {
"type": "integer",
"format": "int32"
},
"in": "query",
"description": "Subaccount the order belongs to, if request is not signed.",
"required": false,
"deprecated": false,
"explode": true
}
],
"responses": {
"200": {
"description": "Success.",
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/OrderType"
}
}
}
},
"400": {
"description": "Bad request.",
"content": {
"text/plain; charset=utf-8": {
"schema": {
"type": "string"
}
}
}
},
"404": {
"description": "Order not found."
}
},
"operationId": "get_order"
},
"post": {
"tags": [
"Order"
],
"summary": "Execute order.",
"description": "Submits an order to the matching engine for execution.\n\n**Instruction:** `orderExecute`",
"parameters": [
{
"name": "X-API-KEY",
"schema": {
"type": "string"
},
"in": "header",
"description": "API key",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "X-SIGNATURE",
"schema": {
"type": "string"
},
"in": "header",
"description": "Signature of the request",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "X-TIMESTAMP",
"schema": {
"type": "integer",
"format": "int64"
},
"in": "header",
"description": "Timestamp of the request in milliseconds",
"required": true,
"deprecated": false,
"explode": true
},
{
"name": "X-WINDOW",
"schema": {
"type": "integer",
"format": "uint64"
},
"in": "header",
"description": "Time the request is valid for in milliseconds (default `5000`)",
"required": false,
"deprecated": false,
"explode": true
}
],
"requestBody": {
"content": {
"application/json; charset=utf-8": {
"schema": {
"$ref": "#/components/schemas/OrderExecutePayload"