@pear-protocol/core-sdk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1145 @@
1
+ import { HttpTypes } from '@pear-protocol/types';
2
+ import { HttpClient } from '../http.js';
3
+ import { ClientHeaders } from '../types.js';
4
+
5
+ declare class Trade {
6
+ private client;
7
+ constructor(client: HttpClient);
8
+ open(body: HttpTypes.CreateTradeOpen, headers?: ClientHeaders): Promise<{
9
+ execution: {
10
+ id: string;
11
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
12
+ status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED" | "IDLE";
13
+ createdAt: string;
14
+ updatedAt: string;
15
+ intent: "OPEN";
16
+ orderType: "MARKET";
17
+ legs: [{
18
+ symbol: string;
19
+ side: "BUY" | "SELL";
20
+ mode: "QUANTITY" | "USD";
21
+ amount: string;
22
+ reduceOnly: boolean;
23
+ }, ...{
24
+ symbol: string;
25
+ side: "BUY" | "SELL";
26
+ mode: "QUANTITY" | "USD";
27
+ amount: string;
28
+ reduceOnly: boolean;
29
+ }[]];
30
+ error?: string | undefined;
31
+ orders?: {
32
+ id: string;
33
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
34
+ status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
35
+ createdAt: string;
36
+ updatedAt: string;
37
+ type: "MARKET";
38
+ symbol: string;
39
+ side: "BUY" | "SELL";
40
+ reduceOnly: boolean;
41
+ leverage: number;
42
+ quantity: string;
43
+ price: string;
44
+ filledQuantity: string;
45
+ error?: string | undefined;
46
+ filledPrice?: string | undefined;
47
+ }[] | undefined;
48
+ } | {
49
+ id: string;
50
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
51
+ status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED" | "IDLE";
52
+ createdAt: string;
53
+ updatedAt: string;
54
+ intent: "ADJUST";
55
+ orderType: "MARKET";
56
+ position: {
57
+ id: string;
58
+ exposure: Record<string, string>;
59
+ };
60
+ legs: [{
61
+ symbol: string;
62
+ side: "BUY" | "SELL";
63
+ mode: "QUANTITY" | "USD";
64
+ amount: string;
65
+ reduceOnly: boolean;
66
+ }, ...{
67
+ symbol: string;
68
+ side: "BUY" | "SELL";
69
+ mode: "QUANTITY" | "USD";
70
+ amount: string;
71
+ reduceOnly: boolean;
72
+ }[]];
73
+ error?: string | undefined;
74
+ orders?: {
75
+ id: string;
76
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
77
+ status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
78
+ createdAt: string;
79
+ updatedAt: string;
80
+ type: "MARKET";
81
+ symbol: string;
82
+ side: "BUY" | "SELL";
83
+ reduceOnly: boolean;
84
+ leverage: number;
85
+ quantity: string;
86
+ price: string;
87
+ filledQuantity: string;
88
+ error?: string | undefined;
89
+ filledPrice?: string | undefined;
90
+ }[] | undefined;
91
+ } | {
92
+ id: string;
93
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
94
+ status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED" | "IDLE";
95
+ createdAt: string;
96
+ updatedAt: string;
97
+ intent: "CLOSE";
98
+ orderType: "MARKET";
99
+ position: {
100
+ id: string;
101
+ exposure: Record<string, string>;
102
+ };
103
+ error?: string | undefined;
104
+ orders?: {
105
+ id: string;
106
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
107
+ status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
108
+ createdAt: string;
109
+ updatedAt: string;
110
+ type: "MARKET";
111
+ symbol: string;
112
+ side: "BUY" | "SELL";
113
+ reduceOnly: boolean;
114
+ leverage: number;
115
+ quantity: string;
116
+ price: string;
117
+ filledQuantity: string;
118
+ error?: string | undefined;
119
+ filledPrice?: string | undefined;
120
+ }[] | undefined;
121
+ };
122
+ }>;
123
+ adjust(positionId: string, body: HttpTypes.CreateTradeAdjust, headers?: ClientHeaders): Promise<{
124
+ execution: {
125
+ id: string;
126
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
127
+ status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED" | "IDLE";
128
+ createdAt: string;
129
+ updatedAt: string;
130
+ intent: "OPEN";
131
+ orderType: "MARKET";
132
+ legs: [{
133
+ symbol: string;
134
+ side: "BUY" | "SELL";
135
+ mode: "QUANTITY" | "USD";
136
+ amount: string;
137
+ reduceOnly: boolean;
138
+ }, ...{
139
+ symbol: string;
140
+ side: "BUY" | "SELL";
141
+ mode: "QUANTITY" | "USD";
142
+ amount: string;
143
+ reduceOnly: boolean;
144
+ }[]];
145
+ error?: string | undefined;
146
+ orders?: {
147
+ id: string;
148
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
149
+ status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
150
+ createdAt: string;
151
+ updatedAt: string;
152
+ type: "MARKET";
153
+ symbol: string;
154
+ side: "BUY" | "SELL";
155
+ reduceOnly: boolean;
156
+ leverage: number;
157
+ quantity: string;
158
+ price: string;
159
+ filledQuantity: string;
160
+ error?: string | undefined;
161
+ filledPrice?: string | undefined;
162
+ }[] | undefined;
163
+ } | {
164
+ id: string;
165
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
166
+ status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED" | "IDLE";
167
+ createdAt: string;
168
+ updatedAt: string;
169
+ intent: "ADJUST";
170
+ orderType: "MARKET";
171
+ position: {
172
+ id: string;
173
+ exposure: Record<string, string>;
174
+ };
175
+ legs: [{
176
+ symbol: string;
177
+ side: "BUY" | "SELL";
178
+ mode: "QUANTITY" | "USD";
179
+ amount: string;
180
+ reduceOnly: boolean;
181
+ }, ...{
182
+ symbol: string;
183
+ side: "BUY" | "SELL";
184
+ mode: "QUANTITY" | "USD";
185
+ amount: string;
186
+ reduceOnly: boolean;
187
+ }[]];
188
+ error?: string | undefined;
189
+ orders?: {
190
+ id: string;
191
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
192
+ status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
193
+ createdAt: string;
194
+ updatedAt: string;
195
+ type: "MARKET";
196
+ symbol: string;
197
+ side: "BUY" | "SELL";
198
+ reduceOnly: boolean;
199
+ leverage: number;
200
+ quantity: string;
201
+ price: string;
202
+ filledQuantity: string;
203
+ error?: string | undefined;
204
+ filledPrice?: string | undefined;
205
+ }[] | undefined;
206
+ } | {
207
+ id: string;
208
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
209
+ status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED" | "IDLE";
210
+ createdAt: string;
211
+ updatedAt: string;
212
+ intent: "CLOSE";
213
+ orderType: "MARKET";
214
+ position: {
215
+ id: string;
216
+ exposure: Record<string, string>;
217
+ };
218
+ error?: string | undefined;
219
+ orders?: {
220
+ id: string;
221
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
222
+ status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
223
+ createdAt: string;
224
+ updatedAt: string;
225
+ type: "MARKET";
226
+ symbol: string;
227
+ side: "BUY" | "SELL";
228
+ reduceOnly: boolean;
229
+ leverage: number;
230
+ quantity: string;
231
+ price: string;
232
+ filledQuantity: string;
233
+ error?: string | undefined;
234
+ filledPrice?: string | undefined;
235
+ }[] | undefined;
236
+ };
237
+ }>;
238
+ close(positionId: string, body: HttpTypes.CreateTradeClose, headers?: ClientHeaders): Promise<{
239
+ execution: {
240
+ id: string;
241
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
242
+ status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED" | "IDLE";
243
+ createdAt: string;
244
+ updatedAt: string;
245
+ intent: "OPEN";
246
+ orderType: "MARKET";
247
+ legs: [{
248
+ symbol: string;
249
+ side: "BUY" | "SELL";
250
+ mode: "QUANTITY" | "USD";
251
+ amount: string;
252
+ reduceOnly: boolean;
253
+ }, ...{
254
+ symbol: string;
255
+ side: "BUY" | "SELL";
256
+ mode: "QUANTITY" | "USD";
257
+ amount: string;
258
+ reduceOnly: boolean;
259
+ }[]];
260
+ error?: string | undefined;
261
+ orders?: {
262
+ id: string;
263
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
264
+ status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
265
+ createdAt: string;
266
+ updatedAt: string;
267
+ type: "MARKET";
268
+ symbol: string;
269
+ side: "BUY" | "SELL";
270
+ reduceOnly: boolean;
271
+ leverage: number;
272
+ quantity: string;
273
+ price: string;
274
+ filledQuantity: string;
275
+ error?: string | undefined;
276
+ filledPrice?: string | undefined;
277
+ }[] | undefined;
278
+ } | {
279
+ id: string;
280
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
281
+ status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED" | "IDLE";
282
+ createdAt: string;
283
+ updatedAt: string;
284
+ intent: "ADJUST";
285
+ orderType: "MARKET";
286
+ position: {
287
+ id: string;
288
+ exposure: Record<string, string>;
289
+ };
290
+ legs: [{
291
+ symbol: string;
292
+ side: "BUY" | "SELL";
293
+ mode: "QUANTITY" | "USD";
294
+ amount: string;
295
+ reduceOnly: boolean;
296
+ }, ...{
297
+ symbol: string;
298
+ side: "BUY" | "SELL";
299
+ mode: "QUANTITY" | "USD";
300
+ amount: string;
301
+ reduceOnly: boolean;
302
+ }[]];
303
+ error?: string | undefined;
304
+ orders?: {
305
+ id: string;
306
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
307
+ status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
308
+ createdAt: string;
309
+ updatedAt: string;
310
+ type: "MARKET";
311
+ symbol: string;
312
+ side: "BUY" | "SELL";
313
+ reduceOnly: boolean;
314
+ leverage: number;
315
+ quantity: string;
316
+ price: string;
317
+ filledQuantity: string;
318
+ error?: string | undefined;
319
+ filledPrice?: string | undefined;
320
+ }[] | undefined;
321
+ } | {
322
+ id: string;
323
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
324
+ status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED" | "IDLE";
325
+ createdAt: string;
326
+ updatedAt: string;
327
+ intent: "CLOSE";
328
+ orderType: "MARKET";
329
+ position: {
330
+ id: string;
331
+ exposure: Record<string, string>;
332
+ };
333
+ error?: string | undefined;
334
+ orders?: {
335
+ id: string;
336
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
337
+ status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
338
+ createdAt: string;
339
+ updatedAt: string;
340
+ type: "MARKET";
341
+ symbol: string;
342
+ side: "BUY" | "SELL";
343
+ reduceOnly: boolean;
344
+ leverage: number;
345
+ quantity: string;
346
+ price: string;
347
+ filledQuantity: string;
348
+ error?: string | undefined;
349
+ filledPrice?: string | undefined;
350
+ }[] | undefined;
351
+ };
352
+ }>;
353
+ closeAll(body: HttpTypes.CreateTradeCloseAll, headers?: ClientHeaders): Promise<{
354
+ executions: ({
355
+ id: string;
356
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
357
+ status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED" | "IDLE";
358
+ createdAt: string;
359
+ updatedAt: string;
360
+ intent: "OPEN";
361
+ orderType: "MARKET";
362
+ legs: [{
363
+ symbol: string;
364
+ side: "BUY" | "SELL";
365
+ mode: "QUANTITY" | "USD";
366
+ amount: string;
367
+ reduceOnly: boolean;
368
+ }, ...{
369
+ symbol: string;
370
+ side: "BUY" | "SELL";
371
+ mode: "QUANTITY" | "USD";
372
+ amount: string;
373
+ reduceOnly: boolean;
374
+ }[]];
375
+ error?: string | undefined;
376
+ orders?: {
377
+ id: string;
378
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
379
+ status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
380
+ createdAt: string;
381
+ updatedAt: string;
382
+ type: "MARKET";
383
+ symbol: string;
384
+ side: "BUY" | "SELL";
385
+ reduceOnly: boolean;
386
+ leverage: number;
387
+ quantity: string;
388
+ price: string;
389
+ filledQuantity: string;
390
+ error?: string | undefined;
391
+ filledPrice?: string | undefined;
392
+ }[] | undefined;
393
+ } | {
394
+ id: string;
395
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
396
+ status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED" | "IDLE";
397
+ createdAt: string;
398
+ updatedAt: string;
399
+ intent: "ADJUST";
400
+ orderType: "MARKET";
401
+ position: {
402
+ id: string;
403
+ exposure: Record<string, string>;
404
+ };
405
+ legs: [{
406
+ symbol: string;
407
+ side: "BUY" | "SELL";
408
+ mode: "QUANTITY" | "USD";
409
+ amount: string;
410
+ reduceOnly: boolean;
411
+ }, ...{
412
+ symbol: string;
413
+ side: "BUY" | "SELL";
414
+ mode: "QUANTITY" | "USD";
415
+ amount: string;
416
+ reduceOnly: boolean;
417
+ }[]];
418
+ error?: string | undefined;
419
+ orders?: {
420
+ id: string;
421
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
422
+ status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
423
+ createdAt: string;
424
+ updatedAt: string;
425
+ type: "MARKET";
426
+ symbol: string;
427
+ side: "BUY" | "SELL";
428
+ reduceOnly: boolean;
429
+ leverage: number;
430
+ quantity: string;
431
+ price: string;
432
+ filledQuantity: string;
433
+ error?: string | undefined;
434
+ filledPrice?: string | undefined;
435
+ }[] | undefined;
436
+ } | {
437
+ id: string;
438
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
439
+ status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED" | "IDLE";
440
+ createdAt: string;
441
+ updatedAt: string;
442
+ intent: "CLOSE";
443
+ orderType: "MARKET";
444
+ position: {
445
+ id: string;
446
+ exposure: Record<string, string>;
447
+ };
448
+ error?: string | undefined;
449
+ orders?: {
450
+ id: string;
451
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
452
+ status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
453
+ createdAt: string;
454
+ updatedAt: string;
455
+ type: "MARKET";
456
+ symbol: string;
457
+ side: "BUY" | "SELL";
458
+ reduceOnly: boolean;
459
+ leverage: number;
460
+ quantity: string;
461
+ price: string;
462
+ filledQuantity: string;
463
+ error?: string | undefined;
464
+ filledPrice?: string | undefined;
465
+ }[] | undefined;
466
+ })[];
467
+ }>;
468
+ schedules: {
469
+ create: (body: HttpTypes.CreateSchedule, headers?: ClientHeaders) => Promise<{
470
+ schedule: {
471
+ id: string;
472
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
473
+ status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED";
474
+ positionKey: string;
475
+ executionType: "MARKET";
476
+ startAt: string;
477
+ endAt: string;
478
+ createdAt: string;
479
+ updatedAt: string;
480
+ strategy: "TWAP";
481
+ intent: "OPEN";
482
+ sliceIntervalMs: number;
483
+ sliceLegs: {
484
+ symbol: string;
485
+ side: "BUY" | "SELL";
486
+ mode: "QUANTITY" | "USD";
487
+ stepAmount: string;
488
+ }[];
489
+ targetNotional: string;
490
+ remainingNotional: string;
491
+ lastSliceAt?: string | undefined;
492
+ cancelledAt?: string | undefined;
493
+ cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
494
+ fills?: {
495
+ id: string;
496
+ tradeAccountId: string;
497
+ symbol: string;
498
+ positionId: string;
499
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
500
+ side: "BUY" | "SELL";
501
+ reduceOnly: boolean;
502
+ quantity: string;
503
+ price: string;
504
+ usd: string;
505
+ timestamp: string;
506
+ cloid?: string | undefined;
507
+ fee?: string | undefined;
508
+ }[] | undefined;
509
+ } | {
510
+ id: string;
511
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
512
+ status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED";
513
+ positionKey: string;
514
+ executionType: "MARKET";
515
+ startAt: string;
516
+ endAt: string;
517
+ createdAt: string;
518
+ updatedAt: string;
519
+ strategy: "TWAP";
520
+ intent: "CLOSE";
521
+ sliceIntervalMs: number;
522
+ positionId: string;
523
+ sliceLegs: {
524
+ symbol: string;
525
+ stepAmount: string;
526
+ }[];
527
+ initialExposure: Record<string, string>;
528
+ lastSliceAt?: string | undefined;
529
+ cancelledAt?: string | undefined;
530
+ cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
531
+ fills?: {
532
+ id: string;
533
+ tradeAccountId: string;
534
+ symbol: string;
535
+ positionId: string;
536
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
537
+ side: "BUY" | "SELL";
538
+ reduceOnly: boolean;
539
+ quantity: string;
540
+ price: string;
541
+ usd: string;
542
+ timestamp: string;
543
+ cloid?: string | undefined;
544
+ fee?: string | undefined;
545
+ }[] | undefined;
546
+ };
547
+ }>;
548
+ cancel: (scheduleId: string, headers?: ClientHeaders) => Promise<{
549
+ id: string;
550
+ }>;
551
+ cancelAll: (headers?: ClientHeaders) => Promise<{
552
+ ids: string[];
553
+ }>;
554
+ };
555
+ triggers: {
556
+ open: (body: HttpTypes.CreateTriggerOpen, headers?: ClientHeaders) => Promise<{
557
+ trigger: {
558
+ id: string;
559
+ tradeAccountId: string;
560
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
561
+ status: "CANCELLED" | "ACTIVE" | "TRIGGERED";
562
+ createdAt: string;
563
+ updatedAt: string;
564
+ intent: "OPEN";
565
+ type: "MARKET";
566
+ condition: {
567
+ type: "ratio_v1";
568
+ data: {
569
+ priceSource: "mid" | "mark";
570
+ symbol_a: string;
571
+ symbol_b: string;
572
+ direction: "ABOVE" | "BELOW";
573
+ threshold: number;
574
+ };
575
+ } | {
576
+ type: "price_v1";
577
+ data: {
578
+ priceSource: "mid" | "mark";
579
+ symbol: string;
580
+ direction: "ABOVE" | "BELOW";
581
+ threshold: number;
582
+ };
583
+ } | {
584
+ type: "index_v1";
585
+ data: {
586
+ priceSource: "mid" | "mark";
587
+ basket: {
588
+ symbol: string;
589
+ weight: number;
590
+ }[];
591
+ direction: "ABOVE" | "BELOW";
592
+ threshold: number;
593
+ };
594
+ } | {
595
+ type: "weighted_ratio_v1";
596
+ data: {
597
+ priceSource: "mid" | "mark";
598
+ basket: {
599
+ symbol: string;
600
+ side: "BUY" | "SELL";
601
+ weight: number;
602
+ }[];
603
+ direction: "ABOVE" | "BELOW";
604
+ threshold: number;
605
+ };
606
+ };
607
+ context: {
608
+ type: "MARKET";
609
+ legs: [{
610
+ symbol: string;
611
+ side: "BUY" | "SELL";
612
+ mode: "QUANTITY" | "USD";
613
+ amount: string;
614
+ }, ...{
615
+ symbol: string;
616
+ side: "BUY" | "SELL";
617
+ mode: "QUANTITY" | "USD";
618
+ amount: string;
619
+ }[]];
620
+ };
621
+ triggeredAt?: string | undefined;
622
+ cancelledAt?: string | undefined;
623
+ cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
624
+ fills?: {
625
+ id: string;
626
+ tradeAccountId: string;
627
+ symbol: string;
628
+ positionId: string;
629
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
630
+ side: "BUY" | "SELL";
631
+ reduceOnly: boolean;
632
+ quantity: string;
633
+ price: string;
634
+ usd: string;
635
+ timestamp: string;
636
+ cloid?: string | undefined;
637
+ fee?: string | undefined;
638
+ }[] | undefined;
639
+ } | {
640
+ id: string;
641
+ tradeAccountId: string;
642
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
643
+ status: "CANCELLED" | "ACTIVE" | "TRIGGERED";
644
+ createdAt: string;
645
+ updatedAt: string;
646
+ intent: "ADJUST";
647
+ type: "MARKET";
648
+ condition: {
649
+ type: "ratio_v1";
650
+ data: {
651
+ priceSource: "mid" | "mark";
652
+ symbol_a: string;
653
+ symbol_b: string;
654
+ direction: "ABOVE" | "BELOW";
655
+ threshold: number;
656
+ };
657
+ } | {
658
+ type: "price_v1";
659
+ data: {
660
+ priceSource: "mid" | "mark";
661
+ symbol: string;
662
+ direction: "ABOVE" | "BELOW";
663
+ threshold: number;
664
+ };
665
+ } | {
666
+ type: "index_v1";
667
+ data: {
668
+ priceSource: "mid" | "mark";
669
+ basket: {
670
+ symbol: string;
671
+ weight: number;
672
+ }[];
673
+ direction: "ABOVE" | "BELOW";
674
+ threshold: number;
675
+ };
676
+ } | {
677
+ type: "weighted_ratio_v1";
678
+ data: {
679
+ priceSource: "mid" | "mark";
680
+ basket: {
681
+ symbol: string;
682
+ side: "BUY" | "SELL";
683
+ weight: number;
684
+ }[];
685
+ direction: "ABOVE" | "BELOW";
686
+ threshold: number;
687
+ };
688
+ } | {
689
+ type: "position_value_v1";
690
+ data: {
691
+ priceSource: "mid" | "mark";
692
+ direction: "ABOVE" | "BELOW";
693
+ threshold: number;
694
+ };
695
+ } | {
696
+ type: "position_upnl_value_v1";
697
+ data: {
698
+ priceSource: "mid" | "mark";
699
+ direction: "ABOVE" | "BELOW";
700
+ threshold: number;
701
+ };
702
+ } | {
703
+ type: "position_upnl_percentage_v1";
704
+ data: {
705
+ priceSource: "mid" | "mark";
706
+ direction: "ABOVE" | "BELOW";
707
+ threshold_bps: number;
708
+ };
709
+ };
710
+ context: {
711
+ type: "MARKET";
712
+ position: {
713
+ id: string;
714
+ initialExposure: Record<string, string>;
715
+ };
716
+ legs: [{
717
+ symbol: string;
718
+ side: "BUY" | "SELL";
719
+ mode: "QUANTITY" | "USD";
720
+ amount: string;
721
+ reduceOnly: boolean;
722
+ }, ...{
723
+ symbol: string;
724
+ side: "BUY" | "SELL";
725
+ mode: "QUANTITY" | "USD";
726
+ amount: string;
727
+ reduceOnly: boolean;
728
+ }[]];
729
+ };
730
+ triggeredAt?: string | undefined;
731
+ cancelledAt?: string | undefined;
732
+ cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
733
+ fills?: {
734
+ id: string;
735
+ tradeAccountId: string;
736
+ symbol: string;
737
+ positionId: string;
738
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
739
+ side: "BUY" | "SELL";
740
+ reduceOnly: boolean;
741
+ quantity: string;
742
+ price: string;
743
+ usd: string;
744
+ timestamp: string;
745
+ cloid?: string | undefined;
746
+ fee?: string | undefined;
747
+ }[] | undefined;
748
+ } | {
749
+ id: string;
750
+ tradeAccountId: string;
751
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
752
+ status: "CANCELLED" | "ACTIVE" | "TRIGGERED";
753
+ createdAt: string;
754
+ updatedAt: string;
755
+ intent: "CLOSE";
756
+ type: "MARKET";
757
+ condition: {
758
+ type: "ratio_v1";
759
+ data: {
760
+ priceSource: "mid" | "mark";
761
+ symbol_a: string;
762
+ symbol_b: string;
763
+ direction: "ABOVE" | "BELOW";
764
+ threshold: number;
765
+ };
766
+ } | {
767
+ type: "price_v1";
768
+ data: {
769
+ priceSource: "mid" | "mark";
770
+ symbol: string;
771
+ direction: "ABOVE" | "BELOW";
772
+ threshold: number;
773
+ };
774
+ } | {
775
+ type: "index_v1";
776
+ data: {
777
+ priceSource: "mid" | "mark";
778
+ basket: {
779
+ symbol: string;
780
+ weight: number;
781
+ }[];
782
+ direction: "ABOVE" | "BELOW";
783
+ threshold: number;
784
+ };
785
+ } | {
786
+ type: "weighted_ratio_v1";
787
+ data: {
788
+ priceSource: "mid" | "mark";
789
+ basket: {
790
+ symbol: string;
791
+ side: "BUY" | "SELL";
792
+ weight: number;
793
+ }[];
794
+ direction: "ABOVE" | "BELOW";
795
+ threshold: number;
796
+ };
797
+ } | {
798
+ type: "position_value_v1";
799
+ data: {
800
+ priceSource: "mid" | "mark";
801
+ direction: "ABOVE" | "BELOW";
802
+ threshold: number;
803
+ };
804
+ } | {
805
+ type: "position_upnl_value_v1";
806
+ data: {
807
+ priceSource: "mid" | "mark";
808
+ direction: "ABOVE" | "BELOW";
809
+ threshold: number;
810
+ };
811
+ } | {
812
+ type: "position_upnl_percentage_v1";
813
+ data: {
814
+ priceSource: "mid" | "mark";
815
+ direction: "ABOVE" | "BELOW";
816
+ threshold_bps: number;
817
+ };
818
+ };
819
+ context: {
820
+ type: "MARKET";
821
+ position: {
822
+ id: string;
823
+ initialExposure: Record<string, string>;
824
+ };
825
+ };
826
+ triggeredAt?: string | undefined;
827
+ cancelledAt?: string | undefined;
828
+ cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
829
+ fills?: {
830
+ id: string;
831
+ tradeAccountId: string;
832
+ symbol: string;
833
+ positionId: string;
834
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
835
+ side: "BUY" | "SELL";
836
+ reduceOnly: boolean;
837
+ quantity: string;
838
+ price: string;
839
+ usd: string;
840
+ timestamp: string;
841
+ cloid?: string | undefined;
842
+ fee?: string | undefined;
843
+ }[] | undefined;
844
+ };
845
+ }>;
846
+ close: (body: HttpTypes.CreateTriggerClose, headers?: ClientHeaders) => Promise<{
847
+ trigger: {
848
+ id: string;
849
+ tradeAccountId: string;
850
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
851
+ status: "CANCELLED" | "ACTIVE" | "TRIGGERED";
852
+ createdAt: string;
853
+ updatedAt: string;
854
+ intent: "OPEN";
855
+ type: "MARKET";
856
+ condition: {
857
+ type: "ratio_v1";
858
+ data: {
859
+ priceSource: "mid" | "mark";
860
+ symbol_a: string;
861
+ symbol_b: string;
862
+ direction: "ABOVE" | "BELOW";
863
+ threshold: number;
864
+ };
865
+ } | {
866
+ type: "price_v1";
867
+ data: {
868
+ priceSource: "mid" | "mark";
869
+ symbol: string;
870
+ direction: "ABOVE" | "BELOW";
871
+ threshold: number;
872
+ };
873
+ } | {
874
+ type: "index_v1";
875
+ data: {
876
+ priceSource: "mid" | "mark";
877
+ basket: {
878
+ symbol: string;
879
+ weight: number;
880
+ }[];
881
+ direction: "ABOVE" | "BELOW";
882
+ threshold: number;
883
+ };
884
+ } | {
885
+ type: "weighted_ratio_v1";
886
+ data: {
887
+ priceSource: "mid" | "mark";
888
+ basket: {
889
+ symbol: string;
890
+ side: "BUY" | "SELL";
891
+ weight: number;
892
+ }[];
893
+ direction: "ABOVE" | "BELOW";
894
+ threshold: number;
895
+ };
896
+ };
897
+ context: {
898
+ type: "MARKET";
899
+ legs: [{
900
+ symbol: string;
901
+ side: "BUY" | "SELL";
902
+ mode: "QUANTITY" | "USD";
903
+ amount: string;
904
+ }, ...{
905
+ symbol: string;
906
+ side: "BUY" | "SELL";
907
+ mode: "QUANTITY" | "USD";
908
+ amount: string;
909
+ }[]];
910
+ };
911
+ triggeredAt?: string | undefined;
912
+ cancelledAt?: string | undefined;
913
+ cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
914
+ fills?: {
915
+ id: string;
916
+ tradeAccountId: string;
917
+ symbol: string;
918
+ positionId: string;
919
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
920
+ side: "BUY" | "SELL";
921
+ reduceOnly: boolean;
922
+ quantity: string;
923
+ price: string;
924
+ usd: string;
925
+ timestamp: string;
926
+ cloid?: string | undefined;
927
+ fee?: string | undefined;
928
+ }[] | undefined;
929
+ } | {
930
+ id: string;
931
+ tradeAccountId: string;
932
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
933
+ status: "CANCELLED" | "ACTIVE" | "TRIGGERED";
934
+ createdAt: string;
935
+ updatedAt: string;
936
+ intent: "ADJUST";
937
+ type: "MARKET";
938
+ condition: {
939
+ type: "ratio_v1";
940
+ data: {
941
+ priceSource: "mid" | "mark";
942
+ symbol_a: string;
943
+ symbol_b: string;
944
+ direction: "ABOVE" | "BELOW";
945
+ threshold: number;
946
+ };
947
+ } | {
948
+ type: "price_v1";
949
+ data: {
950
+ priceSource: "mid" | "mark";
951
+ symbol: string;
952
+ direction: "ABOVE" | "BELOW";
953
+ threshold: number;
954
+ };
955
+ } | {
956
+ type: "index_v1";
957
+ data: {
958
+ priceSource: "mid" | "mark";
959
+ basket: {
960
+ symbol: string;
961
+ weight: number;
962
+ }[];
963
+ direction: "ABOVE" | "BELOW";
964
+ threshold: number;
965
+ };
966
+ } | {
967
+ type: "weighted_ratio_v1";
968
+ data: {
969
+ priceSource: "mid" | "mark";
970
+ basket: {
971
+ symbol: string;
972
+ side: "BUY" | "SELL";
973
+ weight: number;
974
+ }[];
975
+ direction: "ABOVE" | "BELOW";
976
+ threshold: number;
977
+ };
978
+ } | {
979
+ type: "position_value_v1";
980
+ data: {
981
+ priceSource: "mid" | "mark";
982
+ direction: "ABOVE" | "BELOW";
983
+ threshold: number;
984
+ };
985
+ } | {
986
+ type: "position_upnl_value_v1";
987
+ data: {
988
+ priceSource: "mid" | "mark";
989
+ direction: "ABOVE" | "BELOW";
990
+ threshold: number;
991
+ };
992
+ } | {
993
+ type: "position_upnl_percentage_v1";
994
+ data: {
995
+ priceSource: "mid" | "mark";
996
+ direction: "ABOVE" | "BELOW";
997
+ threshold_bps: number;
998
+ };
999
+ };
1000
+ context: {
1001
+ type: "MARKET";
1002
+ position: {
1003
+ id: string;
1004
+ initialExposure: Record<string, string>;
1005
+ };
1006
+ legs: [{
1007
+ symbol: string;
1008
+ side: "BUY" | "SELL";
1009
+ mode: "QUANTITY" | "USD";
1010
+ amount: string;
1011
+ reduceOnly: boolean;
1012
+ }, ...{
1013
+ symbol: string;
1014
+ side: "BUY" | "SELL";
1015
+ mode: "QUANTITY" | "USD";
1016
+ amount: string;
1017
+ reduceOnly: boolean;
1018
+ }[]];
1019
+ };
1020
+ triggeredAt?: string | undefined;
1021
+ cancelledAt?: string | undefined;
1022
+ cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
1023
+ fills?: {
1024
+ id: string;
1025
+ tradeAccountId: string;
1026
+ symbol: string;
1027
+ positionId: string;
1028
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
1029
+ side: "BUY" | "SELL";
1030
+ reduceOnly: boolean;
1031
+ quantity: string;
1032
+ price: string;
1033
+ usd: string;
1034
+ timestamp: string;
1035
+ cloid?: string | undefined;
1036
+ fee?: string | undefined;
1037
+ }[] | undefined;
1038
+ } | {
1039
+ id: string;
1040
+ tradeAccountId: string;
1041
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
1042
+ status: "CANCELLED" | "ACTIVE" | "TRIGGERED";
1043
+ createdAt: string;
1044
+ updatedAt: string;
1045
+ intent: "CLOSE";
1046
+ type: "MARKET";
1047
+ condition: {
1048
+ type: "ratio_v1";
1049
+ data: {
1050
+ priceSource: "mid" | "mark";
1051
+ symbol_a: string;
1052
+ symbol_b: string;
1053
+ direction: "ABOVE" | "BELOW";
1054
+ threshold: number;
1055
+ };
1056
+ } | {
1057
+ type: "price_v1";
1058
+ data: {
1059
+ priceSource: "mid" | "mark";
1060
+ symbol: string;
1061
+ direction: "ABOVE" | "BELOW";
1062
+ threshold: number;
1063
+ };
1064
+ } | {
1065
+ type: "index_v1";
1066
+ data: {
1067
+ priceSource: "mid" | "mark";
1068
+ basket: {
1069
+ symbol: string;
1070
+ weight: number;
1071
+ }[];
1072
+ direction: "ABOVE" | "BELOW";
1073
+ threshold: number;
1074
+ };
1075
+ } | {
1076
+ type: "weighted_ratio_v1";
1077
+ data: {
1078
+ priceSource: "mid" | "mark";
1079
+ basket: {
1080
+ symbol: string;
1081
+ side: "BUY" | "SELL";
1082
+ weight: number;
1083
+ }[];
1084
+ direction: "ABOVE" | "BELOW";
1085
+ threshold: number;
1086
+ };
1087
+ } | {
1088
+ type: "position_value_v1";
1089
+ data: {
1090
+ priceSource: "mid" | "mark";
1091
+ direction: "ABOVE" | "BELOW";
1092
+ threshold: number;
1093
+ };
1094
+ } | {
1095
+ type: "position_upnl_value_v1";
1096
+ data: {
1097
+ priceSource: "mid" | "mark";
1098
+ direction: "ABOVE" | "BELOW";
1099
+ threshold: number;
1100
+ };
1101
+ } | {
1102
+ type: "position_upnl_percentage_v1";
1103
+ data: {
1104
+ priceSource: "mid" | "mark";
1105
+ direction: "ABOVE" | "BELOW";
1106
+ threshold_bps: number;
1107
+ };
1108
+ };
1109
+ context: {
1110
+ type: "MARKET";
1111
+ position: {
1112
+ id: string;
1113
+ initialExposure: Record<string, string>;
1114
+ };
1115
+ };
1116
+ triggeredAt?: string | undefined;
1117
+ cancelledAt?: string | undefined;
1118
+ cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
1119
+ fills?: {
1120
+ id: string;
1121
+ tradeAccountId: string;
1122
+ symbol: string;
1123
+ positionId: string;
1124
+ connector: "hyperliquid" | "binanceusdm" | "bybit" | "okx";
1125
+ side: "BUY" | "SELL";
1126
+ reduceOnly: boolean;
1127
+ quantity: string;
1128
+ price: string;
1129
+ usd: string;
1130
+ timestamp: string;
1131
+ cloid?: string | undefined;
1132
+ fee?: string | undefined;
1133
+ }[] | undefined;
1134
+ };
1135
+ }>;
1136
+ cancel: (triggerId: string, headers?: ClientHeaders) => Promise<{
1137
+ id: string;
1138
+ }>;
1139
+ cancelAll: (headers?: ClientHeaders) => Promise<{
1140
+ ids: string[];
1141
+ }>;
1142
+ };
1143
+ }
1144
+
1145
+ export { Trade };