/* * 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 GetPerformanceMetricsRequest = { /** * Future symbol */ symbol: string; /** * the requested metric as described in the metadata. Default: hitrate */ metric?: string | null | undefined; /** * the horizon (number of business days in the future) of the model of interest. Default, returns for all horizons */ horizon?: number | null | undefined; /** * Start of the performance assessment window (YYYY-MM-DD) */ startDate?: string | null | undefined; /** * End of the performance assessment window (YYYY-MM-DD) */ endDate?: string | null | undefined; /** * Allows to assess directional performance filtered on days where the % expected change of the forecast is greater than threshold. Default: no filter. Valid only for hitrate style metrics. Eg. enter 0.02 for 2% */ thresholdOnForecast?: number | null | undefined; /** * Allows to assess directional performance filtered on days where the % realized price change is greater than threshold. Default: no filter. Valid only for hitrate style metrics. Eg. enter 0.02 for 2% */ thresholdOnActual?: number | null | undefined; /** * Use the run date of the forecast to filter the performance assessment window. If false, use the target date. Setting this to false makes the result deterministic from day to day. */ useRunDate?: boolean | undefined; /** * Number of standard deviations to calculate for ACE. Unused for other metrics. */ sigma?: number | undefined; /** * Model against which performance metrics will be assessed. */ modelName?: string | null | undefined; }; /** @internal */ export const GetPerformanceMetricsRequest$inboundSchema: z.ZodType< GetPerformanceMetricsRequest, z.ZodTypeDef, unknown > = z.object({ symbol: z.string(), metric: z.nullable(z.string()).optional(), horizon: z.nullable(z.number().int()).optional(), start_date: z.nullable(z.string()).optional(), end_date: z.nullable(z.string()).optional(), threshold_on_forecast: z.nullable(z.number()).optional(), threshold_on_actual: z.nullable(z.number()).optional(), use_run_date: z.boolean().default(false), sigma: z.number().default(1.28), model_name: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { "start_date": "startDate", "end_date": "endDate", "threshold_on_forecast": "thresholdOnForecast", "threshold_on_actual": "thresholdOnActual", "use_run_date": "useRunDate", "model_name": "modelName", }); }); /** @internal */ export type GetPerformanceMetricsRequest$Outbound = { symbol: string; metric?: string | null | undefined; horizon?: number | null | undefined; start_date?: string | null | undefined; end_date?: string | null | undefined; threshold_on_forecast?: number | null | undefined; threshold_on_actual?: number | null | undefined; use_run_date: boolean; sigma: number; model_name?: string | null | undefined; }; /** @internal */ export const GetPerformanceMetricsRequest$outboundSchema: z.ZodType< GetPerformanceMetricsRequest$Outbound, z.ZodTypeDef, GetPerformanceMetricsRequest > = z.object({ symbol: z.string(), metric: z.nullable(z.string()).optional(), horizon: z.nullable(z.number().int()).optional(), startDate: z.nullable(z.string()).optional(), endDate: z.nullable(z.string()).optional(), thresholdOnForecast: z.nullable(z.number()).optional(), thresholdOnActual: z.nullable(z.number()).optional(), useRunDate: z.boolean().default(false), sigma: z.number().default(1.28), modelName: z.nullable(z.string()).optional(), }).transform((v) => { return remap$(v, { startDate: "start_date", endDate: "end_date", thresholdOnForecast: "threshold_on_forecast", thresholdOnActual: "threshold_on_actual", useRunDate: "use_run_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 GetPerformanceMetricsRequest$ { /** @deprecated use `GetPerformanceMetricsRequest$inboundSchema` instead. */ export const inboundSchema = GetPerformanceMetricsRequest$inboundSchema; /** @deprecated use `GetPerformanceMetricsRequest$outboundSchema` instead. */ export const outboundSchema = GetPerformanceMetricsRequest$outboundSchema; /** @deprecated use `GetPerformanceMetricsRequest$Outbound` instead. */ export type Outbound = GetPerformanceMetricsRequest$Outbound; } export function getPerformanceMetricsRequestToJSON( getPerformanceMetricsRequest: GetPerformanceMetricsRequest, ): string { return JSON.stringify( GetPerformanceMetricsRequest$outboundSchema.parse( getPerformanceMetricsRequest, ), ); } export function getPerformanceMetricsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetPerformanceMetricsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetPerformanceMetricsRequest' from JSON`, ); }