/* * 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"; import { ForecastTrajectorySpec, ForecastTrajectorySpec$inboundSchema, ForecastTrajectorySpec$Outbound, ForecastTrajectorySpec$outboundSchema, } from "./forecasttrajectoryspec.js"; export type AssetForecastStrategy = { /** * Start of forecast window (YYYY-MM-DD). The returned * * @remarks * object will contain every forecast made between start_date and * end_date. _Default value_ : most recent date with forecasts */ startDate?: string | null | undefined; /** * End of forecast window (YYYY-MM-DD). The returned * * @remarks * object will contain every forecast made between start_date and * end_date. _Default value_ : most recent date with forecasts */ endDate?: string | null | undefined; /** * Apply a blended strategy combining a requested model name with how many days to forecast. */ trajectory: Array; /** * Apply an empirical price collar to the forecasts. This regulates the forecast when it suggests implausibly large price changes. A smaller number results in a more aggressive collar. Must be a positive number. */ priceCollarSigma?: number | undefined; /** * Estimate prediction uncertainty based on recent * * @remarks * historical accuracy. */ estimateUncertainty?: boolean | undefined; /** * Interpolate between forecast horizons and return * * @remarks * daily forecast. */ interpolate?: boolean | undefined; /** * Return market drivers for each forecast. */ getMarketDrivers?: boolean | undefined; /** * Return moving averages for each forecast. */ getMovingAverages?: boolean | undefined; }; /** @internal */ export const AssetForecastStrategy$inboundSchema: z.ZodType< AssetForecastStrategy, z.ZodTypeDef, unknown > = z.object({ start_date: z.nullable(z.string()).optional(), end_date: z.nullable(z.string()).optional(), trajectory: z.array(ForecastTrajectorySpec$inboundSchema), price_collar_sigma: z.number().default(0), estimate_uncertainty: z.boolean().default(false), interpolate: z.boolean().default(false), get_market_drivers: z.boolean().default(false), get_moving_averages: z.boolean().default(false), }).transform((v) => { return remap$(v, { "start_date": "startDate", "end_date": "endDate", "price_collar_sigma": "priceCollarSigma", "estimate_uncertainty": "estimateUncertainty", "get_market_drivers": "getMarketDrivers", "get_moving_averages": "getMovingAverages", }); }); /** @internal */ export type AssetForecastStrategy$Outbound = { start_date?: string | null | undefined; end_date?: string | null | undefined; trajectory: Array; price_collar_sigma: number; estimate_uncertainty: boolean; interpolate: boolean; get_market_drivers: boolean; get_moving_averages: boolean; }; /** @internal */ export const AssetForecastStrategy$outboundSchema: z.ZodType< AssetForecastStrategy$Outbound, z.ZodTypeDef, AssetForecastStrategy > = z.object({ startDate: z.nullable(z.string()).optional(), endDate: z.nullable(z.string()).optional(), trajectory: z.array(ForecastTrajectorySpec$outboundSchema), priceCollarSigma: z.number().default(0), estimateUncertainty: z.boolean().default(false), interpolate: z.boolean().default(false), getMarketDrivers: z.boolean().default(false), getMovingAverages: z.boolean().default(false), }).transform((v) => { return remap$(v, { startDate: "start_date", endDate: "end_date", priceCollarSigma: "price_collar_sigma", estimateUncertainty: "estimate_uncertainty", getMarketDrivers: "get_market_drivers", getMovingAverages: "get_moving_averages", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace AssetForecastStrategy$ { /** @deprecated use `AssetForecastStrategy$inboundSchema` instead. */ export const inboundSchema = AssetForecastStrategy$inboundSchema; /** @deprecated use `AssetForecastStrategy$outboundSchema` instead. */ export const outboundSchema = AssetForecastStrategy$outboundSchema; /** @deprecated use `AssetForecastStrategy$Outbound` instead. */ export type Outbound = AssetForecastStrategy$Outbound; } export function assetForecastStrategyToJSON( assetForecastStrategy: AssetForecastStrategy, ): string { return JSON.stringify( AssetForecastStrategy$outboundSchema.parse(assetForecastStrategy), ); } export function assetForecastStrategyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AssetForecastStrategy$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AssetForecastStrategy' from JSON`, ); }