@pear-protocol/types
Advanced tools
| import { z } from 'zod'; | ||
| export declare const RecommendedBasketLeg: z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| export declare const RecommendedBasket: z.ZodObject<{ | ||
| id: z.ZodUUID; | ||
| name: z.ZodString; | ||
| description: z.ZodOptional<z.ZodString>; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>; | ||
| createdAt: z.ZodString; | ||
| updatedAt: z.ZodString; | ||
| }, z.core.$strip>; | ||
| export type RecommendedBasketLeg = z.infer<typeof RecommendedBasketLeg>; | ||
| export type RecommendedBasket = z.infer<typeof RecommendedBasket>; |
| import { z } from 'zod'; | ||
| import { Side, AssetWeight } from '../../common/schema'; | ||
| import { InstrumentId } from '../../instrument'; | ||
| const RecommendedBasketLeg = z.object({ | ||
| id: InstrumentId.describe("Venue instrument id the leg trades"), | ||
| symbol: z.string().min(1).describe("Base asset shown to traders"), | ||
| side: Side, | ||
| weight: AssetWeight.describe("Share of total gross notional as a fraction (legs sum to 1)") | ||
| }); | ||
| const RecommendedBasket = z.object({ | ||
| id: z.uuid(), | ||
| name: z.string(), | ||
| description: z.string().optional(), | ||
| legs: z.tuple([ | ||
| RecommendedBasketLeg | ||
| ]).rest(RecommendedBasketLeg), | ||
| createdAt: z.string(), | ||
| updatedAt: z.string() | ||
| }); | ||
| export { RecommendedBasket, RecommendedBasketLeg }; |
| export * from './entities'; | ||
| export * from './responses'; |
| export * from './entities'; | ||
| export * from './responses'; |
| import { z } from 'zod'; | ||
| export declare const RecommendedBasketListResponse: z.ZodObject<{ | ||
| baskets: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodUUID; | ||
| name: z.ZodString; | ||
| description: z.ZodOptional<z.ZodString>; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>; | ||
| createdAt: z.ZodString; | ||
| updatedAt: z.ZodString; | ||
| }, z.core.$strip>>; | ||
| }, z.core.$strip>; | ||
| export type RecommendedBasketListResponse = z.output<typeof RecommendedBasketListResponse>; |
| import { z } from 'zod'; | ||
| import { RecommendedBasket } from './entities'; | ||
| const RecommendedBasketListResponse = z.object({ | ||
| baskets: z.array(RecommendedBasket) | ||
| }); | ||
| export { RecommendedBasketListResponse }; |
| import { z } from 'zod'; | ||
| export declare const SavedBasketLeg: z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| export declare const SavedBasket: z.ZodObject<{ | ||
| id: z.ZodUUID; | ||
| name: z.ZodString; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>; | ||
| createdAt: z.ZodString; | ||
| updatedAt: z.ZodString; | ||
| }, z.core.$strip>; | ||
| export type SavedBasketLeg = z.infer<typeof SavedBasketLeg>; | ||
| export type SavedBasket = z.infer<typeof SavedBasket>; |
| import { z } from 'zod'; | ||
| import { RefineLegIdMatchesSymbol } from '../../common/refinement'; | ||
| import { Side, AssetWeight } from '../../common/schema'; | ||
| import { InstrumentId } from '../../instrument'; | ||
| const SavedBasketLeg = z.object({ | ||
| // PHASE-1 LEG ID: mirrors `symbol` today; required in phase 3 when `symbol` becomes the ticker. | ||
| id: InstrumentId.optional().describe("Connector-native instrument id"), | ||
| symbol: InstrumentId, | ||
| side: Side, | ||
| weight: AssetWeight.describe("Share of total gross notional as a fraction (legs sum to 1)") | ||
| }).superRefine(RefineLegIdMatchesSymbol); | ||
| const SavedBasket = z.object({ | ||
| id: z.uuid(), | ||
| name: z.string(), | ||
| legs: z.tuple([ | ||
| SavedBasketLeg | ||
| ]).rest(SavedBasketLeg), | ||
| createdAt: z.string(), | ||
| updatedAt: z.string() | ||
| }); | ||
| export { SavedBasket, SavedBasketLeg }; |
| export * from './entities'; | ||
| export * from './payloads'; | ||
| export * from './responses'; |
| export * from './entities'; | ||
| export * from './payloads'; | ||
| export * from './responses'; |
| import { z } from 'zod'; | ||
| export declare const CreateSavedBasketPayload: z.ZodObject<{ | ||
| name: z.ZodString; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>; | ||
| }, z.core.$strip>; | ||
| export declare const UpdateSavedBasketPayload: z.ZodObject<{ | ||
| name: z.ZodOptional<z.ZodString>; | ||
| legs: z.ZodOptional<z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>>; | ||
| }, z.core.$strip>; | ||
| export type CreateSavedBasketPayload = z.infer<typeof CreateSavedBasketPayload>; | ||
| export type UpdateSavedBasketPayload = z.infer<typeof UpdateSavedBasketPayload>; |
| import { z } from 'zod'; | ||
| import { RefineUniqueSymbols, RefineWeightingSum } from '../../common/refinement'; | ||
| import { SavedBasketLeg } from './entities'; | ||
| const SavedBasketName = z.string().trim().min(1, "Name is required").max(48).describe("Display name, unique per trade account (case-insensitive)"); | ||
| const SavedBasketLegs = z.tuple([ | ||
| SavedBasketLeg | ||
| ]).rest(SavedBasketLeg).superRefine(RefineUniqueSymbols).superRefine(RefineWeightingSum).refine((value) => value.length <= 20, "Basket must have at most 20 legs").describe("At least one leg, up to 20"); | ||
| const CreateSavedBasketPayload = z.object({ | ||
| name: SavedBasketName, | ||
| legs: SavedBasketLegs | ||
| }).describe("Save the current basket under a name"); | ||
| const UpdateSavedBasketPayload = z.object({ | ||
| name: SavedBasketName.optional(), | ||
| legs: SavedBasketLegs.optional() | ||
| }).refine((value) => value.name !== void 0 || value.legs !== void 0, "Provide a name or legs to update").describe("Rename a saved basket and/or replace its legs"); | ||
| export { CreateSavedBasketPayload, UpdateSavedBasketPayload }; |
| import { z } from 'zod'; | ||
| export declare const SavedBasketListResponse: z.ZodObject<{ | ||
| baskets: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodUUID; | ||
| name: z.ZodString; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>; | ||
| createdAt: z.ZodString; | ||
| updatedAt: z.ZodString; | ||
| }, z.core.$strip>>; | ||
| }, z.core.$strip>; | ||
| export type SavedBasketListResponse = z.output<typeof SavedBasketListResponse>; | ||
| export declare const CreateSavedBasketResponse: z.ZodObject<{ | ||
| basket: z.ZodObject<{ | ||
| id: z.ZodUUID; | ||
| name: z.ZodString; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>; | ||
| createdAt: z.ZodString; | ||
| updatedAt: z.ZodString; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>; | ||
| export type CreateSavedBasketResponse = z.output<typeof CreateSavedBasketResponse>; | ||
| export declare const UpdateSavedBasketResponse: z.ZodObject<{ | ||
| basket: z.ZodObject<{ | ||
| id: z.ZodUUID; | ||
| name: z.ZodString; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>; | ||
| createdAt: z.ZodString; | ||
| updatedAt: z.ZodString; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>; | ||
| export type UpdateSavedBasketResponse = z.output<typeof UpdateSavedBasketResponse>; |
| import { z } from 'zod'; | ||
| import { SavedBasket } from './entities'; | ||
| const SavedBasketListResponse = z.object({ | ||
| baskets: z.array(SavedBasket) | ||
| }); | ||
| const CreateSavedBasketResponse = z.object({ | ||
| basket: SavedBasket | ||
| }); | ||
| const UpdateSavedBasketResponse = z.object({ | ||
| basket: SavedBasket | ||
| }); | ||
| export { CreateSavedBasketResponse, SavedBasketListResponse, UpdateSavedBasketResponse }; |
| import { z } from 'zod'; | ||
| export declare const MAX_TWAP_DURATION_SEC: number; | ||
| export declare const MIN_TWAP_SLICE_INTERVAL_SEC = 15; | ||
| export declare const FINAL_TWAP_SLICE_START_HEADROOM_SEC = 15; | ||
| export declare const TWAPSliceIntervalSec: z.ZodInt; | ||
| export declare const TWAPTargetNotional: z.ZodString; | ||
| export declare const TWAPOpenLeg: z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| export declare const TWAPOpenLegs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>; | ||
| export declare const TriggerTWAPOpenLegs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strict>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strict>>; |
| import { z } from 'zod'; | ||
| import { RefineLegIdMatchesSymbol, RefineMinimumOneSymbol, RefineUniqueSymbols, RefineWeightingSum } from '../common/refinement'; | ||
| import { UnsignedDecimalString, AssetWeight, Side } from '../common/schema'; | ||
| import { InstrumentId } from '../instrument'; | ||
| const MAX_TWAP_DURATION_SEC = 60 * 60 * 24 * 31; | ||
| const MIN_TWAP_SLICE_INTERVAL_SEC = 15; | ||
| const FINAL_TWAP_SLICE_START_HEADROOM_SEC = 15; | ||
| const TWAPSliceIntervalSec = z.int().min(MIN_TWAP_SLICE_INTERVAL_SEC).max(MAX_TWAP_DURATION_SEC); | ||
| const TWAPTargetNotional = UnsignedDecimalString.refine((value) => /[1-9]/.test(value), { | ||
| message: "Target notional must be greater than zero" | ||
| }); | ||
| const TWAPOpenLeg = z.object({ | ||
| /** PHASE-1 LEG ID: mirrors `symbol` today; required in phase 3 when `symbol` becomes the ticker. */ | ||
| id: InstrumentId.optional(), | ||
| /** Instrument ID. */ | ||
| symbol: InstrumentId, | ||
| /** Direction to take. */ | ||
| side: Side, | ||
| /** Share of the parent target notional allocated to this leg. */ | ||
| weight: AssetWeight | ||
| }).superRefine(RefineLegIdMatchesSymbol); | ||
| const TWAPOpenLegs = z.array(TWAPOpenLeg).superRefine(RefineMinimumOneSymbol).superRefine(RefineUniqueSymbols).superRefine(RefineWeightingSum); | ||
| const TriggerTWAPOpenLeg = TWAPOpenLeg.strict(); | ||
| const TriggerTWAPOpenLegs = z.tuple([ | ||
| TriggerTWAPOpenLeg | ||
| ]).rest(TriggerTWAPOpenLeg).superRefine(RefineUniqueSymbols).superRefine(RefineWeightingSum); | ||
| export { FINAL_TWAP_SLICE_START_HEADROOM_SEC, MAX_TWAP_DURATION_SEC, MIN_TWAP_SLICE_INTERVAL_SEC, TWAPOpenLeg, TWAPOpenLegs, TWAPSliceIntervalSec, TWAPTargetNotional, TriggerTWAPOpenLegs }; |
+2
-1
| export * from './auth'; | ||
| export * from './baskets/recommended'; | ||
| export * from './baskets/saved'; | ||
| export * from './common/trade-legs'; | ||
@@ -20,3 +22,2 @@ export * from './connector'; | ||
| export * from './rebalance'; | ||
| export * from './saved-baskets'; | ||
| export * from './schedule'; | ||
@@ -23,0 +24,0 @@ export * from './statistics'; |
+2
-1
| export * from './auth'; | ||
| export * from './baskets/recommended'; | ||
| export * from './baskets/saved'; | ||
| export * from './common/trade-legs'; | ||
@@ -20,3 +22,2 @@ export * from './connector'; | ||
| export * from './rebalance'; | ||
| export * from './saved-baskets'; | ||
| export * from './schedule'; | ||
@@ -23,0 +24,0 @@ export * from './statistics'; |
| import z from 'zod'; | ||
| /** | ||
| * PHASE-1 LEG ID WARNING: these refinements key on `symbol` only. Re-key them on | ||
| * `id ?? symbol` before clients start sending `id` (phase 2). | ||
| */ | ||
| export declare const RefineMinimumOneSymbol: <T extends { | ||
@@ -15,2 +19,7 @@ symbol: string; | ||
| }[]>(basket: T, ctx: z.RefinementCtx) => void; | ||
| /** PHASE-1 LEG ID guard: a request's `id` must name the same instrument as `symbol`. Delete in phase 3. */ | ||
| export declare const RefineLegIdMatchesSymbol: <T extends { | ||
| id?: string; | ||
| symbol: string; | ||
| }>(leg: T, ctx: z.RefinementCtx) => void; | ||
| export declare const RefineWeightingSum: <T extends { | ||
@@ -17,0 +26,0 @@ weight: number; |
@@ -43,2 +43,10 @@ var __defProp = Object.defineProperty; | ||
| }, "RefineUniqueSymbols"); | ||
| const RefineLegIdMatchesSymbol = /* @__PURE__ */ __name((leg, ctx) => { | ||
| if (leg.id !== void 0 && leg.id !== leg.symbol) { | ||
| ctx.addIssue({ | ||
| code: "custom", | ||
| message: `Leg id and symbol must name the same instrument, got id "${leg.id}" and symbol "${leg.symbol}".` | ||
| }); | ||
| } | ||
| }, "RefineLegIdMatchesSymbol"); | ||
| const RefineWeightingSum = /* @__PURE__ */ __name((basket, ctx) => { | ||
@@ -65,2 +73,2 @@ const totalWeight = basket.reduce((acc, curr) => acc + curr.weight, 0); | ||
| export { RefineMinimumOneKeyValuePair, RefineMinimumOneSymbol, RefineMinimumTwoSymbols, RefineTwoUniqueSymbols, RefineUniqueSymbols, RefineWeightingSum }; | ||
| export { RefineLegIdMatchesSymbol, RefineMinimumOneKeyValuePair, RefineMinimumOneSymbol, RefineMinimumTwoSymbols, RefineTwoUniqueSymbols, RefineUniqueSymbols, RefineWeightingSum }; |
@@ -8,2 +8,3 @@ import { z } from 'zod'; | ||
| export declare const TradeLeg: z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -23,2 +24,3 @@ side: z.ZodEnum<{ | ||
| symbol: z.ZodString; | ||
| id: z.ZodOptional<z.ZodString>; | ||
| side: z.ZodEnum<{ | ||
@@ -25,0 +27,0 @@ BUY: "BUY"; |
| import { z } from 'zod'; | ||
| import { InstrumentId } from '../instrument'; | ||
| import { RefineLegIdMatchesSymbol } from './refinement'; | ||
| import { UnsignedDecimalString, Side } from './schema'; | ||
@@ -9,3 +10,5 @@ | ||
| ]); | ||
| const TradeLeg = z.object({ | ||
| const TradeLegShape = z.object({ | ||
| /** PHASE-1 LEG ID: mirrors `symbol` today; required in phase 3 when `symbol` becomes the ticker. */ | ||
| id: InstrumentId.optional(), | ||
| /** | ||
@@ -32,6 +35,7 @@ * Instrument ID | ||
| }); | ||
| const TradeLegPostOnly = TradeLeg.omit({ | ||
| const TradeLeg = TradeLegShape.superRefine(RefineLegIdMatchesSymbol); | ||
| const TradeLegPostOnly = TradeLegShape.omit({ | ||
| reduceOnly: true | ||
| }); | ||
| }).superRefine(RefineLegIdMatchesSymbol); | ||
| export { TradeLeg, TradeLegPostOnly }; |
@@ -27,2 +27,3 @@ import { z } from 'zod'; | ||
| declare const ExecutionLeg: z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -155,2 +156,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -168,2 +170,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -240,2 +243,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -253,2 +257,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -437,2 +442,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -450,2 +456,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -521,2 +528,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -534,2 +542,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -716,2 +725,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -729,2 +739,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -800,2 +811,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -813,2 +825,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -815,0 +828,0 @@ side: z.ZodEnum<{ |
@@ -29,2 +29,4 @@ import { z } from 'zod'; | ||
| const ExecutionLeg = z.object({ | ||
| /** PHASE-1 LEG ID: mirrors `symbol` today; required in phase 3 when `symbol` becomes the ticker. */ | ||
| id: InstrumentId.optional(), | ||
| /** | ||
@@ -31,0 +33,0 @@ * Instrument ID |
@@ -59,2 +59,3 @@ import { z } from 'zod'; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -72,2 +73,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -143,2 +145,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -156,2 +159,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -341,2 +345,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -354,2 +359,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -425,2 +431,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -438,2 +445,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -440,0 +448,0 @@ side: z.ZodEnum<{ |
@@ -275,2 +275,3 @@ import { z } from 'zod'; | ||
| symbol: z.ZodString; | ||
| id: z.ZodOptional<z.ZodString>; | ||
| side: z.ZodEnum<{ | ||
@@ -287,2 +288,3 @@ BUY: "BUY"; | ||
| symbol: z.ZodString; | ||
| id: z.ZodOptional<z.ZodString>; | ||
| side: z.ZodEnum<{ | ||
@@ -525,2 +527,3 @@ BUY: "BUY"; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -538,2 +541,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -849,2 +853,547 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>>; | ||
| }, z.core.$strip>], "intent">, z.ZodDiscriminatedUnion<[z.ZodObject<{ | ||
| id: z.ZodUUID; | ||
| tradeAccountId: z.ZodUUID; | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| status: z.ZodEnum<{ | ||
| CANCELLED: "CANCELLED"; | ||
| ACTIVE: "ACTIVE"; | ||
| TRIGGERED: "TRIGGERED"; | ||
| }>; | ||
| ladderId: z.ZodOptional<z.ZodUUID>; | ||
| ladderIndex: z.ZodOptional<z.ZodNumber>; | ||
| parentTriggerId: z.ZodOptional<z.ZodUUID>; | ||
| triggeredAt: z.ZodOptional<z.ZodString>; | ||
| cancelledAt: z.ZodOptional<z.ZodString>; | ||
| cancelledReason: z.ZodOptional<z.ZodEnum<{ | ||
| USER: "USER"; | ||
| POSITION_CLOSED: "POSITION_CLOSED"; | ||
| SYSTEM: "SYSTEM"; | ||
| POSITION_NETTED: "POSITION_NETTED"; | ||
| POSITION_REVERSED: "POSITION_REVERSED"; | ||
| }>>; | ||
| fills: z.ZodOptional<z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodUUID; | ||
| cloid: z.ZodOptional<z.ZodString>; | ||
| exchangeFillId: z.ZodOptional<z.ZodString>; | ||
| status: z.ZodEnum<{ | ||
| PROVISIONAL: "PROVISIONAL"; | ||
| CONFIRMED: "CONFIRMED"; | ||
| RECONCILED: "RECONCILED"; | ||
| }>; | ||
| tradeAccountId: z.ZodUUID; | ||
| symbol: z.ZodString; | ||
| positionId: z.ZodUUID; | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| reduceOnly: z.ZodBoolean; | ||
| isExternal: z.ZodBoolean; | ||
| synthetic: z.ZodBoolean; | ||
| quantity: z.ZodString; | ||
| price: z.ZodString; | ||
| usd: z.ZodString; | ||
| tradeFee: z.ZodOptional<z.ZodString>; | ||
| pearFee: z.ZodOptional<z.ZodString>; | ||
| timestamp: z.ZodString; | ||
| original: z.ZodOptional<z.ZodObject<{ | ||
| exchangeFillId: z.ZodString; | ||
| quantity: z.ZodString; | ||
| }, z.core.$strip>>; | ||
| }, z.core.$strip>>>; | ||
| bracketType: z.ZodEnum<{ | ||
| STOP_LOSS: "STOP_LOSS"; | ||
| TAKE_PROFIT: "TAKE_PROFIT"; | ||
| NONE: "NONE"; | ||
| }>; | ||
| semanticBracketType: z.ZodOptional<z.ZodEnum<{ | ||
| STOP_LOSS: "STOP_LOSS"; | ||
| TAKE_PROFIT: "TAKE_PROFIT"; | ||
| NONE: "NONE"; | ||
| }>>; | ||
| createdAt: z.ZodString; | ||
| updatedAt: z.ZodString; | ||
| intent: z.ZodLiteral<"ADJUST">; | ||
| type: z.ZodLiteral<"TWAP">; | ||
| scheduleId: z.ZodOptional<z.ZodUUID>; | ||
| condition: z.ZodDiscriminatedUnion<[z.ZodObject<{ | ||
| type: z.ZodLiteral<"ratio">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| symbol_a: z.ZodString; | ||
| symbol_b: z.ZodString; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"price">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| symbol: z.ZodString; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"weighted_ratio">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| basket: z.ZodArray<z.ZodObject<{ | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"notional">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"upnl">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"upnl_bps">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"funding_rate">; | ||
| data: z.ZodObject<{ | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| symbol: z.ZodString; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"prediction_market">; | ||
| data: z.ZodObject<{ | ||
| source: z.ZodEnum<{ | ||
| kalshi: "kalshi"; | ||
| polymarket: "polymarket"; | ||
| }>; | ||
| marketKey: z.ZodString; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"btc_dominance">; | ||
| data: z.ZodObject<{ | ||
| source: z.ZodLiteral<"coingecko">; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>], "type">; | ||
| context: z.ZodObject<{ | ||
| type: z.ZodLiteral<"TWAP">; | ||
| durationSec: z.ZodInt; | ||
| sliceIntervalSec: z.ZodInt; | ||
| randomization: z.ZodObject<{ | ||
| timingJitterBps: z.ZodInt; | ||
| sizeJitterBps: z.ZodInt; | ||
| }, z.core.$strip>; | ||
| position: z.ZodObject<{ | ||
| id: z.ZodUUID; | ||
| initialExposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>; | ||
| }, z.core.$strip>; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strict>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strict>>; | ||
| targetNotional: z.ZodString; | ||
| }, z.core.$strip>; | ||
| trailing: z.ZodOptional<z.ZodObject<{ | ||
| mode: z.ZodEnum<{ | ||
| RELATIVE_BPS: "RELATIVE_BPS"; | ||
| ABSOLUTE_POINTS: "ABSOLUTE_POINTS"; | ||
| }>; | ||
| deltaValue: z.ZodNumber; | ||
| activationValue: z.ZodOptional<z.ZodNumber>; | ||
| bestMetricSeen: z.ZodOptional<z.ZodNumber>; | ||
| currentStopValue: z.ZodOptional<z.ZodNumber>; | ||
| stopBreachedAt: z.ZodOptional<z.ZodNumber>; | ||
| }, z.core.$strip>>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| id: z.ZodUUID; | ||
| tradeAccountId: z.ZodUUID; | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| status: z.ZodEnum<{ | ||
| CANCELLED: "CANCELLED"; | ||
| ACTIVE: "ACTIVE"; | ||
| TRIGGERED: "TRIGGERED"; | ||
| }>; | ||
| ladderId: z.ZodOptional<z.ZodUUID>; | ||
| ladderIndex: z.ZodOptional<z.ZodNumber>; | ||
| parentTriggerId: z.ZodOptional<z.ZodUUID>; | ||
| triggeredAt: z.ZodOptional<z.ZodString>; | ||
| cancelledAt: z.ZodOptional<z.ZodString>; | ||
| cancelledReason: z.ZodOptional<z.ZodEnum<{ | ||
| USER: "USER"; | ||
| POSITION_CLOSED: "POSITION_CLOSED"; | ||
| SYSTEM: "SYSTEM"; | ||
| POSITION_NETTED: "POSITION_NETTED"; | ||
| POSITION_REVERSED: "POSITION_REVERSED"; | ||
| }>>; | ||
| fills: z.ZodOptional<z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodUUID; | ||
| cloid: z.ZodOptional<z.ZodString>; | ||
| exchangeFillId: z.ZodOptional<z.ZodString>; | ||
| status: z.ZodEnum<{ | ||
| PROVISIONAL: "PROVISIONAL"; | ||
| CONFIRMED: "CONFIRMED"; | ||
| RECONCILED: "RECONCILED"; | ||
| }>; | ||
| tradeAccountId: z.ZodUUID; | ||
| symbol: z.ZodString; | ||
| positionId: z.ZodUUID; | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| reduceOnly: z.ZodBoolean; | ||
| isExternal: z.ZodBoolean; | ||
| synthetic: z.ZodBoolean; | ||
| quantity: z.ZodString; | ||
| price: z.ZodString; | ||
| usd: z.ZodString; | ||
| tradeFee: z.ZodOptional<z.ZodString>; | ||
| pearFee: z.ZodOptional<z.ZodString>; | ||
| timestamp: z.ZodString; | ||
| original: z.ZodOptional<z.ZodObject<{ | ||
| exchangeFillId: z.ZodString; | ||
| quantity: z.ZodString; | ||
| }, z.core.$strip>>; | ||
| }, z.core.$strip>>>; | ||
| bracketType: z.ZodEnum<{ | ||
| STOP_LOSS: "STOP_LOSS"; | ||
| TAKE_PROFIT: "TAKE_PROFIT"; | ||
| NONE: "NONE"; | ||
| }>; | ||
| semanticBracketType: z.ZodOptional<z.ZodEnum<{ | ||
| STOP_LOSS: "STOP_LOSS"; | ||
| TAKE_PROFIT: "TAKE_PROFIT"; | ||
| NONE: "NONE"; | ||
| }>>; | ||
| createdAt: z.ZodString; | ||
| updatedAt: z.ZodString; | ||
| intent: z.ZodLiteral<"CLOSE">; | ||
| type: z.ZodLiteral<"TWAP">; | ||
| scheduleId: z.ZodOptional<z.ZodUUID>; | ||
| condition: z.ZodDiscriminatedUnion<[z.ZodObject<{ | ||
| type: z.ZodLiteral<"ratio">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| symbol_a: z.ZodString; | ||
| symbol_b: z.ZodString; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"price">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| symbol: z.ZodString; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"weighted_ratio">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| basket: z.ZodArray<z.ZodObject<{ | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"notional">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"upnl">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"upnl_bps">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"ratio_trailing">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| symbol_a: z.ZodString; | ||
| symbol_b: z.ZodString; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"price_trailing">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| symbol: z.ZodString; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"weighted_ratio_trailing">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| basket: z.ZodArray<z.ZodObject<{ | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"notional_trailing">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"upnl_trailing">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"upnl_bps_trailing">; | ||
| data: z.ZodObject<{ | ||
| priceSource: z.ZodEnum<{ | ||
| mid: "mid"; | ||
| mark: "mark"; | ||
| }>; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"funding_rate">; | ||
| data: z.ZodObject<{ | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| symbol: z.ZodString; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"prediction_market">; | ||
| data: z.ZodObject<{ | ||
| source: z.ZodEnum<{ | ||
| kalshi: "kalshi"; | ||
| polymarket: "polymarket"; | ||
| }>; | ||
| marketKey: z.ZodString; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"btc_dominance">; | ||
| data: z.ZodObject<{ | ||
| source: z.ZodLiteral<"coingecko">; | ||
| track: z.ZodEnum<{ | ||
| PEAK: "PEAK"; | ||
| TROUGH: "TROUGH"; | ||
| }>; | ||
| threshold: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>], "type">; | ||
| context: z.ZodObject<{ | ||
| type: z.ZodLiteral<"TWAP">; | ||
| durationSec: z.ZodInt; | ||
| sliceIntervalSec: z.ZodInt; | ||
| randomization: z.ZodObject<{ | ||
| timingJitterBps: z.ZodInt; | ||
| sizeJitterBps: z.ZodInt; | ||
| }, z.core.$strip>; | ||
| position: z.ZodObject<{ | ||
| id: z.ZodUUID; | ||
| initialExposure: z.ZodRecord<z.ZodString, z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>>; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>; | ||
| trailing: z.ZodOptional<z.ZodObject<{ | ||
| mode: z.ZodEnum<{ | ||
| RELATIVE_BPS: "RELATIVE_BPS"; | ||
| ABSOLUTE_POINTS: "ABSOLUTE_POINTS"; | ||
| }>; | ||
| deltaValue: z.ZodNumber; | ||
| activationValue: z.ZodOptional<z.ZodNumber>; | ||
| bestMetricSeen: z.ZodOptional<z.ZodNumber>; | ||
| currentStopValue: z.ZodOptional<z.ZodNumber>; | ||
| stopBreachedAt: z.ZodOptional<z.ZodNumber>; | ||
| }, z.core.$strip>>; | ||
| }, z.core.$strip>], "intent">], "type">>; | ||
@@ -851,0 +1400,0 @@ createdAt: z.ZodString; |
@@ -190,2 +190,3 @@ import { z } from 'zod'; | ||
| symbol: z.ZodString; | ||
| id: z.ZodOptional<z.ZodString>; | ||
| side: z.ZodEnum<{ | ||
@@ -202,2 +203,3 @@ BUY: "BUY"; | ||
| symbol: z.ZodString; | ||
| id: z.ZodOptional<z.ZodString>; | ||
| side: z.ZodEnum<{ | ||
@@ -349,2 +351,3 @@ BUY: "BUY"; | ||
| symbol: z.ZodString; | ||
| id: z.ZodOptional<z.ZodString>; | ||
| side: z.ZodEnum<{ | ||
@@ -361,2 +364,3 @@ BUY: "BUY"; | ||
| symbol: z.ZodString; | ||
| id: z.ZodOptional<z.ZodString>; | ||
| side: z.ZodEnum<{ | ||
@@ -363,0 +367,0 @@ BUY: "BUY"; |
@@ -8,5 +8,6 @@ import { z } from 'zod'; | ||
| * an auto-rebalance config acting on, or stopping itself over, the position it | ||
| * watches; `TRIGGER_CANCELLED_MIS_SCALED` means the remediation sweep cancelled | ||
| * an unreachable stop loss. Outcome lives here in the category; display details | ||
| * live in the `parameters` payload below. | ||
| * watches; the `TRIGGER_TWAP_*` categories describe a fired trigger starting, | ||
| * skipping, failing, or cancelling its TWAP; `TRIGGER_CANCELLED_MIS_SCALED` | ||
| * means the remediation sweep cancelled an unreachable stop loss. Outcome lives | ||
| * here in the category; display details live in the `parameters` payload below. | ||
| */ | ||
@@ -24,2 +25,6 @@ export declare const NotificationCategory: z.ZodEnum<{ | ||
| AUTO_REBALANCE_PAUSED: "AUTO_REBALANCE_PAUSED"; | ||
| TRIGGER_TWAP_STARTED: "TRIGGER_TWAP_STARTED"; | ||
| TRIGGER_TWAP_SKIPPED: "TRIGGER_TWAP_SKIPPED"; | ||
| TRIGGER_TWAP_FAILED: "TRIGGER_TWAP_FAILED"; | ||
| TRIGGER_TWAP_POSITION_CHANGED: "TRIGGER_TWAP_POSITION_CHANGED"; | ||
| TRIGGER_CANCELLED_MIS_SCALED: "TRIGGER_CANCELLED_MIS_SCALED"; | ||
@@ -339,2 +344,84 @@ }>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| }, z.core.$strip>>; | ||
| triggerId: z.ZodUUID; | ||
| positionId: z.ZodUUID; | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| type: z.ZodLiteral<"trigger_twap_started">; | ||
| scheduleId: z.ZodUUID; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| }, z.core.$strip>>; | ||
| triggerId: z.ZodUUID; | ||
| positionId: z.ZodUUID; | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| type: z.ZodLiteral<"trigger_twap_skipped">; | ||
| reason: z.ZodString; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| }, z.core.$strip>>; | ||
| triggerId: z.ZodUUID; | ||
| positionId: z.ZodUUID; | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| type: z.ZodLiteral<"trigger_twap_failed">; | ||
| scheduleId: z.ZodOptional<z.ZodUUID>; | ||
| reason: z.ZodString; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| }, z.core.$strip>>; | ||
| triggerId: z.ZodUUID; | ||
| positionId: z.ZodUUID; | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| type: z.ZodLiteral<"trigger_twap_position_changed">; | ||
| scheduleId: z.ZodUUID; | ||
| reason: z.ZodString; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"trigger_cancelled_mis_scaled">; | ||
@@ -360,2 +447,6 @@ triggerId: z.ZodUUID; | ||
| AUTO_REBALANCE_PAUSED: "AUTO_REBALANCE_PAUSED"; | ||
| TRIGGER_TWAP_STARTED: "TRIGGER_TWAP_STARTED"; | ||
| TRIGGER_TWAP_SKIPPED: "TRIGGER_TWAP_SKIPPED"; | ||
| TRIGGER_TWAP_FAILED: "TRIGGER_TWAP_FAILED"; | ||
| TRIGGER_TWAP_POSITION_CHANGED: "TRIGGER_TWAP_POSITION_CHANGED"; | ||
| TRIGGER_CANCELLED_MIS_SCALED: "TRIGGER_CANCELLED_MIS_SCALED"; | ||
@@ -656,2 +747,84 @@ }>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| }, z.core.$strip>>; | ||
| triggerId: z.ZodUUID; | ||
| positionId: z.ZodUUID; | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| type: z.ZodLiteral<"trigger_twap_started">; | ||
| scheduleId: z.ZodUUID; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| }, z.core.$strip>>; | ||
| triggerId: z.ZodUUID; | ||
| positionId: z.ZodUUID; | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| type: z.ZodLiteral<"trigger_twap_skipped">; | ||
| reason: z.ZodString; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| }, z.core.$strip>>; | ||
| triggerId: z.ZodUUID; | ||
| positionId: z.ZodUUID; | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| type: z.ZodLiteral<"trigger_twap_failed">; | ||
| scheduleId: z.ZodOptional<z.ZodUUID>; | ||
| reason: z.ZodString; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| }, z.core.$strip>>; | ||
| triggerId: z.ZodUUID; | ||
| positionId: z.ZodUUID; | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| type: z.ZodLiteral<"trigger_twap_position_changed">; | ||
| scheduleId: z.ZodUUID; | ||
| reason: z.ZodString; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"trigger_cancelled_mis_scaled">; | ||
@@ -658,0 +831,0 @@ triggerId: z.ZodUUID; |
@@ -17,2 +17,6 @@ import { z } from 'zod'; | ||
| "AUTO_REBALANCE_PAUSED", | ||
| "TRIGGER_TWAP_STARTED", | ||
| "TRIGGER_TWAP_SKIPPED", | ||
| "TRIGGER_TWAP_FAILED", | ||
| "TRIGGER_TWAP_POSITION_CHANGED", | ||
| "TRIGGER_CANCELLED_MIS_SCALED" | ||
@@ -150,2 +154,25 @@ ]); | ||
| }); | ||
| const TriggerTWAPNotificationAnchor = PositionLegParameters.safeExtend({ | ||
| triggerId: z.uuid(), | ||
| positionId: z.uuid(), | ||
| connector: Connector | ||
| }); | ||
| const TriggerTWAPStartedNotificationParameters = TriggerTWAPNotificationAnchor.safeExtend({ | ||
| type: z.literal("trigger_twap_started"), | ||
| scheduleId: z.uuid() | ||
| }); | ||
| const TriggerTWAPSkippedNotificationParameters = TriggerTWAPNotificationAnchor.safeExtend({ | ||
| type: z.literal("trigger_twap_skipped"), | ||
| reason: z.string().min(1).max(255) | ||
| }); | ||
| const TriggerTWAPFailedNotificationParameters = TriggerTWAPNotificationAnchor.safeExtend({ | ||
| type: z.literal("trigger_twap_failed"), | ||
| scheduleId: z.uuid().optional(), | ||
| reason: z.string().min(1).max(255) | ||
| }); | ||
| const TriggerTWAPPositionChangedNotificationParameters = TriggerTWAPNotificationAnchor.safeExtend({ | ||
| type: z.literal("trigger_twap_position_changed"), | ||
| scheduleId: z.uuid(), | ||
| reason: z.string().min(1).max(255) | ||
| }); | ||
| const NotificationParameters = z.discriminatedUnion("type", [ | ||
@@ -160,2 +187,6 @@ TakeProfitNotificationParameters, | ||
| AutoRebalancePausedNotificationParameters, | ||
| TriggerTWAPStartedNotificationParameters, | ||
| TriggerTWAPSkippedNotificationParameters, | ||
| TriggerTWAPFailedNotificationParameters, | ||
| TriggerTWAPPositionChangedNotificationParameters, | ||
| TriggerCancelledMisScaledNotificationParameters | ||
@@ -162,0 +193,0 @@ ]); |
@@ -16,2 +16,6 @@ import { z } from 'zod'; | ||
| AUTO_REBALANCE_PAUSED: "AUTO_REBALANCE_PAUSED"; | ||
| TRIGGER_TWAP_STARTED: "TRIGGER_TWAP_STARTED"; | ||
| TRIGGER_TWAP_SKIPPED: "TRIGGER_TWAP_SKIPPED"; | ||
| TRIGGER_TWAP_FAILED: "TRIGGER_TWAP_FAILED"; | ||
| TRIGGER_TWAP_POSITION_CHANGED: "TRIGGER_TWAP_POSITION_CHANGED"; | ||
| TRIGGER_CANCELLED_MIS_SCALED: "TRIGGER_CANCELLED_MIS_SCALED"; | ||
@@ -312,2 +316,84 @@ }>; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| }, z.core.$strip>>; | ||
| triggerId: z.ZodUUID; | ||
| positionId: z.ZodUUID; | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| type: z.ZodLiteral<"trigger_twap_started">; | ||
| scheduleId: z.ZodUUID; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| }, z.core.$strip>>; | ||
| triggerId: z.ZodUUID; | ||
| positionId: z.ZodUUID; | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| type: z.ZodLiteral<"trigger_twap_skipped">; | ||
| reason: z.ZodString; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| }, z.core.$strip>>; | ||
| triggerId: z.ZodUUID; | ||
| positionId: z.ZodUUID; | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| type: z.ZodLiteral<"trigger_twap_failed">; | ||
| scheduleId: z.ZodOptional<z.ZodUUID>; | ||
| reason: z.ZodString; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodString; | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| }, z.core.$strip>>; | ||
| triggerId: z.ZodUUID; | ||
| positionId: z.ZodUUID; | ||
| connector: z.ZodEnum<{ | ||
| hyperliquid: "hyperliquid"; | ||
| binance: "binance"; | ||
| bybit: "bybit"; | ||
| okx: "okx"; | ||
| lighter: "lighter"; | ||
| }>; | ||
| type: z.ZodLiteral<"trigger_twap_position_changed">; | ||
| scheduleId: z.ZodUUID; | ||
| reason: z.ZodString; | ||
| }, z.core.$strip>, z.ZodObject<{ | ||
| type: z.ZodLiteral<"trigger_cancelled_mis_scaled">; | ||
@@ -314,0 +400,0 @@ triggerId: z.ZodUUID; |
@@ -32,2 +32,3 @@ import { z } from 'zod'; | ||
| declare const TWAPOpenLeg: z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -196,2 +197,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -365,2 +367,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -367,0 +370,0 @@ side: z.ZodEnum<{ |
@@ -33,2 +33,4 @@ import { z } from 'zod'; | ||
| const TWAPOpenLeg = z.object({ | ||
| /** PHASE-1 LEG ID: mirrors `symbol` today; required in phase 3 when `symbol` becomes the ticker. */ | ||
| id: InstrumentId.optional(), | ||
| /** | ||
@@ -35,0 +37,0 @@ * Instrument ID |
@@ -13,2 +13,3 @@ import { z } from 'zod'; | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -50,2 +51,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -52,0 +54,0 @@ side: z.ZodEnum<{ |
| import { z } from 'zod'; | ||
| import { ClientIdCode } from '../common/client-id'; | ||
| import { RefineMinimumOneSymbol, RefineUniqueSymbols, RefineWeightingSum } from '../common/refinement'; | ||
| import { UnsignedDecimalString, AssetWeight, Side } from '../common/schema'; | ||
| import { InstrumentId } from '../instrument'; | ||
| import { TWAPRandomization, DEFAULT_TWAP_RANDOMIZATION } from './randomization'; | ||
| import { FINAL_TWAP_SLICE_START_HEADROOM_SEC, TWAPSliceIntervalSec, TWAPTargetNotional, TWAPOpenLegs } from './twap-config'; | ||
| const THIRTY_ONE_DAYS_SEC = 60 * 60 * 24 * 31; | ||
| const MIN_TWAP_WINDOW_SEC = 15; | ||
| const SliceIntervalSec = z.int().min(MIN_TWAP_WINDOW_SEC).max(THIRTY_ONE_DAYS_SEC); | ||
| const TargetNotional = UnsignedDecimalString.refine((value) => /[1-9]/.test(value), { | ||
| message: "Target notional must be greater than zero" | ||
| }); | ||
| const TWAPOpenLeg = z.object({ | ||
| /** | ||
| * Instrument ID | ||
| */ | ||
| symbol: InstrumentId, | ||
| /** | ||
| * Direction to take | ||
| */ | ||
| side: Side, | ||
| /** | ||
| * Share of the parent target notional allocated to this leg | ||
| */ | ||
| weight: AssetWeight | ||
| }); | ||
| const TWAPOpenLegs = z.array(TWAPOpenLeg).superRefine(RefineMinimumOneSymbol).superRefine(RefineUniqueSymbols).superRefine(RefineWeightingSum); | ||
| const BaseSchedule = z.object({ | ||
@@ -44,4 +21,4 @@ /** | ||
| message: "Start at date must be before end at date" | ||
| }).refine((data) => data.endAt.getTime() - data.startAt.getTime() >= MIN_TWAP_WINDOW_SEC * 1e3, { | ||
| message: `TWAP execution window must be at least ${MIN_TWAP_WINDOW_SEC} seconds` | ||
| }).refine((data) => data.endAt.getTime() - data.startAt.getTime() >= FINAL_TWAP_SLICE_START_HEADROOM_SEC * 1e3, { | ||
| message: `TWAP execution window must be at least ${FINAL_TWAP_SLICE_START_HEADROOM_SEC} seconds` | ||
| }); | ||
@@ -68,7 +45,7 @@ const CreateTWAPOpen = BaseSchedule.safeExtend({ | ||
| */ | ||
| targetNotional: TargetNotional, | ||
| targetNotional: TWAPTargetNotional, | ||
| /** | ||
| * Slice interval in seconds | ||
| */ | ||
| sliceIntervalSec: SliceIntervalSec, | ||
| sliceIntervalSec: TWAPSliceIntervalSec, | ||
| /** | ||
@@ -99,3 +76,3 @@ * Attribution route code (client_ids.code) | ||
| */ | ||
| sliceIntervalSec: SliceIntervalSec, | ||
| sliceIntervalSec: TWAPSliceIntervalSec, | ||
| /** | ||
@@ -102,0 +79,0 @@ * Attribution route code (client_ids.code) |
@@ -83,2 +83,3 @@ import { z } from 'zod'; | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -254,2 +255,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -256,0 +258,0 @@ side: z.ZodEnum<{ |
@@ -6,2 +6,3 @@ import { z } from 'zod'; | ||
| symbol: z.ZodString; | ||
| id: z.ZodOptional<z.ZodString>; | ||
| side: z.ZodEnum<{ | ||
@@ -18,2 +19,3 @@ BUY: "BUY"; | ||
| symbol: z.ZodString; | ||
| id: z.ZodOptional<z.ZodString>; | ||
| side: z.ZodEnum<{ | ||
@@ -106,2 +108,3 @@ BUY: "BUY"; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -119,2 +122,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -150,2 +154,3 @@ side: z.ZodEnum<{ | ||
| symbol: z.ZodString; | ||
| id: z.ZodOptional<z.ZodString>; | ||
| side: z.ZodEnum<{ | ||
@@ -162,2 +167,3 @@ BUY: "BUY"; | ||
| symbol: z.ZodString; | ||
| id: z.ZodOptional<z.ZodString>; | ||
| side: z.ZodEnum<{ | ||
@@ -250,2 +256,3 @@ BUY: "BUY"; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -263,2 +270,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -265,0 +273,0 @@ side: z.ZodEnum<{ |
@@ -57,2 +57,3 @@ import { z } from 'zod'; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -70,2 +71,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -141,2 +143,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -154,2 +157,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -339,2 +343,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -352,2 +357,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -423,2 +429,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -436,2 +443,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -621,2 +629,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -634,2 +643,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -705,2 +715,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -718,2 +729,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -903,2 +915,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -916,2 +929,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -987,2 +1001,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -1000,2 +1015,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -1185,2 +1201,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -1198,2 +1215,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -1269,2 +1287,3 @@ side: z.ZodEnum<{ | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -1282,2 +1301,3 @@ side: z.ZodEnum<{ | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| id: z.ZodOptional<z.ZodString>; | ||
| symbol: z.ZodString; | ||
@@ -1284,0 +1304,0 @@ side: z.ZodEnum<{ |
@@ -7,2 +7,4 @@ import { z } from 'zod'; | ||
| import { InstrumentId } from '../../instrument'; | ||
| import { TWAPRandomization } from '../../schedule/randomization'; | ||
| import { TWAPSliceIntervalSec, MIN_TWAP_SLICE_INTERVAL_SEC, FINAL_TWAP_SLICE_START_HEADROOM_SEC, MAX_TWAP_DURATION_SEC, TWAPTargetNotional, TriggerTWAPOpenLegs } from '../../schedule/twap-config'; | ||
| import { TrailingMode, BracketType, TriggerStatus, TriggerCancelledReason, TpSlBracketType } from '../common'; | ||
@@ -201,6 +203,57 @@ import { TriggerConditionOpen, TriggerConditionAdjust, TriggerConditionClose } from './conditions'; | ||
| ]); | ||
| const TriggerTWAPContext = z.object({ | ||
| type: z.literal("TWAP"), | ||
| durationSec: z.int().min(MIN_TWAP_SLICE_INTERVAL_SEC + FINAL_TWAP_SLICE_START_HEADROOM_SEC).max(MAX_TWAP_DURATION_SEC), | ||
| sliceIntervalSec: TWAPSliceIntervalSec, | ||
| randomization: TWAPRandomization, | ||
| position: z.object({ | ||
| id: z.uuid(), | ||
| initialExposure: z.record(InstrumentId, SignedDecimalString) | ||
| }) | ||
| }).refine((context) => context.durationSec >= context.sliceIntervalSec + FINAL_TWAP_SLICE_START_HEADROOM_SEC, { | ||
| message: `TWAP duration must leave ${FINAL_TWAP_SLICE_START_HEADROOM_SEC} seconds after the first slice`, | ||
| path: [ | ||
| "durationSec" | ||
| ] | ||
| }); | ||
| const TriggerTWAPAdjust = BaseTrigger.extend({ | ||
| /** Intent. */ | ||
| intent: z.literal("ADJUST"), | ||
| /** Order type. */ | ||
| type: z.literal("TWAP"), | ||
| /** Schedule created when the trigger fired, absent before firing or after a skipped fire. */ | ||
| scheduleId: z.uuid().optional(), | ||
| /** Condition. */ | ||
| condition: TriggerConditionAdjust, | ||
| /** Persisted TWAP execution context. */ | ||
| context: TriggerTWAPContext.safeExtend({ | ||
| legs: TriggerTWAPOpenLegs, | ||
| targetNotional: TWAPTargetNotional | ||
| }), | ||
| /** Optional trailing configuration. */ | ||
| trailing: Trailing.optional() | ||
| }); | ||
| const TriggerTWAPClose = BaseTrigger.extend({ | ||
| /** Intent. */ | ||
| intent: z.literal("CLOSE"), | ||
| /** Order type. */ | ||
| type: z.literal("TWAP"), | ||
| /** Schedule created when the trigger fired, absent before firing or after a skipped fire. */ | ||
| scheduleId: z.uuid().optional(), | ||
| /** Condition. */ | ||
| condition: TriggerConditionClose, | ||
| /** Persisted TWAP execution context. */ | ||
| context: TriggerTWAPContext, | ||
| /** Optional trailing configuration. */ | ||
| trailing: Trailing.optional() | ||
| }); | ||
| const TriggerTWAP = z.discriminatedUnion("intent", [ | ||
| TriggerTWAPAdjust, | ||
| TriggerTWAPClose | ||
| ]); | ||
| const Trigger = z.discriminatedUnion("type", [ | ||
| TriggerMarket | ||
| TriggerMarket, | ||
| TriggerTWAP | ||
| ]); | ||
| export { Trailing, Trigger, TriggerMarket, TriggerMarketAdjust, TriggerMarketClose, TriggerMarketOpen, TriggerMarketOpenAttachedTrigger }; | ||
| export { Trailing, Trigger, TriggerMarket, TriggerMarketAdjust, TriggerMarketClose, TriggerMarketOpen, TriggerMarketOpenAttachedTrigger, TriggerTWAP, TriggerTWAPAdjust, TriggerTWAPClose }; |
@@ -5,2 +5,4 @@ import { z } from 'zod'; | ||
| import { TradeLegPostOnly } from '../../common/trade-legs'; | ||
| import { TWAPRandomization, DEFAULT_TWAP_RANDOMIZATION } from '../../schedule/randomization'; | ||
| import { TWAPSliceIntervalSec, MIN_TWAP_SLICE_INTERVAL_SEC, FINAL_TWAP_SLICE_START_HEADROOM_SEC, MAX_TWAP_DURATION_SEC, TWAPTargetNotional, TriggerTWAPOpenLegs } from '../../schedule/twap-config'; | ||
| import { TrailingMode, TpSlBracketType, BracketType } from '../common'; | ||
@@ -20,2 +22,17 @@ import { RefineStaticLogicalRules } from '../refinement/static.refinement'; | ||
| }).strict(); | ||
| const CreateTriggerTWAPConfig = z.object({ | ||
| type: z.literal("TWAP"), | ||
| durationSec: z.int().min(MIN_TWAP_SLICE_INTERVAL_SEC + FINAL_TWAP_SLICE_START_HEADROOM_SEC).max(MAX_TWAP_DURATION_SEC), | ||
| sliceIntervalSec: TWAPSliceIntervalSec, | ||
| randomization: TWAPRandomization.optional().default(DEFAULT_TWAP_RANDOMIZATION) | ||
| }).strict().refine((payload) => payload.durationSec >= payload.sliceIntervalSec + FINAL_TWAP_SLICE_START_HEADROOM_SEC, { | ||
| message: `TWAP duration must leave ${FINAL_TWAP_SLICE_START_HEADROOM_SEC} seconds after the first slice`, | ||
| path: [ | ||
| "durationSec" | ||
| ] | ||
| }); | ||
| const CreateTriggerTWAPAdjustPayload = CreateTriggerTWAPConfig.safeExtend({ | ||
| legs: TriggerTWAPOpenLegs, | ||
| targetNotional: TWAPTargetNotional | ||
| }); | ||
| const TrailingConfig = z.object({ | ||
@@ -73,2 +90,13 @@ mode: TrailingMode, | ||
| }).strict(); | ||
| const CreateTriggerTWAPAdjust = z.object({ | ||
| intent: z.literal("ADJUST"), | ||
| type: z.literal("TWAP"), | ||
| positionId: z.uuid(), | ||
| condition: CreateTriggerConditionOpen, | ||
| payload: CreateTriggerTWAPAdjustPayload, | ||
| /** | ||
| * Attribution route code (client_ids.code) | ||
| */ | ||
| clientId: ClientIdCode | ||
| }).strict(); | ||
| const CreateTriggerMarketCloseStatic = z.object({ | ||
@@ -103,7 +131,42 @@ intent: z.literal("CLOSE"), | ||
| ]); | ||
| const CreateTriggerOpen = z.discriminatedUnion("intent", [ | ||
| CreateTriggerMarketOpen, | ||
| CreateTriggerMarketAdjust | ||
| const CreateTriggerTWAPCloseStatic = z.object({ | ||
| intent: z.literal("CLOSE"), | ||
| type: z.literal("TWAP"), | ||
| positionId: z.uuid(), | ||
| bracketType: BracketType, | ||
| semanticBracketType: TpSlBracketType.optional(), | ||
| condition: CreateTriggerConditionCloseStatic, | ||
| payload: CreateTriggerTWAPConfig, | ||
| /** | ||
| * Attribution route code (client_ids.code) | ||
| */ | ||
| clientId: ClientIdCode | ||
| }).strict().superRefine(RefineStaticLogicalRules); | ||
| const CreateTriggerTWAPCloseTrailing = z.object({ | ||
| intent: z.literal("CLOSE"), | ||
| type: z.literal("TWAP"), | ||
| positionId: z.uuid(), | ||
| condition: CreateTriggerConditionCloseTrailing, | ||
| trailing: TrailingConfig, | ||
| payload: CreateTriggerTWAPConfig, | ||
| /** | ||
| * Attribution route code (client_ids.code) | ||
| */ | ||
| clientId: ClientIdCode | ||
| }).strict().superRefine(RefineTrailingLogicalRules); | ||
| const CreateTriggerTWAPClose = z.union([ | ||
| CreateTriggerTWAPCloseStatic, | ||
| CreateTriggerTWAPCloseTrailing | ||
| ]); | ||
| const CreateTriggerClose = CreateTriggerMarketClose; | ||
| const CreateTriggerOpen = z.discriminatedUnion("type", [ | ||
| z.discriminatedUnion("intent", [ | ||
| CreateTriggerMarketOpen, | ||
| CreateTriggerMarketAdjust | ||
| ]), | ||
| CreateTriggerTWAPAdjust | ||
| ]); | ||
| const CreateTriggerClose = z.union([ | ||
| CreateTriggerMarketClose, | ||
| CreateTriggerTWAPClose | ||
| ]); | ||
| function isAttachTriggerMarketCloseTrailing(attachedTrigger) { | ||
@@ -114,2 +177,2 @@ return "trailing" in attachedTrigger && attachedTrigger.trailing !== void 0; | ||
| export { AttachTriggerMarketClose, AttachTriggerMarketCloseList, AttachTriggerMarketCloseStatic, AttachTriggerMarketCloseTrailing, CreateTriggerClose, CreateTriggerMarketAdjust, CreateTriggerMarketClose, CreateTriggerMarketCloseStatic, CreateTriggerMarketCloseTrailing, CreateTriggerMarketOpen, CreateTriggerOpen, TrailingConfig, isAttachTriggerMarketCloseTrailing }; | ||
| export { AttachTriggerMarketClose, AttachTriggerMarketCloseList, AttachTriggerMarketCloseStatic, AttachTriggerMarketCloseTrailing, CreateTriggerClose, CreateTriggerMarketAdjust, CreateTriggerMarketClose, CreateTriggerMarketCloseStatic, CreateTriggerMarketCloseTrailing, CreateTriggerMarketOpen, CreateTriggerOpen, CreateTriggerTWAPAdjust, CreateTriggerTWAPClose, CreateTriggerTWAPCloseStatic, CreateTriggerTWAPCloseTrailing, TrailingConfig, isAttachTriggerMarketCloseTrailing }; |
+1
-1
| { | ||
| "name": "@pear-protocol/types", | ||
| "version": "1.31.0", | ||
| "version": "1.32.0", | ||
| "description": "Pear Protocol Types definitions", | ||
@@ -5,0 +5,0 @@ "private": false, |
| import { z } from 'zod'; | ||
| export declare const SavedBasketLeg: z.ZodObject<{ | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>; | ||
| export declare const SavedBasket: z.ZodObject<{ | ||
| id: z.ZodUUID; | ||
| name: z.ZodString; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>; | ||
| createdAt: z.ZodString; | ||
| updatedAt: z.ZodString; | ||
| }, z.core.$strip>; | ||
| export type SavedBasketLeg = z.infer<typeof SavedBasketLeg>; | ||
| export type SavedBasket = z.infer<typeof SavedBasket>; |
| import { z } from 'zod'; | ||
| import { Side, AssetWeight } from '../common/schema'; | ||
| import { InstrumentId } from '../instrument'; | ||
| const SavedBasketLeg = z.object({ | ||
| symbol: InstrumentId, | ||
| side: Side, | ||
| weight: AssetWeight.describe("Share of total gross notional as a fraction (legs sum to 1)") | ||
| }); | ||
| const SavedBasket = z.object({ | ||
| id: z.uuid(), | ||
| name: z.string(), | ||
| legs: z.tuple([ | ||
| SavedBasketLeg | ||
| ]).rest(SavedBasketLeg), | ||
| createdAt: z.string(), | ||
| updatedAt: z.string() | ||
| }); | ||
| export { SavedBasket, SavedBasketLeg }; |
| export * from './entities'; | ||
| export * from './payloads'; | ||
| export * from './responses'; |
| export * from './entities'; | ||
| export * from './payloads'; | ||
| export * from './responses'; |
| import { z } from 'zod'; | ||
| export declare const CreateSavedBasketPayload: z.ZodObject<{ | ||
| name: z.ZodString; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>; | ||
| }, z.core.$strip>; | ||
| export declare const UpdateSavedBasketPayload: z.ZodObject<{ | ||
| name: z.ZodOptional<z.ZodString>; | ||
| legs: z.ZodOptional<z.ZodTuple<[z.ZodObject<{ | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>>; | ||
| }, z.core.$strip>; | ||
| export type CreateSavedBasketPayload = z.infer<typeof CreateSavedBasketPayload>; | ||
| export type UpdateSavedBasketPayload = z.infer<typeof UpdateSavedBasketPayload>; |
| import { z } from 'zod'; | ||
| import { RefineUniqueSymbols, RefineWeightingSum } from '../common/refinement'; | ||
| import { SavedBasketLeg } from './entities'; | ||
| const SavedBasketName = z.string().trim().min(1, "Name is required").max(48).describe("Display name, unique per trade account (case-insensitive)"); | ||
| const SavedBasketLegs = z.tuple([ | ||
| SavedBasketLeg | ||
| ]).rest(SavedBasketLeg).superRefine(RefineUniqueSymbols).superRefine(RefineWeightingSum).refine((value) => value.length <= 20, "Basket must have at most 20 legs").describe("At least one leg, up to 20"); | ||
| const CreateSavedBasketPayload = z.object({ | ||
| name: SavedBasketName, | ||
| legs: SavedBasketLegs | ||
| }).describe("Save the current basket under a name"); | ||
| const UpdateSavedBasketPayload = z.object({ | ||
| name: SavedBasketName.optional(), | ||
| legs: SavedBasketLegs.optional() | ||
| }).refine((value) => value.name !== void 0 || value.legs !== void 0, "Provide a name or legs to update").describe("Rename a saved basket and/or replace its legs"); | ||
| export { CreateSavedBasketPayload, UpdateSavedBasketPayload }; |
| import { z } from 'zod'; | ||
| export declare const SavedBasketListResponse: z.ZodObject<{ | ||
| baskets: z.ZodArray<z.ZodObject<{ | ||
| id: z.ZodUUID; | ||
| name: z.ZodString; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>; | ||
| createdAt: z.ZodString; | ||
| updatedAt: z.ZodString; | ||
| }, z.core.$strip>>; | ||
| }, z.core.$strip>; | ||
| export type SavedBasketListResponse = z.output<typeof SavedBasketListResponse>; | ||
| export declare const CreateSavedBasketResponse: z.ZodObject<{ | ||
| basket: z.ZodObject<{ | ||
| id: z.ZodUUID; | ||
| name: z.ZodString; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>; | ||
| createdAt: z.ZodString; | ||
| updatedAt: z.ZodString; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>; | ||
| export type CreateSavedBasketResponse = z.output<typeof CreateSavedBasketResponse>; | ||
| export declare const UpdateSavedBasketResponse: z.ZodObject<{ | ||
| basket: z.ZodObject<{ | ||
| id: z.ZodUUID; | ||
| name: z.ZodString; | ||
| legs: z.ZodTuple<[z.ZodObject<{ | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>], z.ZodObject<{ | ||
| symbol: z.ZodString; | ||
| side: z.ZodEnum<{ | ||
| BUY: "BUY"; | ||
| SELL: "SELL"; | ||
| }>; | ||
| weight: z.ZodNumber; | ||
| }, z.core.$strip>>; | ||
| createdAt: z.ZodString; | ||
| updatedAt: z.ZodString; | ||
| }, z.core.$strip>; | ||
| }, z.core.$strip>; | ||
| export type UpdateSavedBasketResponse = z.output<typeof UpdateSavedBasketResponse>; |
| import { z } from 'zod'; | ||
| import { SavedBasket } from './entities'; | ||
| const SavedBasketListResponse = z.object({ | ||
| baskets: z.array(SavedBasket) | ||
| }); | ||
| const CreateSavedBasketResponse = z.object({ | ||
| basket: SavedBasket | ||
| }); | ||
| const UpdateSavedBasketResponse = z.object({ | ||
| basket: SavedBasket | ||
| }); | ||
| export { CreateSavedBasketResponse, SavedBasketListResponse, UpdateSavedBasketResponse }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
1103948
26.28%269
3.07%31372
25.65%0
-100%