/* * 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 { catchUnrecognizedEnum, OpenEnum, Unrecognized, } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { BondYield, BondYield$inboundSchema, BondYield$Outbound, BondYield$outboundSchema, } from "./bondyield.js"; /** * The amount of interest that has been accrued in the issuing currency for a single instrument. Requirement of 15 or less integral number and 2 or less fractional precision. Required for FIXED_INCOME trades. Not allowed for trades of other instrument types. */ export type ExecutionAccruedInterestAmount = { /** * 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; }; /** * Commission amount of the execution. Requirement of 11 or less integral number and 2 or less fractional precision. */ export type CommissionAmount = { /** * 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; }; /** * Gross amount is calculated by the Booking service by multiplying price and quantity and fixing it to 2 fractional precision. Requirement of 11 or less integral number and 2 or less fractional precision. Optionally specifiable. If present, will override the gross_amount calculated above. */ export type GrossAmount = { /** * 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 price for the instrument that is prevailing in the market. Requirement of 8 or less integral number and 8 or less fractional precision. Required for FIXED_INCOME trades when the broker_capacity is PRINCIPAL. */ export type ExecutionPrevailingMarketPrice = { /** * 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; }; /** * Price with requirement of 8 or less integral number and 8 or less fractional precision. */ export type ExecutionPrice = { /** * 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; }; /** * Total monetary value of the price_adjustment */ export type PriceAdjustmentAmount = { /** * 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 type of price adjustment being applied by the broker to the net price of the security. */ export enum ExecutionPriceAdjustmentType { PriceAdjustmentTypeUnspecified = "PRICE_ADJUSTMENT_TYPE_UNSPECIFIED", Markup = "MARKUP", Markdown = "MARKDOWN", GrossCredit = "GROSS_CREDIT", } /** * The type of price adjustment being applied by the broker to the net price of the security. */ export type ExecutionPriceAdjustmentTypeOpen = OpenEnum< typeof ExecutionPriceAdjustmentType >; /** * Price adjustment that will be applied to the net price of the security. */ export type PriceAdjustment = { /** * Total monetary value of the price_adjustment */ priceAdjustmentAmount?: PriceAdjustmentAmount | null | undefined; /** * The type of price adjustment being applied by the broker to the net price of the security. */ priceAdjustmentType?: ExecutionPriceAdjustmentTypeOpen | undefined; }; /** * Quantity with requirement of 12 or less integral number and 5 or less fractional precision. */ export type ExecutionQuantity = { /** * 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 state that the trade is in. */ export enum ExecutionState { StateUnspecified = "STATE_UNSPECIFIED", Creating = "CREATING", Rebooking = "REBOOKING", Canceling = "CANCELING", Booked = "BOOKED", Rebooked = "REBOOKED", Canceled = "CANCELED", Failed = "FAILED", } /** * The state that the trade is in. */ export type ExecutionStateOpen = OpenEnum; /** * An execution represents a partial-fill or a fill that is part of an order. Executions are children to a Trade, which collectively represents an entire order made by a client. */ export type Execution = { /** * The amount of interest that has been accrued in the issuing currency for a single instrument. Requirement of 15 or less integral number and 2 or less fractional precision. Required for FIXED_INCOME trades. Not allowed for trades of other instrument types. */ accruedInterestAmount?: ExecutionAccruedInterestAmount | null | undefined; /** * The id of the activity in the Ledger that represents this trade. */ activityId?: string | undefined; /** * The yield associated with an individual fill of a fixed income trade. Required for FIXED_INCOME trades. Not allowed for trades of other instrument types. */ bondYield?: Array | undefined; /** * Commission amount of the execution. Requirement of 11 or less integral number and 2 or less fractional precision. */ commissionAmount?: CommissionAmount | null | undefined; /** * A ULID that uniquely identifies the execution. */ executionId?: string | undefined; /** * Timestamp of when the execution took place. If settlement_date is not provided, this field will be converted into Eastern Time and used to calculate settlement_date. */ executionTime?: Date | null | undefined; /** * Used to generate execution_id, should be unique on the day for each source_application caller. */ externalId?: string | undefined; /** * Gross amount is calculated by the Booking service by multiplying price and quantity and fixing it to 2 fractional precision. Requirement of 11 or less integral number and 2 or less fractional precision. Optionally specifiable. If present, will override the gross_amount calculated above. */ grossAmount?: GrossAmount | null | undefined; /** * Caller provided but can be used for booking-service to note original trade details when booking into the error account or using the error asset. */ memo?: string | undefined; /** * The resource name of the execution. */ name?: string | undefined; /** * The price for the instrument that is prevailing in the market. Requirement of 8 or less integral number and 8 or less fractional precision. Required for FIXED_INCOME trades when the broker_capacity is PRINCIPAL. */ prevailingMarketPrice?: ExecutionPrevailingMarketPrice | null | undefined; /** * Price with requirement of 8 or less integral number and 8 or less fractional precision. */ price?: ExecutionPrice | null | undefined; /** * Price adjustment that will be applied to the net price of the security. */ priceAdjustment?: PriceAdjustment | null | undefined; /** * Quantity with requirement of 12 or less integral number and 5 or less fractional precision. */ quantity?: ExecutionQuantity | null | undefined; /** * The state that the trade is in. */ state?: ExecutionStateOpen | undefined; /** * Street-level execution id, unique by day per execution venue. */ streetExecutionId?: string | undefined; /** * The unique identifier of the trade this execution belongs to. */ tradeId?: string | undefined; }; /** @internal */ export const ExecutionAccruedInterestAmount$inboundSchema: z.ZodType< ExecutionAccruedInterestAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type ExecutionAccruedInterestAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const ExecutionAccruedInterestAmount$outboundSchema: z.ZodType< ExecutionAccruedInterestAmount$Outbound, z.ZodTypeDef, ExecutionAccruedInterestAmount > = 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 ExecutionAccruedInterestAmount$ { /** @deprecated use `ExecutionAccruedInterestAmount$inboundSchema` instead. */ export const inboundSchema = ExecutionAccruedInterestAmount$inboundSchema; /** @deprecated use `ExecutionAccruedInterestAmount$outboundSchema` instead. */ export const outboundSchema = ExecutionAccruedInterestAmount$outboundSchema; /** @deprecated use `ExecutionAccruedInterestAmount$Outbound` instead. */ export type Outbound = ExecutionAccruedInterestAmount$Outbound; } export function executionAccruedInterestAmountToJSON( executionAccruedInterestAmount: ExecutionAccruedInterestAmount, ): string { return JSON.stringify( ExecutionAccruedInterestAmount$outboundSchema.parse( executionAccruedInterestAmount, ), ); } export function executionAccruedInterestAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExecutionAccruedInterestAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExecutionAccruedInterestAmount' from JSON`, ); } /** @internal */ export const CommissionAmount$inboundSchema: z.ZodType< CommissionAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type CommissionAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const CommissionAmount$outboundSchema: z.ZodType< CommissionAmount$Outbound, z.ZodTypeDef, CommissionAmount > = 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 CommissionAmount$ { /** @deprecated use `CommissionAmount$inboundSchema` instead. */ export const inboundSchema = CommissionAmount$inboundSchema; /** @deprecated use `CommissionAmount$outboundSchema` instead. */ export const outboundSchema = CommissionAmount$outboundSchema; /** @deprecated use `CommissionAmount$Outbound` instead. */ export type Outbound = CommissionAmount$Outbound; } export function commissionAmountToJSON( commissionAmount: CommissionAmount, ): string { return JSON.stringify( CommissionAmount$outboundSchema.parse(commissionAmount), ); } export function commissionAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CommissionAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CommissionAmount' from JSON`, ); } /** @internal */ export const GrossAmount$inboundSchema: z.ZodType< GrossAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type GrossAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const GrossAmount$outboundSchema: z.ZodType< GrossAmount$Outbound, z.ZodTypeDef, GrossAmount > = 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 GrossAmount$ { /** @deprecated use `GrossAmount$inboundSchema` instead. */ export const inboundSchema = GrossAmount$inboundSchema; /** @deprecated use `GrossAmount$outboundSchema` instead. */ export const outboundSchema = GrossAmount$outboundSchema; /** @deprecated use `GrossAmount$Outbound` instead. */ export type Outbound = GrossAmount$Outbound; } export function grossAmountToJSON(grossAmount: GrossAmount): string { return JSON.stringify(GrossAmount$outboundSchema.parse(grossAmount)); } export function grossAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GrossAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GrossAmount' from JSON`, ); } /** @internal */ export const ExecutionPrevailingMarketPrice$inboundSchema: z.ZodType< ExecutionPrevailingMarketPrice, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type ExecutionPrevailingMarketPrice$Outbound = { value?: string | undefined; }; /** @internal */ export const ExecutionPrevailingMarketPrice$outboundSchema: z.ZodType< ExecutionPrevailingMarketPrice$Outbound, z.ZodTypeDef, ExecutionPrevailingMarketPrice > = 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 ExecutionPrevailingMarketPrice$ { /** @deprecated use `ExecutionPrevailingMarketPrice$inboundSchema` instead. */ export const inboundSchema = ExecutionPrevailingMarketPrice$inboundSchema; /** @deprecated use `ExecutionPrevailingMarketPrice$outboundSchema` instead. */ export const outboundSchema = ExecutionPrevailingMarketPrice$outboundSchema; /** @deprecated use `ExecutionPrevailingMarketPrice$Outbound` instead. */ export type Outbound = ExecutionPrevailingMarketPrice$Outbound; } export function executionPrevailingMarketPriceToJSON( executionPrevailingMarketPrice: ExecutionPrevailingMarketPrice, ): string { return JSON.stringify( ExecutionPrevailingMarketPrice$outboundSchema.parse( executionPrevailingMarketPrice, ), ); } export function executionPrevailingMarketPriceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExecutionPrevailingMarketPrice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExecutionPrevailingMarketPrice' from JSON`, ); } /** @internal */ export const ExecutionPrice$inboundSchema: z.ZodType< ExecutionPrice, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type ExecutionPrice$Outbound = { value?: string | undefined; }; /** @internal */ export const ExecutionPrice$outboundSchema: z.ZodType< ExecutionPrice$Outbound, z.ZodTypeDef, ExecutionPrice > = 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 ExecutionPrice$ { /** @deprecated use `ExecutionPrice$inboundSchema` instead. */ export const inboundSchema = ExecutionPrice$inboundSchema; /** @deprecated use `ExecutionPrice$outboundSchema` instead. */ export const outboundSchema = ExecutionPrice$outboundSchema; /** @deprecated use `ExecutionPrice$Outbound` instead. */ export type Outbound = ExecutionPrice$Outbound; } export function executionPriceToJSON(executionPrice: ExecutionPrice): string { return JSON.stringify(ExecutionPrice$outboundSchema.parse(executionPrice)); } export function executionPriceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExecutionPrice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExecutionPrice' from JSON`, ); } /** @internal */ export const PriceAdjustmentAmount$inboundSchema: z.ZodType< PriceAdjustmentAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type PriceAdjustmentAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const PriceAdjustmentAmount$outboundSchema: z.ZodType< PriceAdjustmentAmount$Outbound, z.ZodTypeDef, PriceAdjustmentAmount > = 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 PriceAdjustmentAmount$ { /** @deprecated use `PriceAdjustmentAmount$inboundSchema` instead. */ export const inboundSchema = PriceAdjustmentAmount$inboundSchema; /** @deprecated use `PriceAdjustmentAmount$outboundSchema` instead. */ export const outboundSchema = PriceAdjustmentAmount$outboundSchema; /** @deprecated use `PriceAdjustmentAmount$Outbound` instead. */ export type Outbound = PriceAdjustmentAmount$Outbound; } export function priceAdjustmentAmountToJSON( priceAdjustmentAmount: PriceAdjustmentAmount, ): string { return JSON.stringify( PriceAdjustmentAmount$outboundSchema.parse(priceAdjustmentAmount), ); } export function priceAdjustmentAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PriceAdjustmentAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PriceAdjustmentAmount' from JSON`, ); } /** @internal */ export const ExecutionPriceAdjustmentType$inboundSchema: z.ZodType< ExecutionPriceAdjustmentTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(ExecutionPriceAdjustmentType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const ExecutionPriceAdjustmentType$outboundSchema: z.ZodType< ExecutionPriceAdjustmentTypeOpen, z.ZodTypeDef, ExecutionPriceAdjustmentTypeOpen > = z.union([ z.nativeEnum(ExecutionPriceAdjustmentType), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ExecutionPriceAdjustmentType$ { /** @deprecated use `ExecutionPriceAdjustmentType$inboundSchema` instead. */ export const inboundSchema = ExecutionPriceAdjustmentType$inboundSchema; /** @deprecated use `ExecutionPriceAdjustmentType$outboundSchema` instead. */ export const outboundSchema = ExecutionPriceAdjustmentType$outboundSchema; } /** @internal */ export const PriceAdjustment$inboundSchema: z.ZodType< PriceAdjustment, z.ZodTypeDef, unknown > = z.object({ price_adjustment_amount: z.nullable( z.lazy(() => PriceAdjustmentAmount$inboundSchema), ).optional(), price_adjustment_type: ExecutionPriceAdjustmentType$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "price_adjustment_amount": "priceAdjustmentAmount", "price_adjustment_type": "priceAdjustmentType", }); }); /** @internal */ export type PriceAdjustment$Outbound = { price_adjustment_amount?: PriceAdjustmentAmount$Outbound | null | undefined; price_adjustment_type?: string | undefined; }; /** @internal */ export const PriceAdjustment$outboundSchema: z.ZodType< PriceAdjustment$Outbound, z.ZodTypeDef, PriceAdjustment > = z.object({ priceAdjustmentAmount: z.nullable( z.lazy(() => PriceAdjustmentAmount$outboundSchema), ).optional(), priceAdjustmentType: ExecutionPriceAdjustmentType$outboundSchema.optional(), }).transform((v) => { return remap$(v, { priceAdjustmentAmount: "price_adjustment_amount", priceAdjustmentType: "price_adjustment_type", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PriceAdjustment$ { /** @deprecated use `PriceAdjustment$inboundSchema` instead. */ export const inboundSchema = PriceAdjustment$inboundSchema; /** @deprecated use `PriceAdjustment$outboundSchema` instead. */ export const outboundSchema = PriceAdjustment$outboundSchema; /** @deprecated use `PriceAdjustment$Outbound` instead. */ export type Outbound = PriceAdjustment$Outbound; } export function priceAdjustmentToJSON( priceAdjustment: PriceAdjustment, ): string { return JSON.stringify(PriceAdjustment$outboundSchema.parse(priceAdjustment)); } export function priceAdjustmentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PriceAdjustment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PriceAdjustment' from JSON`, ); } /** @internal */ export const ExecutionQuantity$inboundSchema: z.ZodType< ExecutionQuantity, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type ExecutionQuantity$Outbound = { value?: string | undefined; }; /** @internal */ export const ExecutionQuantity$outboundSchema: z.ZodType< ExecutionQuantity$Outbound, z.ZodTypeDef, ExecutionQuantity > = 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 ExecutionQuantity$ { /** @deprecated use `ExecutionQuantity$inboundSchema` instead. */ export const inboundSchema = ExecutionQuantity$inboundSchema; /** @deprecated use `ExecutionQuantity$outboundSchema` instead. */ export const outboundSchema = ExecutionQuantity$outboundSchema; /** @deprecated use `ExecutionQuantity$Outbound` instead. */ export type Outbound = ExecutionQuantity$Outbound; } export function executionQuantityToJSON( executionQuantity: ExecutionQuantity, ): string { return JSON.stringify( ExecutionQuantity$outboundSchema.parse(executionQuantity), ); } export function executionQuantityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExecutionQuantity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExecutionQuantity' from JSON`, ); } /** @internal */ export const ExecutionState$inboundSchema: z.ZodType< ExecutionStateOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(ExecutionState), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const ExecutionState$outboundSchema: z.ZodType< ExecutionStateOpen, z.ZodTypeDef, ExecutionStateOpen > = z.union([ z.nativeEnum(ExecutionState), z.string().and(z.custom>()), ]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ExecutionState$ { /** @deprecated use `ExecutionState$inboundSchema` instead. */ export const inboundSchema = ExecutionState$inboundSchema; /** @deprecated use `ExecutionState$outboundSchema` instead. */ export const outboundSchema = ExecutionState$outboundSchema; } /** @internal */ export const Execution$inboundSchema: z.ZodType< Execution, z.ZodTypeDef, unknown > = z.object({ accrued_interest_amount: z.nullable( z.lazy(() => ExecutionAccruedInterestAmount$inboundSchema), ).optional(), activity_id: z.string().optional(), bond_yield: z.array(BondYield$inboundSchema).optional(), commission_amount: z.nullable(z.lazy(() => CommissionAmount$inboundSchema)) .optional(), execution_id: z.string().optional(), execution_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), external_id: z.string().optional(), gross_amount: z.nullable(z.lazy(() => GrossAmount$inboundSchema)).optional(), memo: z.string().optional(), name: z.string().optional(), prevailing_market_price: z.nullable( z.lazy(() => ExecutionPrevailingMarketPrice$inboundSchema), ).optional(), price: z.nullable(z.lazy(() => ExecutionPrice$inboundSchema)).optional(), price_adjustment: z.nullable(z.lazy(() => PriceAdjustment$inboundSchema)) .optional(), quantity: z.nullable(z.lazy(() => ExecutionQuantity$inboundSchema)) .optional(), state: ExecutionState$inboundSchema.optional(), street_execution_id: z.string().optional(), trade_id: z.string().optional(), }).transform((v) => { return remap$(v, { "accrued_interest_amount": "accruedInterestAmount", "activity_id": "activityId", "bond_yield": "bondYield", "commission_amount": "commissionAmount", "execution_id": "executionId", "execution_time": "executionTime", "external_id": "externalId", "gross_amount": "grossAmount", "prevailing_market_price": "prevailingMarketPrice", "price_adjustment": "priceAdjustment", "street_execution_id": "streetExecutionId", "trade_id": "tradeId", }); }); /** @internal */ export type Execution$Outbound = { accrued_interest_amount?: | ExecutionAccruedInterestAmount$Outbound | null | undefined; activity_id?: string | undefined; bond_yield?: Array | undefined; commission_amount?: CommissionAmount$Outbound | null | undefined; execution_id?: string | undefined; execution_time?: string | null | undefined; external_id?: string | undefined; gross_amount?: GrossAmount$Outbound | null | undefined; memo?: string | undefined; name?: string | undefined; prevailing_market_price?: | ExecutionPrevailingMarketPrice$Outbound | null | undefined; price?: ExecutionPrice$Outbound | null | undefined; price_adjustment?: PriceAdjustment$Outbound | null | undefined; quantity?: ExecutionQuantity$Outbound | null | undefined; state?: string | undefined; street_execution_id?: string | undefined; trade_id?: string | undefined; }; /** @internal */ export const Execution$outboundSchema: z.ZodType< Execution$Outbound, z.ZodTypeDef, Execution > = z.object({ accruedInterestAmount: z.nullable( z.lazy(() => ExecutionAccruedInterestAmount$outboundSchema), ).optional(), activityId: z.string().optional(), bondYield: z.array(BondYield$outboundSchema).optional(), commissionAmount: z.nullable(z.lazy(() => CommissionAmount$outboundSchema)) .optional(), executionId: z.string().optional(), executionTime: z.nullable(z.date().transform(v => v.toISOString())) .optional(), externalId: z.string().optional(), grossAmount: z.nullable(z.lazy(() => GrossAmount$outboundSchema)).optional(), memo: z.string().optional(), name: z.string().optional(), prevailingMarketPrice: z.nullable( z.lazy(() => ExecutionPrevailingMarketPrice$outboundSchema), ).optional(), price: z.nullable(z.lazy(() => ExecutionPrice$outboundSchema)).optional(), priceAdjustment: z.nullable(z.lazy(() => PriceAdjustment$outboundSchema)) .optional(), quantity: z.nullable(z.lazy(() => ExecutionQuantity$outboundSchema)) .optional(), state: ExecutionState$outboundSchema.optional(), streetExecutionId: z.string().optional(), tradeId: z.string().optional(), }).transform((v) => { return remap$(v, { accruedInterestAmount: "accrued_interest_amount", activityId: "activity_id", bondYield: "bond_yield", commissionAmount: "commission_amount", executionId: "execution_id", executionTime: "execution_time", externalId: "external_id", grossAmount: "gross_amount", prevailingMarketPrice: "prevailing_market_price", priceAdjustment: "price_adjustment", streetExecutionId: "street_execution_id", tradeId: "trade_id", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Execution$ { /** @deprecated use `Execution$inboundSchema` instead. */ export const inboundSchema = Execution$inboundSchema; /** @deprecated use `Execution$outboundSchema` instead. */ export const outboundSchema = Execution$outboundSchema; /** @deprecated use `Execution$Outbound` instead. */ export type Outbound = Execution$Outbound; } export function executionToJSON(execution: Execution): string { return JSON.stringify(Execution$outboundSchema.parse(execution)); } export function executionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Execution$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Execution' from JSON`, ); }