/* * 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"; /** * The price for this security, which is reported as the price-per-share for EQUITY type securities, or as the price-per-contract for OPTION type securities. */ export type OptionOrderLegExecutionPrice = { /** * The decimal value, as a string; Refer to [Google’s Decimal type protocol buffer](https://github.com/googleapis/googleapis/blob/40203ca1880849480bbff7b8715491060bbccdf1/google/type/decimal.proto#L33) for details */ value?: string | undefined; }; /** * The number of shares or contracts transacted in this execution. */ export type OptionOrderLegExecutionQuantity = { /** * The decimal value, as a string; Refer to [Google’s Decimal type protocol buffer](https://github.com/googleapis/googleapis/blob/40203ca1880849480bbff7b8715491060bbccdf1/google/type/decimal.proto#L33) for details */ value?: string | undefined; }; /** * A report of a street-side execution. */ export type OptionOrderLegExecution = { /** * The market-reported timestamp of the execution. */ executedTime?: Date | null | undefined; /** * The price for this security, which is reported as the price-per-share for EQUITY type securities, or as the price-per-contract for OPTION type securities. */ price?: OptionOrderLegExecutionPrice | null | undefined; /** * The number of shares or contracts transacted in this execution. */ quantity?: OptionOrderLegExecutionQuantity | null | undefined; }; /** @internal */ export const OptionOrderLegExecutionPrice$inboundSchema: z.ZodType< OptionOrderLegExecutionPrice, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type OptionOrderLegExecutionPrice$Outbound = { value?: string | undefined; }; /** @internal */ export const OptionOrderLegExecutionPrice$outboundSchema: z.ZodType< OptionOrderLegExecutionPrice$Outbound, z.ZodTypeDef, OptionOrderLegExecutionPrice > = z.object({ value: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace OptionOrderLegExecutionPrice$ { /** @deprecated use `OptionOrderLegExecutionPrice$inboundSchema` instead. */ export const inboundSchema = OptionOrderLegExecutionPrice$inboundSchema; /** @deprecated use `OptionOrderLegExecutionPrice$outboundSchema` instead. */ export const outboundSchema = OptionOrderLegExecutionPrice$outboundSchema; /** @deprecated use `OptionOrderLegExecutionPrice$Outbound` instead. */ export type Outbound = OptionOrderLegExecutionPrice$Outbound; } export function optionOrderLegExecutionPriceToJSON( optionOrderLegExecutionPrice: OptionOrderLegExecutionPrice, ): string { return JSON.stringify( OptionOrderLegExecutionPrice$outboundSchema.parse( optionOrderLegExecutionPrice, ), ); } export function optionOrderLegExecutionPriceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OptionOrderLegExecutionPrice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OptionOrderLegExecutionPrice' from JSON`, ); } /** @internal */ export const OptionOrderLegExecutionQuantity$inboundSchema: z.ZodType< OptionOrderLegExecutionQuantity, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type OptionOrderLegExecutionQuantity$Outbound = { value?: string | undefined; }; /** @internal */ export const OptionOrderLegExecutionQuantity$outboundSchema: z.ZodType< OptionOrderLegExecutionQuantity$Outbound, z.ZodTypeDef, OptionOrderLegExecutionQuantity > = z.object({ value: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace OptionOrderLegExecutionQuantity$ { /** @deprecated use `OptionOrderLegExecutionQuantity$inboundSchema` instead. */ export const inboundSchema = OptionOrderLegExecutionQuantity$inboundSchema; /** @deprecated use `OptionOrderLegExecutionQuantity$outboundSchema` instead. */ export const outboundSchema = OptionOrderLegExecutionQuantity$outboundSchema; /** @deprecated use `OptionOrderLegExecutionQuantity$Outbound` instead. */ export type Outbound = OptionOrderLegExecutionQuantity$Outbound; } export function optionOrderLegExecutionQuantityToJSON( optionOrderLegExecutionQuantity: OptionOrderLegExecutionQuantity, ): string { return JSON.stringify( OptionOrderLegExecutionQuantity$outboundSchema.parse( optionOrderLegExecutionQuantity, ), ); } export function optionOrderLegExecutionQuantityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OptionOrderLegExecutionQuantity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OptionOrderLegExecutionQuantity' from JSON`, ); } /** @internal */ export const OptionOrderLegExecution$inboundSchema: z.ZodType< OptionOrderLegExecution, z.ZodTypeDef, unknown > = z.object({ executed_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), price: z.nullable(z.lazy(() => OptionOrderLegExecutionPrice$inboundSchema)) .optional(), quantity: z.nullable( z.lazy(() => OptionOrderLegExecutionQuantity$inboundSchema), ).optional(), }).transform((v) => { return remap$(v, { "executed_time": "executedTime", }); }); /** @internal */ export type OptionOrderLegExecution$Outbound = { executed_time?: string | null | undefined; price?: OptionOrderLegExecutionPrice$Outbound | null | undefined; quantity?: OptionOrderLegExecutionQuantity$Outbound | null | undefined; }; /** @internal */ export const OptionOrderLegExecution$outboundSchema: z.ZodType< OptionOrderLegExecution$Outbound, z.ZodTypeDef, OptionOrderLegExecution > = z.object({ executedTime: z.nullable(z.date().transform(v => v.toISOString())).optional(), price: z.nullable(z.lazy(() => OptionOrderLegExecutionPrice$outboundSchema)) .optional(), quantity: z.nullable( z.lazy(() => OptionOrderLegExecutionQuantity$outboundSchema), ).optional(), }).transform((v) => { return remap$(v, { executedTime: "executed_time", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace OptionOrderLegExecution$ { /** @deprecated use `OptionOrderLegExecution$inboundSchema` instead. */ export const inboundSchema = OptionOrderLegExecution$inboundSchema; /** @deprecated use `OptionOrderLegExecution$outboundSchema` instead. */ export const outboundSchema = OptionOrderLegExecution$outboundSchema; /** @deprecated use `OptionOrderLegExecution$Outbound` instead. */ export type Outbound = OptionOrderLegExecution$Outbound; } export function optionOrderLegExecutionToJSON( optionOrderLegExecution: OptionOrderLegExecution, ): string { return JSON.stringify( OptionOrderLegExecution$outboundSchema.parse(optionOrderLegExecution), ); } export function optionOrderLegExecutionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OptionOrderLegExecution$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OptionOrderLegExecution' from JSON`, ); }