-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhyperliquid_rest_openapi.yaml
3266 lines (3216 loc) · 107 KB
/
hyperliquid_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: Hyperliquid API
version: 1.0.1
description: >
Documentation for the Hyperliquid public API
## **Rate limits**
The following rate limits apply per IP address:
- All REST requests have a weight limit of 1200 per minute. All documented exchange API requests have a weight of 1. All documented info API requests have a weight of either 2 or 20; these limits can be found in the description for each info request in the Info endpoint section. All explorer API requests have a weight of 40.
- Maximum of 100 websocket connections
- Maximum of 1000 websocket subscriptions
- Maximum of 10 unique users across user-specific websocket subscriptions
- Maximum of 2000 inbound messages per minute across all websocket
connections
- Use websockets for lowest latency realtime data. See the python SDK for a full-featured example.
## **Address-based L1 Rate limits**
The L1 rate limiting logic will allow 1 requests per 1 USDC traded cumulatively since address inception.
Using an order value of 100 USDC, this only requires a fill rate of 1%.
Each address starts with an initial buffer of 10000 requests. When rate limited, an address will still be allowed one request every 10 seconds.
Cancels have cumulative limit min(limit + 100000, limit * 2) where limit is
the default limit for other actions. This way, hitting the address-based
rate limit will still allow open orders to be canceled.
Note that this rate limit only applies to L1 actions, not info requests.
## **Batched Requests**
A batched request with n orders (or cancels) is treated as one request for
IP based rate limiting, but as n requests for address-based L1 rate
limiting.
servers:
- url: https://api.hyperliquid.xyz
description: Mainnet URL
- url: https://api.hyperliquid-testnet.xyz
description: Testnet URL
- url: wss://api.hyperliquid.xyz/ws
description: Mainnet Websocket URL
- url: wss://api.hyperliquid-testnet.xyz/ws
description: Testnet Websocket URL
paths:
/info:
post:
summary: Fetch Information about exchange and users
description: >
The info endpoint is used to fetch information about the exchange and
specific users. The different request bodies result in different
corresponding response body schemas.
operationId: getInfoOrOrders
tags:
- Info
requestBody:
required: true
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/MarketDataRequest"
- $ref: "#/components/schemas/OpenOrdersRequest"
- $ref: "#/components/schemas/FrontendOpenOrdersRequest"
- $ref: "#/components/schemas/UserFillsRequest"
- $ref: "#/components/schemas/UserFillsByTimeRequest"
- $ref: "#/components/schemas/OrderStatusRequest"
- $ref: "#/components/schemas/L2BookRequest"
- $ref: "#/components/schemas/CandleSnapshotRequest"
- $ref: "#/components/schemas/MetaRequest"
- $ref: "#/components/schemas/MetaAndAssetCtxsRequest"
- $ref: "#/components/schemas/ClearinghouseStateRequest"
- $ref: "#/components/schemas/UserFundingOrLedgerUpdatesRequest"
- $ref: "#/components/schemas/FundingHistoryRequest"
- $ref: "#/components/schemas/SpotMetaRequest"
- $ref: "#/components/schemas/SpotMetaAndAssetCtxsRequest"
- $ref: "#/components/schemas/SpotClearinghouseStateRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/MarketDataResponse"
- $ref: "#/components/schemas/OpenOrdersResponse"
- $ref: "#/components/schemas/FrontendOpenOrdersResponse"
- $ref: "#/components/schemas/UserFillsResponse"
- $ref: "#/components/schemas/UserFillsByTimeResponse"
- $ref: "#/components/schemas/OrderStatusResponse"
- $ref: "#/components/schemas/L2BookResponse"
- $ref: "#/components/schemas/CandleSnapshotResponse"
- $ref: "#/components/schemas/MetaResponse"
- $ref: "#/components/schemas/MetaAndAssetCtxsResponse"
- $ref: "#/components/schemas/ClearinghouseStateResponse"
- $ref: "#/components/schemas/UserFundingOrLedgerUpdatesResponse"
- $ref: "#/components/schemas/FundingHistoryResponse"
- $ref: "#/components/schemas/SpotMetaResponse"
- $ref: "#/components/schemas/SpotMetaAndAssetCtxsResponse"
- $ref: "#/components/schemas/SpotClearinghouseStateResponse"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"402":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"404":
description: Not Found
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"422":
description: Unprocessable Entity
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"500":
description: Internel server error
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/Error"
- $ref: "#/components/schemas/422Error"
- $ref: "#/components/schemas/errorMessage"
/exchange:
post:
summary: Place an order
description: >
This endpoint allows you to place an order on the exchange. You can
choose between limit and trigger orders, set time-in-force options, and
more.
See the Python SDK for detailed examples of order field usage.
tags:
- Exchange
requestBody:
required: true
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/PlaceOrderRequest"
- $ref: "#/components/schemas/CancelOrderRequest"
- $ref: "#/components/schemas/CancelOrderByCloidRequest"
- $ref: "#/components/schemas/ScheduleCancelRequest"
- $ref: "#/components/schemas/ModifyOrderRequest"
- $ref: "#/components/schemas/BatchModifyOrderRequest"
- $ref: "#/components/schemas/UpdateLeverageRequest"
- $ref: "#/components/schemas/UpdateIsolatedMarginRequest"
- $ref: "#/components/schemas/L1SpotTransferRequest"
- $ref: "#/components/schemas/InitiateWithdrawalRequest"
- $ref: "#/components/schemas/SpotToPerpTransferRequest"
- $ref: "#/components/schemas/VaultTransferRequest"
responses:
"200":
description: Successful order placement or error response.
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/PlaceOrderRestingResponse"
- $ref: "#/components/schemas/PlaceOrderErrorResponse"
- $ref: "#/components/schemas/PlaceOrderFilledResponse"
- $ref: "#/components/schemas/CancelOrderSuccessResponse"
- $ref: "#/components/schemas/CancelOrderErrorResponse"
- $ref: "#/components/schemas/CancelOrderByCloidSuccessResponse"
- $ref: "#/components/schemas/CancelOrderByCloidErrorResponse"
- $ref: "#/components/schemas/ScheduleCancelResponse"
- $ref: "#/components/schemas/ErrorResponse"
- $ref: "#/components/schemas/ModifyOrderResponse"
- $ref: "#/components/schemas/ModifyOrderErrorResponse"
- $ref: "#/components/schemas/BatchModifyOrderResponse"
- $ref: "#/components/schemas/BatchModifyOrderErrorResponse"
- $ref: "#/components/schemas/UpdateLeverageResponse"
- $ref: "#/components/schemas/UpdateLeverageErrorResponse"
- $ref: "#/components/schemas/UpdateIsolatedMarginResponse"
- $ref: "#/components/schemas/UpdateIsolatedMarginErrorResponse"
- $ref: "#/components/schemas/L1SpotTransferResponse"
- $ref: "#/components/schemas/L1SpotTransferErrorResponse"
- $ref: "#/components/schemas/InitiateWithdrawalResponse"
- $ref: "#/components/schemas/InitiateWithdrawalErrorResponse"
- $ref: "#/components/schemas/SpotToPerpTransferResponse"
- $ref: "#/components/schemas/SpotToPerpTransferErrorResponse"
- $ref: "#/components/schemas/VaultTransferResponse"
- $ref: "#/components/schemas/VaultTransferErrorResponse"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"402":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"404":
description: Not Found
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"422":
description: Unprocessable Entity
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"500":
description: Internel server error
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/Error"
- $ref: "#/components/schemas/422Error"
- $ref: "#/components/schemas/errorMessage"
/ws:
post:
tags:
- Websocket
summary: WebSocket API for real-time data streaming
description: >
The WebSocket API allows for real-time data streaming and serves as an
alternative to HTTP requests on the Hyperliquid exchange.
- **Mainnet URL:** `wss://api.hyperliquid.xyz/ws`
- **Testnet URL:** `wss://api.hyperliquid-testnet.xyz/ws`
requestBody:
required: true
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/WebSocketSubscriptionRequest"
- $ref: "#/components/schemas/WebSocketPostSubscription"
- $ref: "#/components/schemas/OrderSignedRequest"
responses:
"200":
description: WebSocket connection established
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/WebSocketMessage"
- $ref: "#/components/schemas/WebSocketResponse"
- $ref: "#/components/schemas/WebSocketSubscriptionResponse"
- $ref: "#/components/schemas/WebSocketPostResponse"
- $ref: "#/components/schemas/OrderSignedResponse"
"400":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"402":
description: Error
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"404":
description: Not Found
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"422":
description: Unprocessable Entity
content:
application/json:
schema:
$ref: "#/components/schemas/Error"
"500":
description: Internel server error
content:
application/json:
schema:
oneOf:
- $ref: "#/components/schemas/Error"
- $ref: "#/components/schemas/422Error"
- $ref: "#/components/schemas/errorMessage"
components:
schemas:
MarketDataRequest:
type: object
description: Retrieve mids for all actively traded coins
required:
- type
properties:
type:
type: string
description: The type of market data to retrieve.
example: allMids
OpenOrdersRequest:
type: object
description: Retrieve a user's open orders
required:
- type
- user
properties:
type:
type: string
description: Request type to see open orders.
example: openOrders
user:
type: string
description: Address in 42-character hexadecimal format.
example: "0x0000000000000000000000000000000000000000"
FrontendOpenOrdersRequest:
type: object
description: Retrieve a user's open orders with additional frontend info
required:
- type
- user
properties:
type:
type: string
description: Request type to see frontend open orders.
example: frontendOpenOrders
user:
type: string
description: Address in 42-character hexadecimal format.
example: "0x0000000000000000000000000000000000000000"
additionalProperties: false
MarketDataResponse:
type: object
properties:
APE:
type: string
example: "4.33245"
description: APE market data value.
ARB:
type: string
example: "1.21695"
description: ARB market data value.
OpenOrdersResponse:
type: array
items:
type: object
properties:
coin:
type: string
example: BTC
description: The cryptocurrency coin.
limitPx:
type: string
example: "29792.0"
description: The limit price for the order.
oid:
type: integer
example: 91490942
description: The order ID.
side:
type: string
example: A
description: The side of the order (e.g., Buy or Sell).
sz:
type: string
example: "0.0"
description: The size of the order.
timestamp:
type: integer
example: 1681247412573
description: The timestamp of the order.
FrontendOpenOrdersResponse:
type: array
items:
type: object
properties:
coin:
type: string
example: BTC
description: The cryptocurrency coin.
isPositionTpsl:
type: boolean
example: false
description: Whether the order is a position TPSL.
isTrigger:
type: boolean
example: false
description: Whether the order is a trigger order.
limitPx:
type: string
example: "29792.0"
description: The limit price for the order.
oid:
type: integer
example: 91490942
description: The order ID.
orderType:
type: string
example: Limit
description: The type of the order.
origSz:
type: string
example: "5.0"
description: The original size of the order.
reduceOnly:
type: boolean
example: false
description: Whether the order is reduce-only.
side:
type: string
example: A
description: The side of the order (e.g., Buy or Sell).
sz:
type: string
example: "5.0"
description: The size of the order.
timestamp:
type: integer
example: 1681247412573
description: The timestamp of the order.
triggerCondition:
type: string
example: N/A
description: The trigger condition for the order.
triggerPx:
type: string
example: "0.0"
description: The trigger price for the order.
additionalProperties: false
UserFillsRequest:
type: object
description: Retrieve a user's fills
required:
- type
- user
properties:
type:
type: string
example: userFills
user:
type: string
description: Address in 42-character hexadecimal format.
example: "0x0000000000000000000000000000000000000000"
UserFillsResponse:
type: array
items:
type: object
properties:
closedPnl:
type: string
example: "0.0"
description: The closed PnL for the fill.
coin:
type: string
example: AVAX
description: The cryptocurrency coin involved in the fill.
crossed:
type: boolean
example: false
description: Whether the order was crossed.
dir:
type: string
example: Open Long
description: The direction of the order (e.g., Open Long).
hash:
type: string
example: "0xa166e3fa63c25663024b03f2e0da011a00307e4017465df020210d3d432e7cb8"
description: The transaction hash.
oid:
type: integer
example: 90542681
description: The order ID.
px:
type: string
example: "18.435"
description: The price at which the fill occurred.
side:
type: string
example: B
description: The side of the order (e.g., Buy or Sell).
startPosition:
type: string
example: "26.86"
description: The starting position of the order.
sz:
type: string
example: "93.53"
description: The size of the fill.
time:
type: integer
example: 1681222254710
description: The timestamp of the fill.
UserFillsByTimeRequest:
type: object
required:
- type
- user
- startTime
description: Retrieve a user's fills by time
properties:
type:
type: string
description: Request type to retrieve user fills by time.
example: userFillsByTime
user:
type: string
description: Address in 42-character hexadecimal format.
example: "0x0000000000000000000000000000000000000000"
startTime:
type: integer
description: Start time in milliseconds, inclusive.
example: 1681222254710
endTime:
type: integer
description: End time in milliseconds, inclusive. Defaults to current time.
example: 1681226254710
UserFillsByTimeResponse:
type: array
items:
type: object
properties:
closedPnl:
type: string
example: "0.0"
description: The closed PnL for the fill.
coin:
type: string
example: AVAX
description: The cryptocurrency coin involved in the fill.
crossed:
type: boolean
example: false
description: Whether the order was crossed.
dir:
type: string
example: Open Long
description: The direction of the order (e.g., Open Long).
hash:
type: string
example: "0xa166e3fa63c25663024b03f2e0da011a00307e4017465df020210d3d432e7cb8"
description: The transaction hash.
oid:
type: integer
example: 90542681
description: The order ID.
px:
type: string
example: "18.435"
description: The price at which the fill occurred.
side:
type: string
example: B
description: The side of the order (e.g., Buy or Sell).
startPosition:
type: string
example: "26.86"
description: The starting position of the order.
sz:
type: string
example: "93.53"
description: The size of the fill.
time:
type: integer
example: 1681222254710
description: The timestamp of the fill.
UserRateLimitRequest:
type: object
required:
- user
- type
properties:
user:
type: string
description: Address in 42-character hexadecimal format.
example: "0x0000000000000000000000000000000000000000"
type:
type: string
description: Request type to check user rate limits.
example: userRateLimit
additionalProperties: false
OrderStatusRequest:
type: object
required:
- user
- type
- oid
description: Query order status by oid or cloid
properties:
user:
type: string
description: Address in 42-character hexadecimal format.
example: "0x0000000000000000000000000000000000000000"
type:
type: string
description: Request type to query order status.
example: orderStatus
oid:
type: string
description: >-
Either a u64 representing the order id or a 16-byte hex string
representing the client order id.
example: "12345678901234567890123456789012"
additionalProperties: false
OrderStatusResponse:
type: object
properties:
orderId:
type: string
description: The ID of the order.
example: "12345678901234567890123456789012"
status:
type: string
description: The current status of the order.
example: Completed
timestamp:
type: integer
description: The timestamp when the status was last updated.
example: 1681222254710
L2BookRequest:
type: object
required:
- type
- coin
description: L2 Book snapshot
properties:
type:
type: string
description: Request type to retrieve the level 2 order book.
example: l2Book
coin:
type: string
description: The cryptocurrency coin for which to retrieve the order book.
example: BTC
additionalProperties: false
L2BookResponse:
type: array
items:
type: array
items:
type: object
properties:
px:
type: string
description: The price level.
example: "19900"
sz:
type: string
description: The size of the order at this price level.
example: "1"
"n":
type: integer
description: The order rank or identifier.
example: 1
description: Level 2 order book, with separate arrays for bid and ask sides.
example:
- - px: "19900"
sz: "1"
"n": 1
- px: "19800"
sz: "2"
"n": 2
- px: "19700"
sz: "3"
"n": 3
- - px: "20100"
sz: "1"
"n": 1
- px: "20200"
sz: "2"
"n": 2
- px: "20300"
sz: "3"
"n": 3
CandleSnapshotRequest:
type: object
required:
- type
- req
description: Candle snapshot
properties:
type:
type: string
description: Request type to retrieve candle snapshots.
example: candleSnapshot
req:
type: object
required:
- coin
- interval
- startTime
- endTime
properties:
coin:
type: string
description: The cryptocurrency coin for which to retrieve candle data.
example: BTC
interval:
type: string
description: The time interval for the candles (e.g., "15m").
example: 15m
startTime:
type: integer
description: Start time in epoch milliseconds.
example: 1681923600000
endTime:
type: integer
description: End time in epoch milliseconds.
example: 1681924499999
additionalProperties: false
CandleSnapshotResponse:
type: array
items:
type: array
items:
type: object
properties:
T:
type: integer
description: The end time of the candle in epoch milliseconds.
example: 1681924499999
c:
type: string
description: The closing price of the candle.
example: "29258.0"
h:
type: string
description: The highest price during the candle interval.
example: "29309.0"
i:
type: string
description: The interval for the candle.
example: 15m
l:
type: string
description: The lowest price during the candle interval.
example: "29250.0"
"n":
type: integer
description: The number of trades during the candle interval.
example: 189
o:
type: string
description: The opening price of the candle.
example: "29295.0"
s:
type: string
description: The cryptocurrency coin symbol.
example: BTC
t:
type: integer
description: The start time of the candle in epoch milliseconds.
example: 1681923600000
v:
type: string
description: The volume of trades during the candle interval.
example: "0.98639"
description: An array of candle snapshots for the specified parameters.
example:
- T: 1681924499999
c: "29258.0"
h: "29309.0"
i: 15m
l: "29250.0"
"n": 189
o: "29295.0"
s: BTC
t: 1681923600000
v: "0.98639"
MetaRequest:
type: object
required:
- type
properties:
type:
type: string
description: Request type to retrieve metadata.
example: meta
additionalProperties: false
MetaResponse:
type: object
properties:
universe:
type: array
items:
type: object
properties:
name:
type: string
description: The name of the asset or universe.
example: BTC
szDecimals:
type: integer
description: The number of decimal places for sizes.
example: 5
maxLeverage:
type: integer
description: The maximum leverage allowed for the asset.
example: 50
onlyIsolated:
type: boolean
description: Indicates if only isolated margin is allowed.
example: false
description: Retrieve perpetuals metadata
example:
universe:
- name: BTC
szDecimals: 5
maxLeverage: 50
onlyIsolated: false
- name: ETH
szDecimals: 4
maxLeverage: 50
onlyIsolated: false
- name: HPOS
szDecimals: 0
maxLeverage: 3
onlyIsolated: true
MetaAndAssetCtxsRequest:
type: object
required:
- type
description: >-
Retrieve perpetuals asset contexts (includes mark price, current
funding, open interest, etc)
properties:
type:
type: string
description: Request type to retrieve metadata and asset contexts.
example: metaAndAssetCtxs
MetaAndAssetCtxsResponse:
type: object
properties:
universe:
type: array
description: Metadata about available assets or universes.
items:
type: object
properties:
name:
type: string
description: The name of the asset or universe.
example: BTC
szDecimals:
type: integer
description: The number of decimal places for sizes.
example: 5
maxLeverage:
type: integer
description: The maximum leverage allowed for the asset.
example: 50
onlyIsolated:
type: boolean
description: Indicates if only isolated margin is allowed.
example: false
assetContexts:
type: array
description: Asset context information.
items:
type: object
properties:
dayNtlVlm:
type: string
description: The daily notional volume.
example: "1169046.29406"
funding:
type: string
description: The funding rate.
example: "0.0000125"
impactPxs:
type: array
description: Impact prices for the asset.
items:
type: string
example: "14.3047"
markPx:
type: string
description: The mark price of the asset.
example: "14.3161"
midPx:
type: string
description: The mid price of the asset.
example: "14.314"
openInterest:
type: string
description: The open interest for the asset.
example: "688.11"
oraclePx:
type: string
description: The oracle price of the asset.
example: "14.32"
premium:
type: string
description: The premium of the asset.
example: "0.00031774"
prevDayPx:
type: string
description: The previous day's price of the asset.
example: "15.322"
required:
- universe
- assetContexts
description: Metadata and asset context information.
example:
universe:
- name: BTC
szDecimals: 5
maxLeverage: 50
onlyIsolated: false
- name: ETH
szDecimals: 4
maxLeverage: 50
onlyIsolated: false
- name: HPOS
szDecimals: 0
maxLeverage: 3
onlyIsolated: true
assetContexts:
- dayNtlVlm: "1169046.29406"
funding: "0.0000125"
impactPxs:
- "14.3047"
- "14.3444"
markPx: "14.3161"
midPx: "14.314"
openInterest: "688.11"
oraclePx: "14.32"
premium: "0.00031774"
prevDayPx: "15.322"
- dayNtlVlm: "1426126.295175"
funding: "0.0000125"
impactPxs:
- "6.0386"
- "6.0562"
markPx: "6.0436"
midPx: "6.0431"
openInterest: "1882.55"
oraclePx: "6.0457"
premium: "0.00028119"
prevDayPx: "6.3611"
- dayNtlVlm: "809774.565507"
funding: "0.0000125"
impactPxs:
- "8.4505"
- "8.4722"
markPx: "8.4542"
midPx: "8.4557"
openInterest: "2912.05"
oraclePx: "8.4585"
premium: "0.00033694"
prevDayPx: "8.8097"
ClearinghouseStateRequest:
type: object
description: Retrieve user's perpetuals account summary
properties:
type:
type: string
description: The type of the request.
example: clearinghouseState
user:
type: string
description: Onchain address in 42-character hexadecimal format.
example: "0x0000000000000000000000000000000000000000"
required:
- type
- user
ClearinghouseStateResponse:
type: object
properties:
assetPositions:
type: array
description: Details of the user's open positions.
items:
type: object
properties:
position:
type: object
properties:
coin:
type: string
description: The cryptocurrency or asset symbol.
example: ETH
cumFunding:
type: object
description: Cumulative funding details.
properties: