/* * 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 { BondYieldCreate, BondYieldCreate$inboundSchema, BondYieldCreate$Outbound, BondYieldCreate$outboundSchema, } from "./bondyieldcreate.js"; import { BookingFeeCreate, BookingFeeCreate$inboundSchema, BookingFeeCreate$Outbound, BookingFeeCreate$outboundSchema, } from "./bookingfeecreate.js"; import { DateCreate, DateCreate$inboundSchema, DateCreate$Outbound, DateCreate$outboundSchema, } from "./datecreate.js"; import { DecimalCreate, DecimalCreate$inboundSchema, DecimalCreate$Outbound, DecimalCreate$outboundSchema, } from "./decimalcreate.js"; import { LotCreate, LotCreate$inboundSchema, LotCreate$Outbound, LotCreate$outboundSchema, } from "./lotcreate.js"; import { PriceAdjustmentCreate, PriceAdjustmentCreate$inboundSchema, PriceAdjustmentCreate$Outbound, PriceAdjustmentCreate$outboundSchema, } from "./priceadjustmentcreate.js"; /** * Type of the asset being traded. */ export enum TradeAllocationCreateAssetType { AssetTypeUnspecified = "ASSET_TYPE_UNSPECIFIED", Equity = "EQUITY", FixedIncome = "FIXED_INCOME", } /** * Type of the asset being traded. */ export type TradeAllocationCreateAssetTypeOpen = OpenEnum< typeof TradeAllocationCreateAssetType >; /** * Broker capacity for the trade. */ export enum TradeAllocationCreateBrokerCapacity { CapacityUnspecified = "CAPACITY_UNSPECIFIED", Agency = "AGENCY", Principal = "PRINCIPAL", Mixed = "MIXED", } /** * Broker capacity for the trade. */ export type TradeAllocationCreateBrokerCapacityOpen = OpenEnum< typeof TradeAllocationCreateBrokerCapacity >; /** * Identifier type for the asset being traded. */ export enum TradeAllocationCreateIdentifierType { IdentifierTypeUnspecified = "IDENTIFIER_TYPE_UNSPECIFIED", AssetId = "ASSET_ID", Symbol = "SYMBOL", Cusip = "CUSIP", Isin = "ISIN", } /** * Identifier type for the asset being traded. */ export type TradeAllocationCreateIdentifierTypeOpen = OpenEnum< typeof TradeAllocationCreateIdentifierType >; /** * Side modifier for the trade allocation. */ export enum TradeAllocationCreateSideModifier { SideModifierUnspecified = "SIDE_MODIFIER_UNSPECIFIED", Short = "SHORT", ShortExempt = "SHORT_EXEMPT", ShortCover = "SHORT_COVER", Open = "OPEN", Close = "CLOSE", } /** * Side modifier for the trade allocation. */ export type TradeAllocationCreateSideModifierOpen = OpenEnum< typeof TradeAllocationCreateSideModifier >; export enum TradeAllocationCreateSpecialInstructions { SpecialInstructionsUnspecified = "SPECIAL_INSTRUCTIONS_UNSPECIFIED", Rule144 = "RULE_144", WithDividend = "WITH_DIVIDEND", WithRights = "WITH_RIGHTS", CloseContract = "CLOSE_CONTRACT", CoverShort = "COVER_SHORT", CrossTrade = "CROSS_TRADE", OpenContractCovered = "OPEN_CONTRACT_COVERED", DiscretionExercised = "DISCRETION_EXERCISED", DiscretionNotExercised = "DISCRETION_NOT_EXERCISED", OptionAssignment = "OPTION_ASSIGNMENT", EmployeeStockOption = "EMPLOYEE_STOCK_OPTION", InvestmentBanking = "INVESTMENT_BANKING", BrokerDealerOrder = "BROKER_DEALER_ORDER", MakeMarketInSecurity = "MAKE_MARKET_IN_SECURITY", MakeMarketSolicited = "MAKE_MARKET_SOLICITED", MakeMarketUnsolicited = "MAKE_MARKET_UNSOLICITED", CustomerDirected = "CUSTOMER_DIRECTED", FullyRegistered = "FULLY_REGISTERED", OpenContract = "OPEN_CONTRACT", OddlotDiffOnRequest = "ODDLOT_DIFF_ON_REQUEST", ProspectusEnclosed = "PROSPECTUS_ENCLOSED", ProspectusSeparateMail = "PROSPECTUS_SEPARATE_MAIL", Solicited = "SOLICITED", Unsolicited = "UNSOLICITED", XDividend = "X_DIVIDEND", ActingAsPrincipal = "ACTING_AS_PRINCIPAL", AveragePrice = "AVERAGE_PRICE", BrokerLiquidation = "BROKER_LIQUIDATION", CouponBooks = "COUPON_BOOKS", HasPostageFee = "HAS_POSTAGE_FEE", InternetOrder = "INTERNET_ORDER", MarginSellout = "MARGIN_SELLOUT", MarketMakersAsPrincipal = "MARKET_MAKERS_AS_PRINCIPAL", NegativeNetProceed = "NEGATIVE_NET_PROCEED", PreFigIndicator = "PRE_FIG_INDICATOR", RisklessPrincipalInstruction = "RISKLESS_PRINCIPAL_INSTRUCTION", ShortInstruction = "SHORT_INSTRUCTION", ThirdMarket = "THIRD_MARKET", SuppressMsrbTransmission = "SUPPRESS_MSRB_TRANSMISSION", SuppressTraceReporting = "SUPPRESS_TRACE_REPORTING", SuppressEmailNotification = "SUPPRESS_EMAIL_NOTIFICATION", StockReward = "STOCK_REWARD", SuppressRegFees = "SUPPRESS_REG_FEES", SuppressSecFee = "SUPPRESS_SEC_FEE", SuppressTafFee = "SUPPRESS_TAF_FEE", DividendReinvestment = "DIVIDEND_REINVESTMENT", } export type TradeAllocationCreateSpecialInstructionsOpen = OpenEnum< typeof TradeAllocationCreateSpecialInstructions >; /** * Denotes the side of the position going into the to_account_id. A to_side of SELL indicates the position will be allocated with a BUY out of the from_account, and a SELL into the to_account. */ export enum ToSide { SideUnspecified = "SIDE_UNSPECIFIED", Buy = "BUY", Sell = "SELL", } /** * Denotes the side of the position going into the to_account_id. A to_side of SELL indicates the position will be allocated with a BUY out of the from_account, and a SELL into the to_account. */ export type ToSideOpen = OpenEnum; /** * Denotes that this trade allocation was either when_issued or when_distributed. */ export enum TradeAllocationCreateWhenIssued { WhenIssuedTypeUnspecified = "WHEN_ISSUED_TYPE_UNSPECIFIED", WhenIssued = "WHEN_ISSUED", WhenDistributed = "WHEN_DISTRIBUTED", } /** * Denotes that this trade allocation was either when_issued or when_distributed. */ export type TradeAllocationCreateWhenIssuedOpen = OpenEnum< typeof TradeAllocationCreateWhenIssued >; /** * A TradeAllocation represents the movement of positions between two ascend accounts. */ export type TradeAllocationCreate = { /** * A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][]. * * @remarks * * [BigDecimal]: * https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html * [decimal.Decimal]: https://docs.python.org/3/library/decimal.html */ accruedInterestAmount?: DecimalCreate | undefined; /** * Free form instructions that can be used to provide additional instructions (that are not captured by existing special instructions) and will be put on the trade confirm. */ additionalInstructions?: string | undefined; /** * Type of the asset being traded. */ assetType: TradeAllocationCreateAssetTypeOpen; /** * 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; /** * Broker capacity for the trade. */ brokerCapacity: TradeAllocationCreateBrokerCapacityOpen; /** * The unique identifier that is associated with an order. This is useful for associating the trade allocation with the original trade. This will be assigned a unique UUID if not provided. */ clientOrderId?: string | undefined; /** * A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][]. * * @remarks * * [BigDecimal]: * https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html * [decimal.Decimal]: https://docs.python.org/3/library/decimal.html */ commissionAmount?: DecimalCreate | undefined; /** * Timestamp of when the trade allocation 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; /** * Client calculated fees that will only be applied to the to_account_id. Regulatory fees will be calculated automatically if they are not explicitly overwritten or suppressed. */ fees?: Array | undefined; /** * The ULID formatted account_id that the positions will be moved from. */ fromAccountId: string; /** * A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][]. * * @remarks * * [BigDecimal]: * https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html * [decimal.Decimal]: https://docs.python.org/3/library/decimal.html */ grossAmount?: DecimalCreate | undefined; /** * Identifier (of the type specified in `identifier_type`). Responses will supply the originally requested identifier. */ identifier: string; /** * Identifier type for the asset being traded. */ identifierType: TradeAllocationCreateIdentifierTypeOpen; /** * Unicode CLDR region code. Issuing Region Code is required for some `identifier_type`s, especially CUSIP. */ issuingRegionCode?: string | undefined; /** * One or many lot matching instructions for the trade allocation. */ lotMatchingInstructions?: Array | 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; /** * A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][]. * * @remarks * * [BigDecimal]: * https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html * [decimal.Decimal]: https://docs.python.org/3/library/decimal.html */ prevailingMarketPrice?: DecimalCreate | undefined; /** * A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][]. * * @remarks * * [BigDecimal]: * https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html * [decimal.Decimal]: https://docs.python.org/3/library/decimal.html */ price: DecimalCreate; /** * Price adjustment that will be applied to the net price of the security. */ priceAdjustment?: PriceAdjustmentCreate | undefined; /** * A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][]. * * @remarks * * [BigDecimal]: * https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html * [decimal.Decimal]: https://docs.python.org/3/library/decimal.html */ quantity: DecimalCreate; /** * Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * * @remarks * * * A full date, with non-zero year, month, and day values * A month and day value, with a zero year, such as an anniversary * A year on its own, with zero month and day values * A year and month value, with a zero day, such as a credit card expiration date * * Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and `google.protobuf.Timestamp`. */ settlementDate?: DateCreate | undefined; /** * Side modifier for the trade allocation. */ sideModifier?: TradeAllocationCreateSideModifierOpen | undefined; /** * The source of the submission. */ sourceApplication: string; /** * An enumerated list of values used to indicate certain attributes about a trade allocation (E.g. BROKER_LIQUIDATION) and/or trigger downstream processing rules (e.g. SUPPRESS_TRACE_REPORTING) */ specialInstructions?: | Array | undefined; /** * The ULID formatted account_id that the positions will be moved to. */ toAccountId: string; /** * Denotes the side of the position going into the to_account_id. A to_side of SELL indicates the position will be allocated with a BUY out of the from_account, and a SELL into the to_account. */ toSide: ToSideOpen; /** * Denotes that this trade allocation was either when_issued or when_distributed. */ whenIssued?: TradeAllocationCreateWhenIssuedOpen | undefined; }; /** @internal */ export const TradeAllocationCreateAssetType$inboundSchema: z.ZodType< TradeAllocationCreateAssetTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(TradeAllocationCreateAssetType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const TradeAllocationCreateAssetType$outboundSchema: z.ZodType< TradeAllocationCreateAssetTypeOpen, z.ZodTypeDef, TradeAllocationCreateAssetTypeOpen > = z.union([ z.nativeEnum(TradeAllocationCreateAssetType), 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 TradeAllocationCreateAssetType$ { /** @deprecated use `TradeAllocationCreateAssetType$inboundSchema` instead. */ export const inboundSchema = TradeAllocationCreateAssetType$inboundSchema; /** @deprecated use `TradeAllocationCreateAssetType$outboundSchema` instead. */ export const outboundSchema = TradeAllocationCreateAssetType$outboundSchema; } /** @internal */ export const TradeAllocationCreateBrokerCapacity$inboundSchema: z.ZodType< TradeAllocationCreateBrokerCapacityOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(TradeAllocationCreateBrokerCapacity), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const TradeAllocationCreateBrokerCapacity$outboundSchema: z.ZodType< TradeAllocationCreateBrokerCapacityOpen, z.ZodTypeDef, TradeAllocationCreateBrokerCapacityOpen > = z.union([ z.nativeEnum(TradeAllocationCreateBrokerCapacity), 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 TradeAllocationCreateBrokerCapacity$ { /** @deprecated use `TradeAllocationCreateBrokerCapacity$inboundSchema` instead. */ export const inboundSchema = TradeAllocationCreateBrokerCapacity$inboundSchema; /** @deprecated use `TradeAllocationCreateBrokerCapacity$outboundSchema` instead. */ export const outboundSchema = TradeAllocationCreateBrokerCapacity$outboundSchema; } /** @internal */ export const TradeAllocationCreateIdentifierType$inboundSchema: z.ZodType< TradeAllocationCreateIdentifierTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(TradeAllocationCreateIdentifierType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const TradeAllocationCreateIdentifierType$outboundSchema: z.ZodType< TradeAllocationCreateIdentifierTypeOpen, z.ZodTypeDef, TradeAllocationCreateIdentifierTypeOpen > = z.union([ z.nativeEnum(TradeAllocationCreateIdentifierType), 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 TradeAllocationCreateIdentifierType$ { /** @deprecated use `TradeAllocationCreateIdentifierType$inboundSchema` instead. */ export const inboundSchema = TradeAllocationCreateIdentifierType$inboundSchema; /** @deprecated use `TradeAllocationCreateIdentifierType$outboundSchema` instead. */ export const outboundSchema = TradeAllocationCreateIdentifierType$outboundSchema; } /** @internal */ export const TradeAllocationCreateSideModifier$inboundSchema: z.ZodType< TradeAllocationCreateSideModifierOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(TradeAllocationCreateSideModifier), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const TradeAllocationCreateSideModifier$outboundSchema: z.ZodType< TradeAllocationCreateSideModifierOpen, z.ZodTypeDef, TradeAllocationCreateSideModifierOpen > = z.union([ z.nativeEnum(TradeAllocationCreateSideModifier), 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 TradeAllocationCreateSideModifier$ { /** @deprecated use `TradeAllocationCreateSideModifier$inboundSchema` instead. */ export const inboundSchema = TradeAllocationCreateSideModifier$inboundSchema; /** @deprecated use `TradeAllocationCreateSideModifier$outboundSchema` instead. */ export const outboundSchema = TradeAllocationCreateSideModifier$outboundSchema; } /** @internal */ export const TradeAllocationCreateSpecialInstructions$inboundSchema: z.ZodType< TradeAllocationCreateSpecialInstructionsOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(TradeAllocationCreateSpecialInstructions), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const TradeAllocationCreateSpecialInstructions$outboundSchema: z.ZodType< TradeAllocationCreateSpecialInstructionsOpen, z.ZodTypeDef, TradeAllocationCreateSpecialInstructionsOpen > = z.union([ z.nativeEnum(TradeAllocationCreateSpecialInstructions), 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 TradeAllocationCreateSpecialInstructions$ { /** @deprecated use `TradeAllocationCreateSpecialInstructions$inboundSchema` instead. */ export const inboundSchema = TradeAllocationCreateSpecialInstructions$inboundSchema; /** @deprecated use `TradeAllocationCreateSpecialInstructions$outboundSchema` instead. */ export const outboundSchema = TradeAllocationCreateSpecialInstructions$outboundSchema; } /** @internal */ export const ToSide$inboundSchema: z.ZodType< ToSideOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(ToSide), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const ToSide$outboundSchema: z.ZodType< ToSideOpen, z.ZodTypeDef, ToSideOpen > = z.union([ z.nativeEnum(ToSide), 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 ToSide$ { /** @deprecated use `ToSide$inboundSchema` instead. */ export const inboundSchema = ToSide$inboundSchema; /** @deprecated use `ToSide$outboundSchema` instead. */ export const outboundSchema = ToSide$outboundSchema; } /** @internal */ export const TradeAllocationCreateWhenIssued$inboundSchema: z.ZodType< TradeAllocationCreateWhenIssuedOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(TradeAllocationCreateWhenIssued), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const TradeAllocationCreateWhenIssued$outboundSchema: z.ZodType< TradeAllocationCreateWhenIssuedOpen, z.ZodTypeDef, TradeAllocationCreateWhenIssuedOpen > = z.union([ z.nativeEnum(TradeAllocationCreateWhenIssued), 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 TradeAllocationCreateWhenIssued$ { /** @deprecated use `TradeAllocationCreateWhenIssued$inboundSchema` instead. */ export const inboundSchema = TradeAllocationCreateWhenIssued$inboundSchema; /** @deprecated use `TradeAllocationCreateWhenIssued$outboundSchema` instead. */ export const outboundSchema = TradeAllocationCreateWhenIssued$outboundSchema; } /** @internal */ export const TradeAllocationCreate$inboundSchema: z.ZodType< TradeAllocationCreate, z.ZodTypeDef, unknown > = z.object({ accrued_interest_amount: DecimalCreate$inboundSchema.optional(), additional_instructions: z.string().optional(), asset_type: TradeAllocationCreateAssetType$inboundSchema, bond_yield: z.array(BondYieldCreate$inboundSchema).optional(), broker_capacity: TradeAllocationCreateBrokerCapacity$inboundSchema, client_order_id: z.string().optional(), commission_amount: DecimalCreate$inboundSchema.optional(), execution_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), fees: z.array(BookingFeeCreate$inboundSchema).optional(), from_account_id: z.string(), gross_amount: DecimalCreate$inboundSchema.optional(), identifier: z.string(), identifier_type: TradeAllocationCreateIdentifierType$inboundSchema, issuing_region_code: z.string().optional(), lot_matching_instructions: z.array(LotCreate$inboundSchema).optional(), memo: z.string().optional(), prevailing_market_price: DecimalCreate$inboundSchema.optional(), price: DecimalCreate$inboundSchema, price_adjustment: PriceAdjustmentCreate$inboundSchema.optional(), quantity: DecimalCreate$inboundSchema, settlement_date: DateCreate$inboundSchema.optional(), side_modifier: TradeAllocationCreateSideModifier$inboundSchema.optional(), source_application: z.string(), special_instructions: z.array( TradeAllocationCreateSpecialInstructions$inboundSchema, ).optional(), to_account_id: z.string(), to_side: ToSide$inboundSchema, when_issued: TradeAllocationCreateWhenIssued$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "accrued_interest_amount": "accruedInterestAmount", "additional_instructions": "additionalInstructions", "asset_type": "assetType", "bond_yield": "bondYield", "broker_capacity": "brokerCapacity", "client_order_id": "clientOrderId", "commission_amount": "commissionAmount", "execution_time": "executionTime", "from_account_id": "fromAccountId", "gross_amount": "grossAmount", "identifier_type": "identifierType", "issuing_region_code": "issuingRegionCode", "lot_matching_instructions": "lotMatchingInstructions", "prevailing_market_price": "prevailingMarketPrice", "price_adjustment": "priceAdjustment", "settlement_date": "settlementDate", "side_modifier": "sideModifier", "source_application": "sourceApplication", "special_instructions": "specialInstructions", "to_account_id": "toAccountId", "to_side": "toSide", "when_issued": "whenIssued", }); }); /** @internal */ export type TradeAllocationCreate$Outbound = { accrued_interest_amount?: DecimalCreate$Outbound | undefined; additional_instructions?: string | undefined; asset_type: string; bond_yield?: Array | undefined; broker_capacity: string; client_order_id?: string | undefined; commission_amount?: DecimalCreate$Outbound | undefined; execution_time: string | null; fees?: Array | undefined; from_account_id: string; gross_amount?: DecimalCreate$Outbound | undefined; identifier: string; identifier_type: string; issuing_region_code?: string | undefined; lot_matching_instructions?: Array | undefined; memo?: string | undefined; prevailing_market_price?: DecimalCreate$Outbound | undefined; price: DecimalCreate$Outbound; price_adjustment?: PriceAdjustmentCreate$Outbound | undefined; quantity: DecimalCreate$Outbound; settlement_date?: DateCreate$Outbound | undefined; side_modifier?: string | undefined; source_application: string; special_instructions?: Array | undefined; to_account_id: string; to_side: string; when_issued?: string | undefined; }; /** @internal */ export const TradeAllocationCreate$outboundSchema: z.ZodType< TradeAllocationCreate$Outbound, z.ZodTypeDef, TradeAllocationCreate > = z.object({ accruedInterestAmount: DecimalCreate$outboundSchema.optional(), additionalInstructions: z.string().optional(), assetType: TradeAllocationCreateAssetType$outboundSchema, bondYield: z.array(BondYieldCreate$outboundSchema).optional(), brokerCapacity: TradeAllocationCreateBrokerCapacity$outboundSchema, clientOrderId: z.string().optional(), commissionAmount: DecimalCreate$outboundSchema.optional(), executionTime: z.nullable(z.date().transform(v => v.toISOString())), fees: z.array(BookingFeeCreate$outboundSchema).optional(), fromAccountId: z.string(), grossAmount: DecimalCreate$outboundSchema.optional(), identifier: z.string(), identifierType: TradeAllocationCreateIdentifierType$outboundSchema, issuingRegionCode: z.string().optional(), lotMatchingInstructions: z.array(LotCreate$outboundSchema).optional(), memo: z.string().optional(), prevailingMarketPrice: DecimalCreate$outboundSchema.optional(), price: DecimalCreate$outboundSchema, priceAdjustment: PriceAdjustmentCreate$outboundSchema.optional(), quantity: DecimalCreate$outboundSchema, settlementDate: DateCreate$outboundSchema.optional(), sideModifier: TradeAllocationCreateSideModifier$outboundSchema.optional(), sourceApplication: z.string(), specialInstructions: z.array( TradeAllocationCreateSpecialInstructions$outboundSchema, ).optional(), toAccountId: z.string(), toSide: ToSide$outboundSchema, whenIssued: TradeAllocationCreateWhenIssued$outboundSchema.optional(), }).transform((v) => { return remap$(v, { accruedInterestAmount: "accrued_interest_amount", additionalInstructions: "additional_instructions", assetType: "asset_type", bondYield: "bond_yield", brokerCapacity: "broker_capacity", clientOrderId: "client_order_id", commissionAmount: "commission_amount", executionTime: "execution_time", fromAccountId: "from_account_id", grossAmount: "gross_amount", identifierType: "identifier_type", issuingRegionCode: "issuing_region_code", lotMatchingInstructions: "lot_matching_instructions", prevailingMarketPrice: "prevailing_market_price", priceAdjustment: "price_adjustment", settlementDate: "settlement_date", sideModifier: "side_modifier", sourceApplication: "source_application", specialInstructions: "special_instructions", toAccountId: "to_account_id", toSide: "to_side", whenIssued: "when_issued", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace TradeAllocationCreate$ { /** @deprecated use `TradeAllocationCreate$inboundSchema` instead. */ export const inboundSchema = TradeAllocationCreate$inboundSchema; /** @deprecated use `TradeAllocationCreate$outboundSchema` instead. */ export const outboundSchema = TradeAllocationCreate$outboundSchema; /** @deprecated use `TradeAllocationCreate$Outbound` instead. */ export type Outbound = TradeAllocationCreate$Outbound; } export function tradeAllocationCreateToJSON( tradeAllocationCreate: TradeAllocationCreate, ): string { return JSON.stringify( TradeAllocationCreate$outboundSchema.parse(tradeAllocationCreate), ); } export function tradeAllocationCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TradeAllocationCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TradeAllocationCreate' from JSON`, ); }