@pear-protocol/types 0.1.0 → 1.0.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 (39) 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 +1 -0
  8. package/dist/bundle.js +1 -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/rebalance/payloads.d.ts +1 -0
  14. package/dist/rebalance/payloads.js +6 -1
  15. package/dist/schedule/payloads.d.ts +4 -0
  16. package/dist/schedule/payloads.js +11 -2
  17. package/dist/trade/payloads.d.ts +8 -0
  18. package/dist/trade/payloads.js +21 -4
  19. package/dist/trigger/entities/conditions.d.ts +170 -0
  20. package/dist/trigger/entities/conditions.js +43 -3
  21. package/dist/trigger/entities/index.d.ts +369 -0
  22. package/dist/trigger/index.d.ts +1 -0
  23. package/dist/trigger/index.js +1 -0
  24. package/dist/trigger/oracle.d.ts +31 -0
  25. package/dist/trigger/oracle.js +15 -0
  26. package/dist/trigger/payloads/conditions.d.ts +50 -0
  27. package/dist/trigger/payloads/conditions.js +35 -1
  28. package/dist/trigger/payloads/index.d.ts +90 -0
  29. package/dist/trigger/payloads/index.js +16 -3
  30. package/dist/trigger/responses.d.ts +246 -0
  31. package/dist/triggers/entities.d.ts +34 -0
  32. package/dist/triggers/entities.js +21 -0
  33. package/dist/triggers/index.d.ts +3 -0
  34. package/dist/triggers/index.js +3 -0
  35. package/dist/triggers/queries.d.ts +8 -0
  36. package/dist/triggers/queries.js +10 -0
  37. package/dist/triggers/responses.d.ts +26 -0
  38. package/dist/triggers/responses.js +9 -0
  39. package/package.json +1 -1
@@ -0,0 +1,67 @@
1
+ import { z } from 'zod';
2
+ export declare const ApiKeyScope: z.ZodEnum<{
3
+ read: "read";
4
+ read_write: "read_write";
5
+ }>;
6
+ export declare const CreateApiKeyInput: z.ZodObject<{
7
+ label: z.ZodString;
8
+ scope: z.ZodDefault<z.ZodEnum<{
9
+ read: "read";
10
+ read_write: "read_write";
11
+ }>>;
12
+ expiresAt: z.ZodOptional<z.ZodISODateTime>;
13
+ }, z.core.$strip>;
14
+ export declare const CreateApiKeyOutput: z.ZodObject<{
15
+ id: z.ZodUUID;
16
+ label: z.ZodString;
17
+ scope: z.ZodEnum<{
18
+ read: "read";
19
+ read_write: "read_write";
20
+ }>;
21
+ key: z.ZodString;
22
+ }, z.core.$strip>;
23
+ export declare const ApiKeySummary: z.ZodObject<{
24
+ id: z.ZodUUID;
25
+ label: z.ZodString;
26
+ scope: z.ZodEnum<{
27
+ read: "read";
28
+ read_write: "read_write";
29
+ }>;
30
+ keyPrefix: z.ZodString;
31
+ lastUsedAt: z.ZodNullable<z.ZodString>;
32
+ expiresAt: z.ZodNullable<z.ZodString>;
33
+ revokedAt: z.ZodNullable<z.ZodString>;
34
+ createdAt: z.ZodString;
35
+ }, z.core.$strip>;
36
+ export declare const ListApiKeysOutput: z.ZodArray<z.ZodObject<{
37
+ id: z.ZodUUID;
38
+ label: z.ZodString;
39
+ scope: z.ZodEnum<{
40
+ read: "read";
41
+ read_write: "read_write";
42
+ }>;
43
+ keyPrefix: z.ZodString;
44
+ lastUsedAt: z.ZodNullable<z.ZodString>;
45
+ expiresAt: z.ZodNullable<z.ZodString>;
46
+ revokedAt: z.ZodNullable<z.ZodString>;
47
+ createdAt: z.ZodString;
48
+ }, z.core.$strip>>;
49
+ export declare const ApiKeyMeResponse: z.ZodObject<{
50
+ id: z.ZodUUID;
51
+ role: z.ZodEnum<{
52
+ basic: "basic";
53
+ pro: "pro";
54
+ admin: "admin";
55
+ }>;
56
+ scope: z.ZodEnum<{
57
+ read: "read";
58
+ read_write: "read_write";
59
+ }>;
60
+ authMethod: z.ZodLiteral<"api_key">;
61
+ }, z.core.$strip>;
62
+ export type ApiKeyScope = z.infer<typeof ApiKeyScope>;
63
+ export type CreateApiKeyInput = z.infer<typeof CreateApiKeyInput>;
64
+ export type CreateApiKeyOutput = z.infer<typeof CreateApiKeyOutput>;
65
+ export type ApiKeySummary = z.infer<typeof ApiKeySummary>;
66
+ export type ListApiKeysOutput = z.infer<typeof ListApiKeysOutput>;
67
+ export type ApiKeyMeResponse = z.infer<typeof ApiKeyMeResponse>;
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+
3
+ const ApiKeyScope = z.enum(["read", "read_write"]).describe("API key access scope");
4
+ const CreateApiKeyInput = z.object({
5
+ label: z.string().trim().min(1, "Label is required").max(100).describe("Human label for the key"),
6
+ scope: ApiKeyScope.default("read"),
7
+ /** ISO-8601 datetime; omit for a key that never expires. */
8
+ expiresAt: z.iso.datetime({ offset: true }).optional().describe("Optional expiry (ISO-8601)")
9
+ }).describe("Create a new API key");
10
+ const CreateApiKeyOutput = z.object({
11
+ id: z.uuid(),
12
+ label: z.string(),
13
+ scope: ApiKeyScope,
14
+ /** Raw secret — returned only once, at creation. */
15
+ key: z.string()
16
+ }).describe("Newly created API key (raw secret shown once)");
17
+ const ApiKeySummary = z.object({
18
+ id: z.uuid(),
19
+ label: z.string(),
20
+ scope: ApiKeyScope,
21
+ keyPrefix: z.string(),
22
+ lastUsedAt: z.string().nullable(),
23
+ expiresAt: z.string().nullable(),
24
+ revokedAt: z.string().nullable(),
25
+ createdAt: z.string()
26
+ });
27
+ const ListApiKeysOutput = z.array(ApiKeySummary).describe("All API keys for the user");
28
+ const ApiKeyMeResponse = z.object({
29
+ id: z.uuid().describe("User UUID that owns the API key"),
30
+ role: z.enum(["basic", "pro", "admin"]).describe("User role"),
31
+ scope: ApiKeyScope,
32
+ authMethod: z.literal("api_key")
33
+ }).describe("Identity of the caller authenticated via an API key");
34
+
35
+ export { ApiKeyMeResponse, ApiKeyScope, ApiKeySummary, CreateApiKeyInput, CreateApiKeyOutput, ListApiKeysOutput };
@@ -1,3 +1,4 @@
1
+ export * from './api-keys';
1
2
  export * from './entities';
2
3
  export * from './payloads';
3
4
  export * from './response';
@@ -1,3 +1,4 @@
1
+ export * from './api-keys';
1
2
  export * from './entities';
2
3
  export * from './payloads';
3
4
  export * from './response';
@@ -19,13 +19,11 @@ export declare const WalletLoginRequest: z.ZodObject<{
19
19
  address: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
20
20
  signature: z.ZodString;
21
21
  accessCode: z.ZodOptional<z.ZodString>;
22
- clientId: z.ZodString;
23
22
  }, z.core.$strip>;
24
23
  export declare const EmailLoginRequest: z.ZodObject<{
25
24
  method: z.ZodLiteral<"email">;
26
25
  email: z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>;
27
26
  password: z.ZodString;
28
- clientId: z.ZodString;
29
27
  }, z.core.$strip>;
30
28
  export declare const VerifyEmailRequest: z.ZodObject<{
31
29
  token: z.ZodString;
@@ -47,12 +45,10 @@ export declare const LoginRequest: z.ZodDiscriminatedUnion<[z.ZodObject<{
47
45
  address: z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>;
48
46
  signature: z.ZodString;
49
47
  accessCode: z.ZodOptional<z.ZodString>;
50
- clientId: z.ZodString;
51
48
  }, z.core.$strip>, z.ZodObject<{
52
49
  method: z.ZodLiteral<"email">;
53
50
  email: z.ZodPipe<z.ZodEmail, z.ZodTransform<string, string>>;
54
51
  password: z.ZodString;
55
- clientId: z.ZodString;
56
52
  }, z.core.$strip>], "method">;
57
53
  export declare const RefreshTokenRequest: z.ZodObject<{
58
54
  refreshToken: z.ZodString;
@@ -3,7 +3,6 @@ import { z } from 'zod';
3
3
  const EthereumAddress = z.string().regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address").transform((val) => val.toLowerCase()).describe("Ethereum wallet address (0x-prefixed, 40 hex chars, lowercase)");
4
4
  const Email = z.email("Invalid email address").transform((val) => val.toLowerCase()).describe("Email address (lowercase)");
5
5
  const Password = z.string().min(8, "Password must be at least 8 characters").max(128, "Password must be at most 128 characters").describe("Password for authentication");
6
- const ClientIdCode = z.string().min(1, "clientId is required").max(64, "clientId is too long").describe("Attribution route code (client_ids.code)");
7
6
  const AccessCode = z.string().trim().max(64).optional().describe("Optional beta access code");
8
7
  const RequestNonceRequest = z.object({
9
8
  address: EthereumAddress
@@ -24,14 +23,12 @@ const WalletLoginRequest = z.object({
24
23
  method: z.literal("wallet").describe('Must be "wallet" for wallet authentication'),
25
24
  address: EthereumAddress,
26
25
  signature: z.string().min(1, "Signature is required").describe("Signature of the nonce message"),
27
- accessCode: AccessCode,
28
- clientId: ClientIdCode
26
+ accessCode: AccessCode
29
27
  }).describe("Wallet-based authentication using nonce signature");
30
28
  const EmailLoginRequest = z.object({
31
29
  method: z.literal("email").describe('Must be "email" for email authentication'),
32
30
  email: Email,
33
- password: Password,
34
- clientId: ClientIdCode
31
+ password: Password
35
32
  }).describe("Email-based authentication using email and password");
36
33
  const VerifyEmailRequest = z.object({
37
34
  token: z.string().min(1, "Token is required").describe("Verification token"),
package/dist/bundle.d.ts CHANGED
@@ -22,4 +22,5 @@ export * from './tca';
22
22
  export * from './trade';
23
23
  export * from './trade-accounts';
24
24
  export * from './trigger';
25
+ export * from './triggers';
25
26
  export * from './users';
package/dist/bundle.js CHANGED
@@ -22,4 +22,5 @@ export * from './tca';
22
22
  export * from './trade';
23
23
  export * from './trade-accounts';
24
24
  export * from './trigger';
25
+ export * from './triggers';
25
26
  export * from './users';
@@ -0,0 +1,2 @@
1
+ import { z } from 'zod';
2
+ export declare const ClientIdCode: z.ZodOptional<z.ZodString>;
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod';
2
+
3
+ const ClientIdCode = z.string().min(1).max(64).optional().describe("Attribution route code (client_ids.code)");
4
+
5
+ export { ClientIdCode };
@@ -1,3 +1,4 @@
1
1
  export * from './array';
2
+ export * from './client-id';
2
3
  export * from './request';
3
4
  export * from './response';
@@ -1,3 +1,4 @@
1
1
  export * from './array';
2
+ export * from './client-id';
2
3
  export * from './request';
3
4
  export * from './response';
@@ -7,5 +7,6 @@ export declare const RebalanceManually: z.ZodObject<{
7
7
  symbol: z.ZodString;
8
8
  weight: z.ZodNumber;
9
9
  }, z.core.$strip>>;
10
+ clientId: z.ZodOptional<z.ZodString>;
10
11
  }, z.core.$strip>;
11
12
  export type RebalanceManually = z.output<typeof RebalanceManually>;
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { ClientIdCode } from '../common/client-id';
2
3
  import { RefineWeightingSum, RefineUniqueSymbols } from '../common/refinement';
3
4
  import { ExecutionOrderType } from '../execution';
4
5
  import { InstrumentId } from '../instrument';
@@ -10,7 +11,11 @@ const RebalanceManually = z.object({
10
11
  symbol: InstrumentId,
11
12
  weight: z.number().positive({ message: "Weight must be greater than 0" }).max(1, { message: "Weight must be less than 1" })
12
13
  })
13
- ).superRefine(RefineWeightingSum).superRefine(RefineUniqueSymbols).describe("Array of weightings to rebalance the position")
14
+ ).superRefine(RefineWeightingSum).superRefine(RefineUniqueSymbols).describe("Array of weightings to rebalance the position"),
15
+ /**
16
+ * Attribution route code (client_ids.code)
17
+ */
18
+ clientId: ClientIdCode
14
19
  });
15
20
 
16
21
  export { RebalanceManually };
@@ -19,6 +19,7 @@ declare const CreateTWAPOpen: z.ZodObject<{
19
19
  }, z.core.$strip>>;
20
20
  targetNotional: z.ZodString;
21
21
  sliceIntervalSec: z.ZodInt;
22
+ clientId: z.ZodOptional<z.ZodString>;
22
23
  }, z.core.$strip>;
23
24
  declare const CreateTWAPClose: z.ZodObject<{
24
25
  startAt: z.ZodPipe<z.ZodOptional<z.ZodCoercedDate<unknown>>, z.ZodTransform<Date, Date | undefined>>;
@@ -32,6 +33,7 @@ declare const CreateTWAPClose: z.ZodObject<{
32
33
  }, z.core.$strip>>;
33
34
  positionId: z.ZodUUID;
34
35
  sliceIntervalSec: z.ZodInt;
36
+ clientId: z.ZodOptional<z.ZodString>;
35
37
  }, z.core.$strip>;
36
38
  export declare const CreateSchedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
37
39
  startAt: z.ZodPipe<z.ZodOptional<z.ZodCoercedDate<unknown>>, z.ZodTransform<Date, Date | undefined>>;
@@ -53,6 +55,7 @@ export declare const CreateSchedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
53
55
  }, z.core.$strip>>;
54
56
  targetNotional: z.ZodString;
55
57
  sliceIntervalSec: z.ZodInt;
58
+ clientId: z.ZodOptional<z.ZodString>;
56
59
  }, z.core.$strip>, z.ZodObject<{
57
60
  startAt: z.ZodPipe<z.ZodOptional<z.ZodCoercedDate<unknown>>, z.ZodTransform<Date, Date | undefined>>;
58
61
  endAt: z.ZodPipe<z.ZodOptional<z.ZodCoercedDate<unknown>>, z.ZodTransform<Date, Date | undefined>>;
@@ -65,6 +68,7 @@ export declare const CreateSchedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
65
68
  }, z.core.$strip>>;
66
69
  positionId: z.ZodUUID;
67
70
  sliceIntervalSec: z.ZodInt;
71
+ clientId: z.ZodOptional<z.ZodString>;
68
72
  }, z.core.$strip>], "intent">;
69
73
  export type CreateTWAPOpen = z.output<typeof CreateTWAPOpen>;
70
74
  export type CreateTWAPClose = z.output<typeof CreateTWAPClose>;
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { ClientIdCode } from '../common/client-id';
2
3
  import { UnsignedDecimalString, Side } from '../common/schema';
3
4
  import { InstrumentId } from '../instrument';
4
5
  import { ScheduleSliceMode } from './entities';
@@ -73,7 +74,11 @@ const CreateTWAPOpen = BaseSchedule.safeExtend({
73
74
  /**
74
75
  * Slice interval in seconds
75
76
  */
76
- sliceIntervalSec: SliceIntervalSec
77
+ sliceIntervalSec: SliceIntervalSec,
78
+ /**
79
+ * Attribution route code (client_ids.code)
80
+ */
81
+ clientId: ClientIdCode
77
82
  });
78
83
  const CreateTWAPClose = BaseSchedule.safeExtend({
79
84
  /**
@@ -99,7 +104,11 @@ const CreateTWAPClose = BaseSchedule.safeExtend({
99
104
  /**
100
105
  * Slice interval in seconds
101
106
  */
102
- sliceIntervalSec: SliceIntervalSec
107
+ sliceIntervalSec: SliceIntervalSec,
108
+ /**
109
+ * Attribution route code (client_ids.code)
110
+ */
111
+ clientId: ClientIdCode
103
112
  });
104
113
  const CreateSchedule = z.discriminatedUnion("intent", [CreateTWAPOpen, CreateTWAPClose]);
105
114
 
@@ -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 };