@pear-protocol/core-sdk 0.0.14 → 0.0.15

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.
@@ -1,1152 +0,0 @@
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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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" | "binance" | "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
- setLeverage(body: HttpTypes.SetLeverage, headers?: ClientHeaders): Promise<Record<string, never>>;
469
- schedules: {
470
- create: (body: HttpTypes.CreateSchedule, headers?: ClientHeaders) => Promise<{
471
- schedule: {
472
- id: string;
473
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
474
- status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED";
475
- positionKey: string;
476
- executionType: "MARKET";
477
- startAt: string;
478
- endAt: string;
479
- createdAt: string;
480
- updatedAt: string;
481
- strategy: "TWAP";
482
- intent: "OPEN";
483
- sliceIntervalMs: number;
484
- sliceLegs: {
485
- symbol: string;
486
- side: "BUY" | "SELL";
487
- mode: "QUANTITY" | "USD";
488
- stepAmount: string;
489
- }[];
490
- targetNotional: string;
491
- remainingNotional: string;
492
- lastSliceAt?: string | undefined;
493
- cancelledAt?: string | undefined;
494
- cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
495
- fills?: {
496
- id: string;
497
- tradeAccountId: string;
498
- symbol: string;
499
- positionId: string;
500
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
501
- side: "BUY" | "SELL";
502
- reduceOnly: boolean;
503
- quantity: string;
504
- price: string;
505
- usd: string;
506
- timestamp: string;
507
- cloid?: string | undefined;
508
- fee?: string | undefined;
509
- }[] | undefined;
510
- } | {
511
- id: string;
512
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
513
- status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED";
514
- positionKey: string;
515
- executionType: "MARKET";
516
- startAt: string;
517
- endAt: string;
518
- createdAt: string;
519
- updatedAt: string;
520
- strategy: "TWAP";
521
- intent: "CLOSE";
522
- sliceIntervalMs: number;
523
- positionId: string;
524
- sliceLegs: {
525
- symbol: string;
526
- stepAmount: string;
527
- }[];
528
- initialExposure: Record<string, string>;
529
- lastSliceAt?: string | undefined;
530
- cancelledAt?: string | undefined;
531
- cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
532
- fills?: {
533
- id: string;
534
- tradeAccountId: string;
535
- symbol: string;
536
- positionId: string;
537
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
538
- side: "BUY" | "SELL";
539
- reduceOnly: boolean;
540
- quantity: string;
541
- price: string;
542
- usd: string;
543
- timestamp: string;
544
- cloid?: string | undefined;
545
- fee?: string | undefined;
546
- }[] | undefined;
547
- };
548
- }>;
549
- cancel: (scheduleId: string, headers?: ClientHeaders) => Promise<{
550
- id: string;
551
- }>;
552
- cancelAll: (headers?: ClientHeaders) => Promise<{
553
- ids: string[];
554
- }>;
555
- };
556
- triggers: {
557
- open: (body: HttpTypes.CreateTriggerOpen, headers?: ClientHeaders) => Promise<{
558
- trigger: {
559
- id: string;
560
- tradeAccountId: string;
561
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
562
- status: "CANCELLED" | "ACTIVE" | "TRIGGERED";
563
- createdAt: string;
564
- updatedAt: string;
565
- intent: "OPEN";
566
- type: "MARKET";
567
- condition: {
568
- type: "ratio_v1";
569
- data: {
570
- priceSource: "mid" | "mark";
571
- symbol_a: string;
572
- symbol_b: string;
573
- direction: "ABOVE" | "BELOW";
574
- threshold: number;
575
- };
576
- } | {
577
- type: "price_v1";
578
- data: {
579
- priceSource: "mid" | "mark";
580
- symbol: string;
581
- direction: "ABOVE" | "BELOW";
582
- threshold: number;
583
- };
584
- } | {
585
- type: "index_v1";
586
- data: {
587
- priceSource: "mid" | "mark";
588
- basket: {
589
- symbol: string;
590
- weight: number;
591
- }[];
592
- direction: "ABOVE" | "BELOW";
593
- threshold: number;
594
- };
595
- } | {
596
- type: "weighted_ratio_v1";
597
- data: {
598
- priceSource: "mid" | "mark";
599
- basket: {
600
- symbol: string;
601
- side: "BUY" | "SELL";
602
- weight: number;
603
- }[];
604
- direction: "ABOVE" | "BELOW";
605
- threshold: number;
606
- };
607
- };
608
- context: {
609
- type: "MARKET";
610
- legs: [{
611
- symbol: string;
612
- side: "BUY" | "SELL";
613
- mode: "QUANTITY" | "USD";
614
- amount: string;
615
- }, ...{
616
- symbol: string;
617
- side: "BUY" | "SELL";
618
- mode: "QUANTITY" | "USD";
619
- amount: string;
620
- }[]];
621
- };
622
- triggeredAt?: string | undefined;
623
- cancelledAt?: string | undefined;
624
- cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
625
- fills?: {
626
- id: string;
627
- tradeAccountId: string;
628
- symbol: string;
629
- positionId: string;
630
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
631
- side: "BUY" | "SELL";
632
- reduceOnly: boolean;
633
- quantity: string;
634
- price: string;
635
- usd: string;
636
- timestamp: string;
637
- cloid?: string | undefined;
638
- fee?: string | undefined;
639
- }[] | undefined;
640
- bracketType?: "STOP_LOSS" | "TAKE_PROFIT" | undefined;
641
- } | {
642
- id: string;
643
- tradeAccountId: string;
644
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
645
- status: "CANCELLED" | "ACTIVE" | "TRIGGERED";
646
- createdAt: string;
647
- updatedAt: string;
648
- intent: "ADJUST";
649
- type: "MARKET";
650
- condition: {
651
- type: "ratio_v1";
652
- data: {
653
- priceSource: "mid" | "mark";
654
- symbol_a: string;
655
- symbol_b: string;
656
- direction: "ABOVE" | "BELOW";
657
- threshold: number;
658
- };
659
- } | {
660
- type: "price_v1";
661
- data: {
662
- priceSource: "mid" | "mark";
663
- symbol: string;
664
- direction: "ABOVE" | "BELOW";
665
- threshold: number;
666
- };
667
- } | {
668
- type: "index_v1";
669
- data: {
670
- priceSource: "mid" | "mark";
671
- basket: {
672
- symbol: string;
673
- weight: number;
674
- }[];
675
- direction: "ABOVE" | "BELOW";
676
- threshold: number;
677
- };
678
- } | {
679
- type: "weighted_ratio_v1";
680
- data: {
681
- priceSource: "mid" | "mark";
682
- basket: {
683
- symbol: string;
684
- side: "BUY" | "SELL";
685
- weight: number;
686
- }[];
687
- direction: "ABOVE" | "BELOW";
688
- threshold: number;
689
- };
690
- } | {
691
- type: "position_value_v1";
692
- data: {
693
- priceSource: "mid" | "mark";
694
- direction: "ABOVE" | "BELOW";
695
- threshold: number;
696
- };
697
- } | {
698
- type: "position_upnl_value_v1";
699
- data: {
700
- priceSource: "mid" | "mark";
701
- direction: "ABOVE" | "BELOW";
702
- threshold: number;
703
- };
704
- } | {
705
- type: "position_upnl_percentage_v1";
706
- data: {
707
- priceSource: "mid" | "mark";
708
- direction: "ABOVE" | "BELOW";
709
- threshold_bps: number;
710
- };
711
- };
712
- context: {
713
- type: "MARKET";
714
- position: {
715
- id: string;
716
- initialExposure: Record<string, string>;
717
- };
718
- legs: [{
719
- symbol: string;
720
- side: "BUY" | "SELL";
721
- mode: "QUANTITY" | "USD";
722
- amount: string;
723
- reduceOnly: boolean;
724
- }, ...{
725
- symbol: string;
726
- side: "BUY" | "SELL";
727
- mode: "QUANTITY" | "USD";
728
- amount: string;
729
- reduceOnly: boolean;
730
- }[]];
731
- };
732
- triggeredAt?: string | undefined;
733
- cancelledAt?: string | undefined;
734
- cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
735
- fills?: {
736
- id: string;
737
- tradeAccountId: string;
738
- symbol: string;
739
- positionId: string;
740
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
741
- side: "BUY" | "SELL";
742
- reduceOnly: boolean;
743
- quantity: string;
744
- price: string;
745
- usd: string;
746
- timestamp: string;
747
- cloid?: string | undefined;
748
- fee?: string | undefined;
749
- }[] | undefined;
750
- bracketType?: "STOP_LOSS" | "TAKE_PROFIT" | undefined;
751
- } | {
752
- id: string;
753
- tradeAccountId: string;
754
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
755
- status: "CANCELLED" | "ACTIVE" | "TRIGGERED";
756
- createdAt: string;
757
- updatedAt: string;
758
- intent: "CLOSE";
759
- type: "MARKET";
760
- condition: {
761
- type: "ratio_v1";
762
- data: {
763
- priceSource: "mid" | "mark";
764
- symbol_a: string;
765
- symbol_b: string;
766
- direction: "ABOVE" | "BELOW";
767
- threshold: number;
768
- };
769
- } | {
770
- type: "price_v1";
771
- data: {
772
- priceSource: "mid" | "mark";
773
- symbol: string;
774
- direction: "ABOVE" | "BELOW";
775
- threshold: number;
776
- };
777
- } | {
778
- type: "index_v1";
779
- data: {
780
- priceSource: "mid" | "mark";
781
- basket: {
782
- symbol: string;
783
- weight: number;
784
- }[];
785
- direction: "ABOVE" | "BELOW";
786
- threshold: number;
787
- };
788
- } | {
789
- type: "weighted_ratio_v1";
790
- data: {
791
- priceSource: "mid" | "mark";
792
- basket: {
793
- symbol: string;
794
- side: "BUY" | "SELL";
795
- weight: number;
796
- }[];
797
- direction: "ABOVE" | "BELOW";
798
- threshold: number;
799
- };
800
- } | {
801
- type: "position_value_v1";
802
- data: {
803
- priceSource: "mid" | "mark";
804
- direction: "ABOVE" | "BELOW";
805
- threshold: number;
806
- };
807
- } | {
808
- type: "position_upnl_value_v1";
809
- data: {
810
- priceSource: "mid" | "mark";
811
- direction: "ABOVE" | "BELOW";
812
- threshold: number;
813
- };
814
- } | {
815
- type: "position_upnl_percentage_v1";
816
- data: {
817
- priceSource: "mid" | "mark";
818
- direction: "ABOVE" | "BELOW";
819
- threshold_bps: number;
820
- };
821
- };
822
- context: {
823
- type: "MARKET";
824
- position: {
825
- id: string;
826
- initialExposure: Record<string, string>;
827
- };
828
- };
829
- triggeredAt?: string | undefined;
830
- cancelledAt?: string | undefined;
831
- cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
832
- fills?: {
833
- id: string;
834
- tradeAccountId: string;
835
- symbol: string;
836
- positionId: string;
837
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
838
- side: "BUY" | "SELL";
839
- reduceOnly: boolean;
840
- quantity: string;
841
- price: string;
842
- usd: string;
843
- timestamp: string;
844
- cloid?: string | undefined;
845
- fee?: string | undefined;
846
- }[] | undefined;
847
- bracketType?: "STOP_LOSS" | "TAKE_PROFIT" | undefined;
848
- };
849
- }>;
850
- close: (body: HttpTypes.CreateTriggerClose, headers?: ClientHeaders) => Promise<{
851
- trigger: {
852
- id: string;
853
- tradeAccountId: string;
854
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
855
- status: "CANCELLED" | "ACTIVE" | "TRIGGERED";
856
- createdAt: string;
857
- updatedAt: string;
858
- intent: "OPEN";
859
- type: "MARKET";
860
- condition: {
861
- type: "ratio_v1";
862
- data: {
863
- priceSource: "mid" | "mark";
864
- symbol_a: string;
865
- symbol_b: string;
866
- direction: "ABOVE" | "BELOW";
867
- threshold: number;
868
- };
869
- } | {
870
- type: "price_v1";
871
- data: {
872
- priceSource: "mid" | "mark";
873
- symbol: string;
874
- direction: "ABOVE" | "BELOW";
875
- threshold: number;
876
- };
877
- } | {
878
- type: "index_v1";
879
- data: {
880
- priceSource: "mid" | "mark";
881
- basket: {
882
- symbol: string;
883
- weight: number;
884
- }[];
885
- direction: "ABOVE" | "BELOW";
886
- threshold: number;
887
- };
888
- } | {
889
- type: "weighted_ratio_v1";
890
- data: {
891
- priceSource: "mid" | "mark";
892
- basket: {
893
- symbol: string;
894
- side: "BUY" | "SELL";
895
- weight: number;
896
- }[];
897
- direction: "ABOVE" | "BELOW";
898
- threshold: number;
899
- };
900
- };
901
- context: {
902
- type: "MARKET";
903
- legs: [{
904
- symbol: string;
905
- side: "BUY" | "SELL";
906
- mode: "QUANTITY" | "USD";
907
- amount: string;
908
- }, ...{
909
- symbol: string;
910
- side: "BUY" | "SELL";
911
- mode: "QUANTITY" | "USD";
912
- amount: string;
913
- }[]];
914
- };
915
- triggeredAt?: string | undefined;
916
- cancelledAt?: string | undefined;
917
- cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
918
- fills?: {
919
- id: string;
920
- tradeAccountId: string;
921
- symbol: string;
922
- positionId: string;
923
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
924
- side: "BUY" | "SELL";
925
- reduceOnly: boolean;
926
- quantity: string;
927
- price: string;
928
- usd: string;
929
- timestamp: string;
930
- cloid?: string | undefined;
931
- fee?: string | undefined;
932
- }[] | undefined;
933
- bracketType?: "STOP_LOSS" | "TAKE_PROFIT" | undefined;
934
- } | {
935
- id: string;
936
- tradeAccountId: string;
937
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
938
- status: "CANCELLED" | "ACTIVE" | "TRIGGERED";
939
- createdAt: string;
940
- updatedAt: string;
941
- intent: "ADJUST";
942
- type: "MARKET";
943
- condition: {
944
- type: "ratio_v1";
945
- data: {
946
- priceSource: "mid" | "mark";
947
- symbol_a: string;
948
- symbol_b: string;
949
- direction: "ABOVE" | "BELOW";
950
- threshold: number;
951
- };
952
- } | {
953
- type: "price_v1";
954
- data: {
955
- priceSource: "mid" | "mark";
956
- symbol: string;
957
- direction: "ABOVE" | "BELOW";
958
- threshold: number;
959
- };
960
- } | {
961
- type: "index_v1";
962
- data: {
963
- priceSource: "mid" | "mark";
964
- basket: {
965
- symbol: string;
966
- weight: number;
967
- }[];
968
- direction: "ABOVE" | "BELOW";
969
- threshold: number;
970
- };
971
- } | {
972
- type: "weighted_ratio_v1";
973
- data: {
974
- priceSource: "mid" | "mark";
975
- basket: {
976
- symbol: string;
977
- side: "BUY" | "SELL";
978
- weight: number;
979
- }[];
980
- direction: "ABOVE" | "BELOW";
981
- threshold: number;
982
- };
983
- } | {
984
- type: "position_value_v1";
985
- data: {
986
- priceSource: "mid" | "mark";
987
- direction: "ABOVE" | "BELOW";
988
- threshold: number;
989
- };
990
- } | {
991
- type: "position_upnl_value_v1";
992
- data: {
993
- priceSource: "mid" | "mark";
994
- direction: "ABOVE" | "BELOW";
995
- threshold: number;
996
- };
997
- } | {
998
- type: "position_upnl_percentage_v1";
999
- data: {
1000
- priceSource: "mid" | "mark";
1001
- direction: "ABOVE" | "BELOW";
1002
- threshold_bps: number;
1003
- };
1004
- };
1005
- context: {
1006
- type: "MARKET";
1007
- position: {
1008
- id: string;
1009
- initialExposure: Record<string, string>;
1010
- };
1011
- legs: [{
1012
- symbol: string;
1013
- side: "BUY" | "SELL";
1014
- mode: "QUANTITY" | "USD";
1015
- amount: string;
1016
- reduceOnly: boolean;
1017
- }, ...{
1018
- symbol: string;
1019
- side: "BUY" | "SELL";
1020
- mode: "QUANTITY" | "USD";
1021
- amount: string;
1022
- reduceOnly: boolean;
1023
- }[]];
1024
- };
1025
- triggeredAt?: string | undefined;
1026
- cancelledAt?: string | undefined;
1027
- cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
1028
- fills?: {
1029
- id: string;
1030
- tradeAccountId: string;
1031
- symbol: string;
1032
- positionId: string;
1033
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
1034
- side: "BUY" | "SELL";
1035
- reduceOnly: boolean;
1036
- quantity: string;
1037
- price: string;
1038
- usd: string;
1039
- timestamp: string;
1040
- cloid?: string | undefined;
1041
- fee?: string | undefined;
1042
- }[] | undefined;
1043
- bracketType?: "STOP_LOSS" | "TAKE_PROFIT" | undefined;
1044
- } | {
1045
- id: string;
1046
- tradeAccountId: string;
1047
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
1048
- status: "CANCELLED" | "ACTIVE" | "TRIGGERED";
1049
- createdAt: string;
1050
- updatedAt: string;
1051
- intent: "CLOSE";
1052
- type: "MARKET";
1053
- condition: {
1054
- type: "ratio_v1";
1055
- data: {
1056
- priceSource: "mid" | "mark";
1057
- symbol_a: string;
1058
- symbol_b: string;
1059
- direction: "ABOVE" | "BELOW";
1060
- threshold: number;
1061
- };
1062
- } | {
1063
- type: "price_v1";
1064
- data: {
1065
- priceSource: "mid" | "mark";
1066
- symbol: string;
1067
- direction: "ABOVE" | "BELOW";
1068
- threshold: number;
1069
- };
1070
- } | {
1071
- type: "index_v1";
1072
- data: {
1073
- priceSource: "mid" | "mark";
1074
- basket: {
1075
- symbol: string;
1076
- weight: number;
1077
- }[];
1078
- direction: "ABOVE" | "BELOW";
1079
- threshold: number;
1080
- };
1081
- } | {
1082
- type: "weighted_ratio_v1";
1083
- data: {
1084
- priceSource: "mid" | "mark";
1085
- basket: {
1086
- symbol: string;
1087
- side: "BUY" | "SELL";
1088
- weight: number;
1089
- }[];
1090
- direction: "ABOVE" | "BELOW";
1091
- threshold: number;
1092
- };
1093
- } | {
1094
- type: "position_value_v1";
1095
- data: {
1096
- priceSource: "mid" | "mark";
1097
- direction: "ABOVE" | "BELOW";
1098
- threshold: number;
1099
- };
1100
- } | {
1101
- type: "position_upnl_value_v1";
1102
- data: {
1103
- priceSource: "mid" | "mark";
1104
- direction: "ABOVE" | "BELOW";
1105
- threshold: number;
1106
- };
1107
- } | {
1108
- type: "position_upnl_percentage_v1";
1109
- data: {
1110
- priceSource: "mid" | "mark";
1111
- direction: "ABOVE" | "BELOW";
1112
- threshold_bps: number;
1113
- };
1114
- };
1115
- context: {
1116
- type: "MARKET";
1117
- position: {
1118
- id: string;
1119
- initialExposure: Record<string, string>;
1120
- };
1121
- };
1122
- triggeredAt?: string | undefined;
1123
- cancelledAt?: string | undefined;
1124
- cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
1125
- fills?: {
1126
- id: string;
1127
- tradeAccountId: string;
1128
- symbol: string;
1129
- positionId: string;
1130
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
1131
- side: "BUY" | "SELL";
1132
- reduceOnly: boolean;
1133
- quantity: string;
1134
- price: string;
1135
- usd: string;
1136
- timestamp: string;
1137
- cloid?: string | undefined;
1138
- fee?: string | undefined;
1139
- }[] | undefined;
1140
- bracketType?: "STOP_LOSS" | "TAKE_PROFIT" | undefined;
1141
- };
1142
- }>;
1143
- cancel: (triggerId: string, headers?: ClientHeaders) => Promise<{
1144
- id: string;
1145
- }>;
1146
- cancelAll: (headers?: ClientHeaders) => Promise<{
1147
- ids: string[];
1148
- }>;
1149
- };
1150
- }
1151
-
1152
- export { Trade };