@pear-protocol/types 0.1.0 → 1.1.0

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.
Files changed (49) hide show
  1. package/dist/auth/api-keys.d.ts +67 -0
  2. package/dist/auth/api-keys.js +35 -0
  3. package/dist/auth/index.d.ts +1 -0
  4. package/dist/auth/index.js +1 -0
  5. package/dist/auth/payloads.d.ts +0 -4
  6. package/dist/auth/payloads.js +2 -5
  7. package/dist/bundle.d.ts +2 -0
  8. package/dist/bundle.js +2 -0
  9. package/dist/common/client-id.d.ts +2 -0
  10. package/dist/common/client-id.js +5 -0
  11. package/dist/common/index.d.ts +1 -0
  12. package/dist/common/index.js +1 -0
  13. package/dist/notification/entities.d.ts +108 -0
  14. package/dist/notification/entities.js +61 -0
  15. package/dist/notification/index.d.ts +4 -0
  16. package/dist/notification/index.js +4 -0
  17. package/dist/notification/payloads.d.ts +20 -0
  18. package/dist/notification/payloads.js +9 -0
  19. package/dist/notification/queries.d.ts +13 -0
  20. package/dist/notification/queries.js +25 -0
  21. package/dist/notification/responses.d.ts +67 -0
  22. package/dist/notification/responses.js +20 -0
  23. package/dist/rebalance/payloads.d.ts +1 -0
  24. package/dist/rebalance/payloads.js +6 -1
  25. package/dist/schedule/payloads.d.ts +4 -0
  26. package/dist/schedule/payloads.js +11 -2
  27. package/dist/trade/payloads.d.ts +8 -0
  28. package/dist/trade/payloads.js +21 -4
  29. package/dist/trigger/entities/conditions.d.ts +170 -0
  30. package/dist/trigger/entities/conditions.js +43 -3
  31. package/dist/trigger/entities/index.d.ts +369 -0
  32. package/dist/trigger/index.d.ts +1 -0
  33. package/dist/trigger/index.js +1 -0
  34. package/dist/trigger/oracle.d.ts +31 -0
  35. package/dist/trigger/oracle.js +15 -0
  36. package/dist/trigger/payloads/conditions.d.ts +50 -0
  37. package/dist/trigger/payloads/conditions.js +35 -1
  38. package/dist/trigger/payloads/index.d.ts +90 -0
  39. package/dist/trigger/payloads/index.js +16 -3
  40. package/dist/trigger/responses.d.ts +246 -0
  41. package/dist/triggers/entities.d.ts +34 -0
  42. package/dist/triggers/entities.js +21 -0
  43. package/dist/triggers/index.d.ts +3 -0
  44. package/dist/triggers/index.js +3 -0
  45. package/dist/triggers/queries.d.ts +8 -0
  46. package/dist/triggers/queries.js +10 -0
  47. package/dist/triggers/responses.d.ts +26 -0
  48. package/dist/triggers/responses.js +9 -0
  49. package/package.json +1 -1
@@ -97,6 +97,7 @@ export declare const CreateMarketOpen: z.ZodObject<{
97
97
  activationValue: z.ZodOptional<z.ZodNumber>;
98
98
  }, z.core.$strip>;
99
99
  }, z.core.$strip>]>>;
100
+ clientId: z.ZodOptional<z.ZodString>;
100
101
  }, z.core.$strip>;
101
102
  export declare const CreateMarketAdjust: z.ZodObject<{
102
103
  type: z.ZodLiteral<"MARKET">;
@@ -125,12 +126,15 @@ export declare const CreateMarketAdjust: z.ZodObject<{
125
126
  amount: z.ZodString;
126
127
  reduceOnly: z.ZodBoolean;
127
128
  }, z.core.$strip>>;
129
+ clientId: z.ZodOptional<z.ZodString>;
128
130
  }, z.core.$strip>;
129
131
  export declare const CreateMarketClose: z.ZodObject<{
130
132
  type: z.ZodLiteral<"MARKET">;
133
+ clientId: z.ZodOptional<z.ZodString>;
131
134
  }, z.core.$strip>;
132
135
  export declare const CreateMarketCloseAll: z.ZodObject<{
133
136
  type: z.ZodLiteral<"MARKET">;
137
+ clientId: z.ZodOptional<z.ZodString>;
134
138
  }, z.core.$strip>;
135
139
  export declare const CreateTradeOpen: z.ZodDiscriminatedUnion<[z.ZodObject<{
136
140
  type: z.ZodLiteral<"MARKET">;
@@ -230,6 +234,7 @@ export declare const CreateTradeOpen: z.ZodDiscriminatedUnion<[z.ZodObject<{
230
234
  activationValue: z.ZodOptional<z.ZodNumber>;
231
235
  }, z.core.$strip>;
232
236
  }, z.core.$strip>]>>;
237
+ clientId: z.ZodOptional<z.ZodString>;
233
238
  }, z.core.$strip>], "type">;
234
239
  export declare const CreateTradeAdjust: z.ZodDiscriminatedUnion<[z.ZodObject<{
235
240
  type: z.ZodLiteral<"MARKET">;
@@ -258,12 +263,15 @@ export declare const CreateTradeAdjust: z.ZodDiscriminatedUnion<[z.ZodObject<{
258
263
  amount: z.ZodString;
259
264
  reduceOnly: z.ZodBoolean;
260
265
  }, z.core.$strip>>;
266
+ clientId: z.ZodOptional<z.ZodString>;
261
267
  }, z.core.$strip>], "type">;
262
268
  export declare const CreateTradeClose: z.ZodDiscriminatedUnion<[z.ZodObject<{
263
269
  type: z.ZodLiteral<"MARKET">;
270
+ clientId: z.ZodOptional<z.ZodString>;
264
271
  }, z.core.$strip>], "type">;
265
272
  export declare const CreateTradeCloseAll: z.ZodDiscriminatedUnion<[z.ZodObject<{
266
273
  type: z.ZodLiteral<"MARKET">;
274
+ clientId: z.ZodOptional<z.ZodString>;
267
275
  }, z.core.$strip>], "type">;
268
276
  export type CreateMarketOpen = z.output<typeof CreateMarketOpen>;
269
277
  export type CreateMarketAdjust = z.output<typeof CreateMarketAdjust>;
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { ClientIdCode } from '../common/client-id';
2
3
  import { RefineMinimumOneSymbol, RefineUniqueSymbols } from '../common/refinement';
3
4
  import { TradeLegPostOnly, TradeLeg } from '../common/trade-legs';
4
5
  import { AttachTriggerMarketClose } from '../trigger';
@@ -12,20 +13,36 @@ const CreateMarketOpen = z.object({
12
13
  /**
13
14
  * Close trigger to attach to the execution
14
15
  */
15
- trigger: AttachTriggerMarketClose.optional()
16
+ trigger: AttachTriggerMarketClose.optional(),
17
+ /**
18
+ * Attribution route code (client_ids.code)
19
+ */
20
+ clientId: ClientIdCode
16
21
  });
17
22
  const CreateMarketAdjust = z.object({
18
23
  type: z.literal("MARKET"),
19
24
  /**
20
25
  * Requested legs
21
26
  */
22
- legs: z.tuple([TradeLeg]).rest(TradeLeg).superRefine(RefineMinimumOneSymbol).superRefine(RefineUniqueSymbols).describe("Array of legs to modify the position")
27
+ legs: z.tuple([TradeLeg]).rest(TradeLeg).superRefine(RefineMinimumOneSymbol).superRefine(RefineUniqueSymbols).describe("Array of legs to modify the position"),
28
+ /**
29
+ * Attribution route code (client_ids.code)
30
+ */
31
+ clientId: ClientIdCode
23
32
  });
24
33
  const CreateMarketClose = z.object({
25
- type: z.literal("MARKET")
34
+ type: z.literal("MARKET"),
35
+ /**
36
+ * Attribution route code (client_ids.code)
37
+ */
38
+ clientId: ClientIdCode
26
39
  });
27
40
  const CreateMarketCloseAll = z.object({
28
- type: z.literal("MARKET")
41
+ type: z.literal("MARKET"),
42
+ /**
43
+ * Attribution route code (client_ids.code)
44
+ */
45
+ clientId: ClientIdCode
29
46
  });
30
47
  const CreateTradeOpen = z.discriminatedUnion("type", [CreateMarketOpen]);
31
48
  const CreateTradeAdjust = z.discriminatedUnion("type", [CreateMarketAdjust]);
@@ -94,6 +94,50 @@ declare const UpnlBps: z.ZodObject<{
94
94
  threshold: z.ZodNumber;
95
95
  }, z.core.$strip>;
96
96
  }, z.core.$strip>;
97
+ declare const FundingRate: z.ZodObject<{
98
+ type: z.ZodLiteral<"funding_rate">;
99
+ data: z.ZodObject<{
100
+ connector: z.ZodEnum<{
101
+ hyperliquid: "hyperliquid";
102
+ binance: "binance";
103
+ bybit: "bybit";
104
+ okx: "okx";
105
+ lighter: "lighter";
106
+ }>;
107
+ symbol: z.ZodString;
108
+ track: z.ZodEnum<{
109
+ PEAK: "PEAK";
110
+ TROUGH: "TROUGH";
111
+ }>;
112
+ threshold: z.ZodNumber;
113
+ }, z.core.$strip>;
114
+ }, z.core.$strip>;
115
+ declare const PredictionMarket: z.ZodObject<{
116
+ type: z.ZodLiteral<"prediction_market">;
117
+ data: z.ZodObject<{
118
+ source: z.ZodEnum<{
119
+ kalshi: "kalshi";
120
+ polymarket: "polymarket";
121
+ }>;
122
+ marketKey: z.ZodString;
123
+ track: z.ZodEnum<{
124
+ PEAK: "PEAK";
125
+ TROUGH: "TROUGH";
126
+ }>;
127
+ threshold: z.ZodNumber;
128
+ }, z.core.$strip>;
129
+ }, z.core.$strip>;
130
+ declare const BtcDominance: z.ZodObject<{
131
+ type: z.ZodLiteral<"btc_dominance">;
132
+ data: z.ZodObject<{
133
+ source: z.ZodLiteral<"coingecko">;
134
+ track: z.ZodEnum<{
135
+ PEAK: "PEAK";
136
+ TROUGH: "TROUGH";
137
+ }>;
138
+ threshold: z.ZodNumber;
139
+ }, z.core.$strip>;
140
+ }, z.core.$strip>;
97
141
  declare const RatioTrailing: z.ZodObject<{
98
142
  type: z.ZodLiteral<"ratio_trailing">;
99
143
  data: z.ZodObject<{
@@ -209,6 +253,47 @@ export declare const TriggerConditionOpen: z.ZodDiscriminatedUnion<[z.ZodObject<
209
253
  }>;
210
254
  threshold: z.ZodNumber;
211
255
  }, z.core.$strip>;
256
+ }, z.core.$strip>, z.ZodObject<{
257
+ type: z.ZodLiteral<"funding_rate">;
258
+ data: z.ZodObject<{
259
+ connector: z.ZodEnum<{
260
+ hyperliquid: "hyperliquid";
261
+ binance: "binance";
262
+ bybit: "bybit";
263
+ okx: "okx";
264
+ lighter: "lighter";
265
+ }>;
266
+ symbol: z.ZodString;
267
+ track: z.ZodEnum<{
268
+ PEAK: "PEAK";
269
+ TROUGH: "TROUGH";
270
+ }>;
271
+ threshold: z.ZodNumber;
272
+ }, z.core.$strip>;
273
+ }, z.core.$strip>, z.ZodObject<{
274
+ type: z.ZodLiteral<"prediction_market">;
275
+ data: z.ZodObject<{
276
+ source: z.ZodEnum<{
277
+ kalshi: "kalshi";
278
+ polymarket: "polymarket";
279
+ }>;
280
+ marketKey: z.ZodString;
281
+ track: z.ZodEnum<{
282
+ PEAK: "PEAK";
283
+ TROUGH: "TROUGH";
284
+ }>;
285
+ threshold: z.ZodNumber;
286
+ }, z.core.$strip>;
287
+ }, z.core.$strip>, z.ZodObject<{
288
+ type: z.ZodLiteral<"btc_dominance">;
289
+ data: z.ZodObject<{
290
+ source: z.ZodLiteral<"coingecko">;
291
+ track: z.ZodEnum<{
292
+ PEAK: "PEAK";
293
+ TROUGH: "TROUGH";
294
+ }>;
295
+ threshold: z.ZodNumber;
296
+ }, z.core.$strip>;
212
297
  }, z.core.$strip>], "type">;
213
298
  export declare const TriggerConditionAdjust: z.ZodDiscriminatedUnion<[z.ZodObject<{
214
299
  type: z.ZodLiteral<"ratio">;
@@ -299,6 +384,47 @@ export declare const TriggerConditionAdjust: z.ZodDiscriminatedUnion<[z.ZodObjec
299
384
  }>;
300
385
  threshold: z.ZodNumber;
301
386
  }, z.core.$strip>;
387
+ }, z.core.$strip>, z.ZodObject<{
388
+ type: z.ZodLiteral<"funding_rate">;
389
+ data: z.ZodObject<{
390
+ connector: z.ZodEnum<{
391
+ hyperliquid: "hyperliquid";
392
+ binance: "binance";
393
+ bybit: "bybit";
394
+ okx: "okx";
395
+ lighter: "lighter";
396
+ }>;
397
+ symbol: z.ZodString;
398
+ track: z.ZodEnum<{
399
+ PEAK: "PEAK";
400
+ TROUGH: "TROUGH";
401
+ }>;
402
+ threshold: z.ZodNumber;
403
+ }, z.core.$strip>;
404
+ }, z.core.$strip>, z.ZodObject<{
405
+ type: z.ZodLiteral<"prediction_market">;
406
+ data: z.ZodObject<{
407
+ source: z.ZodEnum<{
408
+ kalshi: "kalshi";
409
+ polymarket: "polymarket";
410
+ }>;
411
+ marketKey: z.ZodString;
412
+ track: z.ZodEnum<{
413
+ PEAK: "PEAK";
414
+ TROUGH: "TROUGH";
415
+ }>;
416
+ threshold: z.ZodNumber;
417
+ }, z.core.$strip>;
418
+ }, z.core.$strip>, z.ZodObject<{
419
+ type: z.ZodLiteral<"btc_dominance">;
420
+ data: z.ZodObject<{
421
+ source: z.ZodLiteral<"coingecko">;
422
+ track: z.ZodEnum<{
423
+ PEAK: "PEAK";
424
+ TROUGH: "TROUGH";
425
+ }>;
426
+ threshold: z.ZodNumber;
427
+ }, z.core.$strip>;
302
428
  }, z.core.$strip>], "type">;
303
429
  export declare const TriggerConditionClose: z.ZodDiscriminatedUnion<[z.ZodObject<{
304
430
  type: z.ZodLiteral<"ratio">;
@@ -448,6 +574,47 @@ export declare const TriggerConditionClose: z.ZodDiscriminatedUnion<[z.ZodObject
448
574
  mark: "mark";
449
575
  }>;
450
576
  }, z.core.$strip>;
577
+ }, z.core.$strip>, z.ZodObject<{
578
+ type: z.ZodLiteral<"funding_rate">;
579
+ data: z.ZodObject<{
580
+ connector: z.ZodEnum<{
581
+ hyperliquid: "hyperliquid";
582
+ binance: "binance";
583
+ bybit: "bybit";
584
+ okx: "okx";
585
+ lighter: "lighter";
586
+ }>;
587
+ symbol: z.ZodString;
588
+ track: z.ZodEnum<{
589
+ PEAK: "PEAK";
590
+ TROUGH: "TROUGH";
591
+ }>;
592
+ threshold: z.ZodNumber;
593
+ }, z.core.$strip>;
594
+ }, z.core.$strip>, z.ZodObject<{
595
+ type: z.ZodLiteral<"prediction_market">;
596
+ data: z.ZodObject<{
597
+ source: z.ZodEnum<{
598
+ kalshi: "kalshi";
599
+ polymarket: "polymarket";
600
+ }>;
601
+ marketKey: z.ZodString;
602
+ track: z.ZodEnum<{
603
+ PEAK: "PEAK";
604
+ TROUGH: "TROUGH";
605
+ }>;
606
+ threshold: z.ZodNumber;
607
+ }, z.core.$strip>;
608
+ }, z.core.$strip>, z.ZodObject<{
609
+ type: z.ZodLiteral<"btc_dominance">;
610
+ data: z.ZodObject<{
611
+ source: z.ZodLiteral<"coingecko">;
612
+ track: z.ZodEnum<{
613
+ PEAK: "PEAK";
614
+ TROUGH: "TROUGH";
615
+ }>;
616
+ threshold: z.ZodNumber;
617
+ }, z.core.$strip>;
451
618
  }, z.core.$strip>], "type">;
452
619
  export type TriggerConditionRatio = z.output<typeof Ratio>;
453
620
  export type TriggerConditionPrice = z.output<typeof Price>;
@@ -461,6 +628,9 @@ export type TriggerConditionWeightedRatioTrailing = z.output<typeof WeightedRati
461
628
  export type TriggerConditionNotionalTrailing = z.output<typeof NotionalTrailing>;
462
629
  export type TriggerConditionUpnlTrailing = z.output<typeof UpnlTrailing>;
463
630
  export type TriggerConditionUpnlBpsTrailing = z.output<typeof UpnlBpsTrailing>;
631
+ export type TriggerConditionFundingRate = z.output<typeof FundingRate>;
632
+ export type TriggerConditionPredictionMarket = z.output<typeof PredictionMarket>;
633
+ export type TriggerConditionBtcDominance = z.output<typeof BtcDominance>;
464
634
  export type TriggerConditionOpen = z.output<typeof TriggerConditionOpen>;
465
635
  export type TriggerConditionAdjust = z.output<typeof TriggerConditionAdjust>;
466
636
  export type TriggerConditionClose = z.output<typeof TriggerConditionClose>;
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { Side } from '../../common/schema';
3
+ import { Connector } from '../../connector';
3
4
  import { InstrumentId } from '../../instrument';
4
5
  import { PriceSource } from '../../price';
5
6
  import { MetricTrack } from '../common';
@@ -62,6 +63,32 @@ const UpnlBps = z.object({
62
63
  threshold: z.number()
63
64
  })
64
65
  });
66
+ const FundingRate = z.object({
67
+ type: z.literal("funding_rate"),
68
+ data: z.object({
69
+ connector: Connector,
70
+ symbol: InstrumentId,
71
+ track: MetricTrack,
72
+ threshold: z.number()
73
+ })
74
+ });
75
+ const PredictionMarket = z.object({
76
+ type: z.literal("prediction_market"),
77
+ data: z.object({
78
+ source: z.enum(["kalshi", "polymarket"]),
79
+ marketKey: z.string().min(1),
80
+ track: MetricTrack,
81
+ threshold: z.number()
82
+ })
83
+ });
84
+ const BtcDominance = z.object({
85
+ type: z.literal("btc_dominance"),
86
+ data: z.object({
87
+ source: z.literal("coingecko"),
88
+ track: MetricTrack,
89
+ threshold: z.number()
90
+ })
91
+ });
65
92
  const RatioTrailing = z.object({
66
93
  type: z.literal("ratio_trailing"),
67
94
  data: z.object({
@@ -108,14 +135,24 @@ const UpnlBpsTrailing = z.object({
108
135
  priceSource: PriceSource
109
136
  })
110
137
  });
111
- const TriggerConditionOpen = z.discriminatedUnion("type", [Ratio, Price, WeightedRatio]);
138
+ const TriggerConditionOpen = z.discriminatedUnion("type", [
139
+ Ratio,
140
+ Price,
141
+ WeightedRatio,
142
+ FundingRate,
143
+ PredictionMarket,
144
+ BtcDominance
145
+ ]);
112
146
  const TriggerConditionAdjust = z.discriminatedUnion("type", [
113
147
  Ratio,
114
148
  Price,
115
149
  WeightedRatio,
116
150
  Notional,
117
151
  Upnl,
118
- UpnlBps
152
+ UpnlBps,
153
+ FundingRate,
154
+ PredictionMarket,
155
+ BtcDominance
119
156
  ]);
120
157
  const TriggerConditionClose = z.discriminatedUnion("type", [
121
158
  Ratio,
@@ -129,7 +166,10 @@ const TriggerConditionClose = z.discriminatedUnion("type", [
129
166
  WeightedRatioTrailing,
130
167
  NotionalTrailing,
131
168
  UpnlTrailing,
132
- UpnlBpsTrailing
169
+ UpnlBpsTrailing,
170
+ FundingRate,
171
+ PredictionMarket,
172
+ BtcDominance
133
173
  ]);
134
174
 
135
175
  export { TriggerConditionAdjust, TriggerConditionClose, TriggerConditionOpen };