@pear-protocol/core-sdk 0.0.13 → 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,708 +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 Info {
6
- private client;
7
- constructor(client: HttpClient);
8
- accounts: {
9
- list: (query?: HttpTypes.TradeAccountListParamsInput, headers?: ClientHeaders) => Promise<{
10
- accounts: {
11
- id: string;
12
- alias: string;
13
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
14
- exchangeIdentifier: string;
15
- createdAt: string;
16
- updatedAt: string;
17
- metadata?: {
18
- agentWalletAddress: string;
19
- isSubaccount: boolean;
20
- } | undefined;
21
- deletedAt?: string | undefined;
22
- }[];
23
- }>;
24
- create: (body: HttpTypes.CreateTradeAccountInput, headers?: ClientHeaders) => Promise<{
25
- account: {
26
- id: string;
27
- alias: string;
28
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
29
- exchangeIdentifier: string;
30
- createdAt: string;
31
- updatedAt: string;
32
- metadata?: {
33
- agentWalletAddress: string;
34
- isSubaccount: boolean;
35
- } | undefined;
36
- deletedAt?: string | undefined;
37
- };
38
- }>;
39
- update: (id: string, body: HttpTypes.UpdateTradeAccountInput, headers?: ClientHeaders) => Promise<{
40
- account: {
41
- id: string;
42
- alias: string;
43
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
44
- exchangeIdentifier: string;
45
- createdAt: string;
46
- updatedAt: string;
47
- metadata?: {
48
- agentWalletAddress: string;
49
- isSubaccount: boolean;
50
- } | undefined;
51
- deletedAt?: string | undefined;
52
- };
53
- }>;
54
- delete: (id: string, headers?: ClientHeaders) => Promise<void>;
55
- credentials: (id: string, headers?: ClientHeaders) => Promise<{
56
- connector: "hyperliquid";
57
- credentials: {
58
- signer_key: string;
59
- };
60
- } | {
61
- connector: "binance";
62
- credentials: {
63
- read: {
64
- api_key: string;
65
- api_secret: string;
66
- };
67
- write: {
68
- api_key: string;
69
- api_secret: string;
70
- };
71
- };
72
- } | {
73
- connector: "bybit";
74
- credentials: {
75
- api_key: string;
76
- api_secret: string;
77
- };
78
- } | {
79
- connector: "okx";
80
- credentials: {
81
- api_key: string;
82
- api_secret: string;
83
- api_pass: string;
84
- };
85
- }>;
86
- restore: (id: string, headers?: ClientHeaders) => Promise<void>;
87
- };
88
- users: {
89
- profile: (headers?: ClientHeaders) => Promise<{
90
- profile: {
91
- id: string;
92
- displayName: string;
93
- role: "basic" | "pro";
94
- address: string | null;
95
- email: string | null;
96
- emailVerified: boolean;
97
- };
98
- preferences: {
99
- slippageToleranceBps: number;
100
- };
101
- }>;
102
- updateDisplayName: (body: HttpTypes.UpdateUserDisplayName, headers?: ClientHeaders) => Promise<{
103
- displayName: string;
104
- }>;
105
- updatePreferences: (body: HttpTypes.UpdateUserPreferences, headers?: ClientHeaders) => Promise<{
106
- preferences: {
107
- slippageToleranceBps: number;
108
- };
109
- }>;
110
- };
111
- schedules: {
112
- list: (query: HttpTypes.ScheduleListParamsInput, headers?: ClientHeaders) => Promise<{
113
- limit: number;
114
- nextCursor: string | undefined;
115
- schedules: ({
116
- id: string;
117
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
118
- status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED";
119
- positionKey: string;
120
- executionType: "MARKET";
121
- startAt: string;
122
- endAt: string;
123
- createdAt: string;
124
- updatedAt: string;
125
- strategy: "TWAP";
126
- intent: "OPEN";
127
- sliceIntervalMs: number;
128
- sliceLegs: {
129
- symbol: string;
130
- side: "BUY" | "SELL";
131
- mode: "QUANTITY" | "USD";
132
- stepAmount: string;
133
- }[];
134
- targetNotional: string;
135
- remainingNotional: string;
136
- lastSliceAt?: string | undefined;
137
- cancelledAt?: string | undefined;
138
- cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
139
- fills?: {
140
- id: string;
141
- tradeAccountId: string;
142
- symbol: string;
143
- positionId: string;
144
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
145
- side: "BUY" | "SELL";
146
- reduceOnly: boolean;
147
- quantity: string;
148
- price: string;
149
- usd: string;
150
- timestamp: string;
151
- cloid?: string | undefined;
152
- fee?: string | undefined;
153
- }[] | undefined;
154
- } | {
155
- id: string;
156
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
157
- status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED";
158
- positionKey: string;
159
- executionType: "MARKET";
160
- startAt: string;
161
- endAt: string;
162
- createdAt: string;
163
- updatedAt: string;
164
- strategy: "TWAP";
165
- intent: "CLOSE";
166
- sliceIntervalMs: number;
167
- positionId: string;
168
- sliceLegs: {
169
- symbol: string;
170
- stepAmount: string;
171
- }[];
172
- initialExposure: Record<string, string>;
173
- lastSliceAt?: string | undefined;
174
- cancelledAt?: string | undefined;
175
- cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
176
- fills?: {
177
- id: string;
178
- tradeAccountId: string;
179
- symbol: string;
180
- positionId: string;
181
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
182
- side: "BUY" | "SELL";
183
- reduceOnly: boolean;
184
- quantity: string;
185
- price: string;
186
- usd: string;
187
- timestamp: string;
188
- cloid?: string | undefined;
189
- fee?: string | undefined;
190
- }[] | undefined;
191
- })[];
192
- }>;
193
- };
194
- triggers: {
195
- list: (query: HttpTypes.TriggerListParamsInput, headers?: ClientHeaders) => Promise<{
196
- limit: number;
197
- nextCursor: string | undefined;
198
- triggers: ({
199
- id: string;
200
- tradeAccountId: string;
201
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
202
- status: "CANCELLED" | "ACTIVE" | "TRIGGERED";
203
- createdAt: string;
204
- updatedAt: string;
205
- intent: "OPEN";
206
- type: "MARKET";
207
- condition: {
208
- type: "ratio_v1";
209
- data: {
210
- priceSource: "mid" | "mark";
211
- symbol_a: string;
212
- symbol_b: string;
213
- direction: "ABOVE" | "BELOW";
214
- threshold: number;
215
- };
216
- } | {
217
- type: "price_v1";
218
- data: {
219
- priceSource: "mid" | "mark";
220
- symbol: string;
221
- direction: "ABOVE" | "BELOW";
222
- threshold: number;
223
- };
224
- } | {
225
- type: "index_v1";
226
- data: {
227
- priceSource: "mid" | "mark";
228
- basket: {
229
- symbol: string;
230
- weight: number;
231
- }[];
232
- direction: "ABOVE" | "BELOW";
233
- threshold: number;
234
- };
235
- } | {
236
- type: "weighted_ratio_v1";
237
- data: {
238
- priceSource: "mid" | "mark";
239
- basket: {
240
- symbol: string;
241
- side: "BUY" | "SELL";
242
- weight: number;
243
- }[];
244
- direction: "ABOVE" | "BELOW";
245
- threshold: number;
246
- };
247
- };
248
- context: {
249
- type: "MARKET";
250
- legs: [{
251
- symbol: string;
252
- side: "BUY" | "SELL";
253
- mode: "QUANTITY" | "USD";
254
- amount: string;
255
- }, ...{
256
- symbol: string;
257
- side: "BUY" | "SELL";
258
- mode: "QUANTITY" | "USD";
259
- amount: string;
260
- }[]];
261
- };
262
- triggeredAt?: string | undefined;
263
- cancelledAt?: string | undefined;
264
- cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
265
- fills?: {
266
- id: string;
267
- tradeAccountId: string;
268
- symbol: string;
269
- positionId: string;
270
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
271
- side: "BUY" | "SELL";
272
- reduceOnly: boolean;
273
- quantity: string;
274
- price: string;
275
- usd: string;
276
- timestamp: string;
277
- cloid?: string | undefined;
278
- fee?: string | undefined;
279
- }[] | undefined;
280
- bracketType?: "STOP_LOSS" | "TAKE_PROFIT" | undefined;
281
- } | {
282
- id: string;
283
- tradeAccountId: string;
284
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
285
- status: "CANCELLED" | "ACTIVE" | "TRIGGERED";
286
- createdAt: string;
287
- updatedAt: string;
288
- intent: "ADJUST";
289
- type: "MARKET";
290
- condition: {
291
- type: "ratio_v1";
292
- data: {
293
- priceSource: "mid" | "mark";
294
- symbol_a: string;
295
- symbol_b: string;
296
- direction: "ABOVE" | "BELOW";
297
- threshold: number;
298
- };
299
- } | {
300
- type: "price_v1";
301
- data: {
302
- priceSource: "mid" | "mark";
303
- symbol: string;
304
- direction: "ABOVE" | "BELOW";
305
- threshold: number;
306
- };
307
- } | {
308
- type: "index_v1";
309
- data: {
310
- priceSource: "mid" | "mark";
311
- basket: {
312
- symbol: string;
313
- weight: number;
314
- }[];
315
- direction: "ABOVE" | "BELOW";
316
- threshold: number;
317
- };
318
- } | {
319
- type: "weighted_ratio_v1";
320
- data: {
321
- priceSource: "mid" | "mark";
322
- basket: {
323
- symbol: string;
324
- side: "BUY" | "SELL";
325
- weight: number;
326
- }[];
327
- direction: "ABOVE" | "BELOW";
328
- threshold: number;
329
- };
330
- } | {
331
- type: "position_value_v1";
332
- data: {
333
- priceSource: "mid" | "mark";
334
- direction: "ABOVE" | "BELOW";
335
- threshold: number;
336
- };
337
- } | {
338
- type: "position_upnl_value_v1";
339
- data: {
340
- priceSource: "mid" | "mark";
341
- direction: "ABOVE" | "BELOW";
342
- threshold: number;
343
- };
344
- } | {
345
- type: "position_upnl_percentage_v1";
346
- data: {
347
- priceSource: "mid" | "mark";
348
- direction: "ABOVE" | "BELOW";
349
- threshold_bps: number;
350
- };
351
- };
352
- context: {
353
- type: "MARKET";
354
- position: {
355
- id: string;
356
- initialExposure: Record<string, string>;
357
- };
358
- legs: [{
359
- symbol: string;
360
- side: "BUY" | "SELL";
361
- mode: "QUANTITY" | "USD";
362
- amount: string;
363
- reduceOnly: boolean;
364
- }, ...{
365
- symbol: string;
366
- side: "BUY" | "SELL";
367
- mode: "QUANTITY" | "USD";
368
- amount: string;
369
- reduceOnly: boolean;
370
- }[]];
371
- };
372
- triggeredAt?: string | undefined;
373
- cancelledAt?: string | undefined;
374
- cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
375
- fills?: {
376
- id: string;
377
- tradeAccountId: string;
378
- symbol: string;
379
- positionId: string;
380
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
381
- side: "BUY" | "SELL";
382
- reduceOnly: boolean;
383
- quantity: string;
384
- price: string;
385
- usd: string;
386
- timestamp: string;
387
- cloid?: string | undefined;
388
- fee?: string | undefined;
389
- }[] | undefined;
390
- bracketType?: "STOP_LOSS" | "TAKE_PROFIT" | undefined;
391
- } | {
392
- id: string;
393
- tradeAccountId: string;
394
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
395
- status: "CANCELLED" | "ACTIVE" | "TRIGGERED";
396
- createdAt: string;
397
- updatedAt: string;
398
- intent: "CLOSE";
399
- type: "MARKET";
400
- condition: {
401
- type: "ratio_v1";
402
- data: {
403
- priceSource: "mid" | "mark";
404
- symbol_a: string;
405
- symbol_b: string;
406
- direction: "ABOVE" | "BELOW";
407
- threshold: number;
408
- };
409
- } | {
410
- type: "price_v1";
411
- data: {
412
- priceSource: "mid" | "mark";
413
- symbol: string;
414
- direction: "ABOVE" | "BELOW";
415
- threshold: number;
416
- };
417
- } | {
418
- type: "index_v1";
419
- data: {
420
- priceSource: "mid" | "mark";
421
- basket: {
422
- symbol: string;
423
- weight: number;
424
- }[];
425
- direction: "ABOVE" | "BELOW";
426
- threshold: number;
427
- };
428
- } | {
429
- type: "weighted_ratio_v1";
430
- data: {
431
- priceSource: "mid" | "mark";
432
- basket: {
433
- symbol: string;
434
- side: "BUY" | "SELL";
435
- weight: number;
436
- }[];
437
- direction: "ABOVE" | "BELOW";
438
- threshold: number;
439
- };
440
- } | {
441
- type: "position_value_v1";
442
- data: {
443
- priceSource: "mid" | "mark";
444
- direction: "ABOVE" | "BELOW";
445
- threshold: number;
446
- };
447
- } | {
448
- type: "position_upnl_value_v1";
449
- data: {
450
- priceSource: "mid" | "mark";
451
- direction: "ABOVE" | "BELOW";
452
- threshold: number;
453
- };
454
- } | {
455
- type: "position_upnl_percentage_v1";
456
- data: {
457
- priceSource: "mid" | "mark";
458
- direction: "ABOVE" | "BELOW";
459
- threshold_bps: number;
460
- };
461
- };
462
- context: {
463
- type: "MARKET";
464
- position: {
465
- id: string;
466
- initialExposure: Record<string, string>;
467
- };
468
- };
469
- triggeredAt?: string | undefined;
470
- cancelledAt?: string | undefined;
471
- cancelledReason?: "USER" | "POSITION_CLOSED" | "SYSTEM" | undefined;
472
- fills?: {
473
- id: string;
474
- tradeAccountId: string;
475
- symbol: string;
476
- positionId: string;
477
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
478
- side: "BUY" | "SELL";
479
- reduceOnly: boolean;
480
- quantity: string;
481
- price: string;
482
- usd: string;
483
- timestamp: string;
484
- cloid?: string | undefined;
485
- fee?: string | undefined;
486
- }[] | undefined;
487
- bracketType?: "STOP_LOSS" | "TAKE_PROFIT" | undefined;
488
- })[];
489
- }>;
490
- };
491
- positions: {
492
- list: (query: HttpTypes.PositionListParamsInput, headers?: ClientHeaders) => Promise<{
493
- positions: {
494
- id: string;
495
- tradeAccountId: string;
496
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
497
- status: "OPEN" | "CLOSED";
498
- exposure: Record<string, string>;
499
- initialExposureUSD: Record<string, string>;
500
- createdAt: string;
501
- updatedAt: string;
502
- closedReason?: "USER" | "NETTED" | "LIQUIDATED" | null | undefined;
503
- closedAt?: string | null | undefined;
504
- }[];
505
- }>;
506
- };
507
- fills: {
508
- details: (positionId: string, headers?: ClientHeaders) => Promise<{
509
- fills: {
510
- id: string;
511
- tradeAccountId: string;
512
- symbol: string;
513
- positionId: string;
514
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
515
- side: "BUY" | "SELL";
516
- reduceOnly: boolean;
517
- quantity: string;
518
- price: string;
519
- usd: string;
520
- timestamp: string;
521
- cloid?: string | undefined;
522
- fee?: string | undefined;
523
- }[];
524
- }>;
525
- list: (query: HttpTypes.FillListParams, headers?: ClientHeaders) => Promise<{
526
- limit: number;
527
- nextCursor: string | undefined;
528
- fills: {
529
- id: string;
530
- tradeAccountId: string;
531
- symbol: string;
532
- positionId: string;
533
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
534
- side: "BUY" | "SELL";
535
- reduceOnly: boolean;
536
- quantity: string;
537
- price: string;
538
- usd: string;
539
- timestamp: string;
540
- cloid?: string | undefined;
541
- fee?: string | undefined;
542
- }[];
543
- }>;
544
- };
545
- executions: {
546
- list: (query: HttpTypes.ExecutionListParamsInput, headers?: ClientHeaders) => Promise<{
547
- limit: number;
548
- nextCursor: string | undefined;
549
- executions: ({
550
- id: string;
551
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
552
- status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED" | "IDLE";
553
- createdAt: string;
554
- updatedAt: string;
555
- intent: "OPEN";
556
- orderType: "MARKET";
557
- legs: [{
558
- symbol: string;
559
- side: "BUY" | "SELL";
560
- mode: "QUANTITY" | "USD";
561
- amount: string;
562
- reduceOnly: boolean;
563
- }, ...{
564
- symbol: string;
565
- side: "BUY" | "SELL";
566
- mode: "QUANTITY" | "USD";
567
- amount: string;
568
- reduceOnly: boolean;
569
- }[]];
570
- error?: string | undefined;
571
- orders?: {
572
- id: string;
573
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
574
- status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
575
- createdAt: string;
576
- updatedAt: string;
577
- type: "MARKET";
578
- symbol: string;
579
- side: "BUY" | "SELL";
580
- reduceOnly: boolean;
581
- leverage: number;
582
- quantity: string;
583
- price: string;
584
- filledQuantity: string;
585
- error?: string | undefined;
586
- filledPrice?: string | undefined;
587
- }[] | undefined;
588
- } | {
589
- id: string;
590
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
591
- status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED" | "IDLE";
592
- createdAt: string;
593
- updatedAt: string;
594
- intent: "ADJUST";
595
- orderType: "MARKET";
596
- position: {
597
- id: string;
598
- exposure: Record<string, string>;
599
- };
600
- legs: [{
601
- symbol: string;
602
- side: "BUY" | "SELL";
603
- mode: "QUANTITY" | "USD";
604
- amount: string;
605
- reduceOnly: boolean;
606
- }, ...{
607
- symbol: string;
608
- side: "BUY" | "SELL";
609
- mode: "QUANTITY" | "USD";
610
- amount: string;
611
- reduceOnly: boolean;
612
- }[]];
613
- error?: string | undefined;
614
- orders?: {
615
- id: string;
616
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
617
- status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
618
- createdAt: string;
619
- updatedAt: string;
620
- type: "MARKET";
621
- symbol: string;
622
- side: "BUY" | "SELL";
623
- reduceOnly: boolean;
624
- leverage: number;
625
- quantity: string;
626
- price: string;
627
- filledQuantity: string;
628
- error?: string | undefined;
629
- filledPrice?: string | undefined;
630
- }[] | undefined;
631
- } | {
632
- id: string;
633
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
634
- status: "CANCELLED" | "ACTIVE" | "COMPLETED" | "FAILED" | "IDLE";
635
- createdAt: string;
636
- updatedAt: string;
637
- intent: "CLOSE";
638
- orderType: "MARKET";
639
- position: {
640
- id: string;
641
- exposure: Record<string, string>;
642
- };
643
- error?: string | undefined;
644
- orders?: {
645
- id: string;
646
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
647
- status: "CANCELLED" | "PENDING" | "PARTIAL" | "FILLED" | "REJECTED";
648
- createdAt: string;
649
- updatedAt: string;
650
- type: "MARKET";
651
- symbol: string;
652
- side: "BUY" | "SELL";
653
- reduceOnly: boolean;
654
- leverage: number;
655
- quantity: string;
656
- price: string;
657
- filledQuantity: string;
658
- error?: string | undefined;
659
- filledPrice?: string | undefined;
660
- }[] | undefined;
661
- })[];
662
- }>;
663
- };
664
- instruments: {
665
- list: (query: HttpTypes.InstrumentListParams, headers?: ClientHeaders) => Promise<{
666
- instruments: {
667
- id: string;
668
- base: string;
669
- quote: string;
670
- connector: "hyperliquid" | "binance" | "bybit" | "okx";
671
- type: "spot" | "perp" | "hip3";
672
- leverage: number;
673
- precision: {
674
- quantity: {
675
- decimals: number;
676
- step: number;
677
- contractSize: number;
678
- };
679
- price: {
680
- decimals: number;
681
- tick?: number | null | undefined;
682
- sigFigs?: number | null | undefined;
683
- };
684
- notional?: {
685
- min?: number | null | undefined;
686
- max?: number | null | undefined;
687
- } | undefined;
688
- };
689
- }[];
690
- }>;
691
- };
692
- prices: {
693
- list: (query: HttpTypes.PricesQueryParams, headers?: ClientHeaders) => Promise<{
694
- mid: Record<string, string>;
695
- mark: Record<string, string>;
696
- }>;
697
- };
698
- funding: {
699
- list: (query: HttpTypes.FundingQueryParams, headers?: ClientHeaders) => Promise<{
700
- funding: Record<string, {
701
- r: string;
702
- nft: number;
703
- }>;
704
- }>;
705
- };
706
- }
707
-
708
- export { Info };