/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetHedgeIndicatorRequest = { /** * Future symbol */ symbol: string; /** * Contract year and month. _Default value_ : All * * @remarks * available contracts */ contract?: string | null | undefined; /** * Number of trading days in the future to hedge. _Default * * @remarks * value_ : Full forecast */ hedgeHorizon?: number | null | undefined; /** * Number of trading days to look back when computing * * @remarks * indicator quintiles. _Default value_ : 30 days */ lookbackDays?: number | undefined; /** * Start of indicator window (YYYY-MM-DD). The * * @remarks * returned object will contain every requested indicator made * between start_date and end_date. _Default value_ : most recent * date with indicators */ startDate?: string | null | undefined; /** * End of indicator window (YYYY-MM-DD). The * * @remarks * returned object will contain every requested indicator made * between start_date and end_date. _Default value_ : most recent * date with indicators */ endDate?: string | null | undefined; /** * Select a specific data model to use when generating the hedge indicator for a future symbol. */ modelName?: string | null | undefined; }; /** @internal */ export const GetHedgeIndicatorRequest$inboundSchema: z.ZodType< GetHedgeIndicatorRequest, z.ZodTypeDef, unknown > = z.object({ symbol: z.string(), contract: z.nullable(z.string()).optional(), hedge_horizon: z.nullable(z.number().int()).optional(), lookback_days: z.number().int().default(30), start_date: z.nullable(z.string()).optional(), end_date: z.nullable(z.string()).optional(), model_name: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "hedge_horizon": "hedgeHorizon", "lookback_days": "lookbackDays", "start_date": "startDate", "end_date": "endDate", "model_name": "modelName", }); }); /** @internal */ export type GetHedgeIndicatorRequest$Outbound = { symbol: string; contract?: string | null | undefined; hedge_horizon?: number | null | undefined; lookback_days: number; start_date?: string | null | undefined; end_date?: string | null | undefined; model_name?: string | null | undefined; }; /** @internal */ export const GetHedgeIndicatorRequest$outboundSchema: z.ZodType< GetHedgeIndicatorRequest$Outbound, z.ZodTypeDef, GetHedgeIndicatorRequest > = z.object({ symbol: z.string(), contract: z.nullable(z.string()).optional(), hedgeHorizon: z.nullable(z.number().int()).optional(), lookbackDays: z.number().int().default(30), startDate: z.nullable(z.string()).optional(), endDate: z.nullable(z.string()).optional(), modelName: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { hedgeHorizon: "hedge_horizon", lookbackDays: "lookback_days", startDate: "start_date", endDate: "end_date", modelName: "model_name", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetHedgeIndicatorRequest$ { /** @deprecated use `GetHedgeIndicatorRequest$inboundSchema` instead. */ export const inboundSchema = GetHedgeIndicatorRequest$inboundSchema; /** @deprecated use `GetHedgeIndicatorRequest$outboundSchema` instead. */ export const outboundSchema = GetHedgeIndicatorRequest$outboundSchema; /** @deprecated use `GetHedgeIndicatorRequest$Outbound` instead. */ export type Outbound = GetHedgeIndicatorRequest$Outbound; } export function getHedgeIndicatorRequestToJSON( getHedgeIndicatorRequest: GetHedgeIndicatorRequest, ): string { return JSON.stringify( GetHedgeIndicatorRequest$outboundSchema.parse(getHedgeIndicatorRequest), ); } export function getHedgeIndicatorRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetHedgeIndicatorRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetHedgeIndicatorRequest' from JSON`, ); }