1Branch0Tags
GL
glucryptouse HIP-4 series key identity
e149f868 days ago3Commits
typescript
import { z } from "zod"; export const configSchema = z.object({ platform: z.literal("hyperliquid").optional(), signalType: z.literal("hip4-edge").optional(), allocationMode: z.literal("fixed").optional(), amountUsd: z.number().positive().optional(), maxPerRunUsd: z.number().positive().optional(), schedule: z .object({ cron: z.string().min(1).optional(), enabled: z.boolean().optional(), notifyEmail: z.boolean().optional(), }) .optional(), model: z .object({ underlying: z.string().min(1).optional(), seriesKey: z.string().min(1).nullable().optional(), selectedModel: z.enum(["1h", "6h", "24h", "7d", "blend"]).optional(), depthUsd: z.number().positive().optional(), includeExpired: z.boolean().optional(), }) .optional(), risk: z .object({ minEdgePct: z.number().min(0).optional(), minRoiPct: z.number().min(0).optional(), maxAsk: z.number().positive().max(1).optional(), minAskDepthUsd: z.number().min(0).optional(), maxHoursToExpiry: z.number().positive().optional(), allowedSides: z.array(z.enum(["yes", "no"])).optional(), maxTradesPerRun: z.number().int().positive().max(10).optional(), oneTradePerRoundSide: z.boolean().optional(), }) .optional(), execution: z .object({ enabled: z.boolean().optional(), environment: z.enum(["mainnet", "testnet"]).optional(), slippageBps: z.number().min(0).max(500).optional(), }) .optional(), }); export const TEMPLATE_CONFIG_SCHEMA = { type: "object", "x-budget": { modeField: "allocationMode", defaultMode: "fixed", title: "Budget & allocation", description: "HIP-4 edge strategies use fixed USD sizing per selected outcome leg.", modes: { fixed: { fields: ["amountUsd", "maxPerRunUsd"], }, }, }, properties: { configVersion: { type: "number" }, platform: { type: "string", enum: ["hyperliquid"] }, signalType: { type: "string", enum: ["hip4-edge"] }, allocationMode: { type: "string", enum: ["fixed"] }, amountUsd: { type: "number" }, maxPerRunUsd: { type: "number" }, schedule: { type: "object", properties: { cron: { type: "string" }, enabled: { type: "boolean" }, notifyEmail: { type: "boolean" }, }, }, model: { type: "object", properties: { underlying: { type: "string" }, seriesKey: { type: ["string", "null"] }, selectedModel: { type: "string", enum: ["1h", "6h", "24h", "7d", "blend"], }, depthUsd: { type: "number" }, includeExpired: { type: "boolean" }, }, }, risk: { type: "object", properties: { minEdgePct: { type: "number" }, minRoiPct: { type: "number" }, maxAsk: { type: "number" }, minAskDepthUsd: { type: "number" }, maxHoursToExpiry: { type: "number" }, allowedSides: { type: "array", items: { type: "string", enum: ["yes", "no"] }, }, maxTradesPerRun: { type: "number" }, oneTradePerRoundSide: { type: "boolean" }, }, }, execution: { type: "object", properties: { enabled: { type: "boolean" }, environment: { type: "string", enum: ["mainnet", "testnet"] }, slippageBps: { type: "number" }, }, }, }, } as const;