/* * 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 { BookingFee, BookingFee$inboundSchema, BookingFee$Outbound, BookingFee$outboundSchema, } from "./bookingfee.js"; import { BookingLot, BookingLot$inboundSchema, BookingLot$Outbound, BookingLot$outboundSchema, } from "./bookinglot.js"; import { Execution, Execution$inboundSchema, Execution$Outbound, Execution$outboundSchema, } from "./execution.js"; /** * Type of the asset being traded. */ export enum BookingTradeAssetType { AssetTypeUnspecified = "ASSET_TYPE_UNSPECIFIED", Equity = "EQUITY", FixedIncome = "FIXED_INCOME", } /** * Type of the asset being traded. */ export type BookingTradeAssetTypeOpen = OpenEnum; /** * Broker capacity for the trade. */ export enum BookingTradeBrokerCapacity { CapacityUnspecified = "CAPACITY_UNSPECIFIED", Agency = "AGENCY", Principal = "PRINCIPAL", Mixed = "MIXED", } /** * Broker capacity for the trade. */ export type BookingTradeBrokerCapacityOpen = OpenEnum< typeof BookingTradeBrokerCapacity >; /** * Identifier type for the asset being traded. */ export enum BookingTradeIdentifierType { IdentifierTypeUnspecified = "IDENTIFIER_TYPE_UNSPECIFIED", AssetId = "ASSET_ID", Symbol = "SYMBOL", Cusip = "CUSIP", Isin = "ISIN", } /** * Identifier type for the asset being traded. */ export type BookingTradeIdentifierTypeOpen = OpenEnum< typeof BookingTradeIdentifierType >; /** * Date field to support extended trading hours. */ export type LocalMarketTradeDate = { /** * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. */ day?: number | undefined; /** * Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */ month?: number | undefined; /** * Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */ year?: number | undefined; }; /** * Route type for the trade. */ export enum BookingTradeRouteType { RouteTypeUnspecified = "ROUTE_TYPE_UNSPECIFIED", Dma = "DMA", Mngd = "MNGD", Quik = "QUIK", Algo = "ALGO", Away = "AWAY", Corr = "CORR", Boats = "BOATS", } /** * Route type for the trade. */ export type BookingTradeRouteTypeOpen = OpenEnum; /** * Defaults to T+1 for equities if this is not provided. Calculated by the execution's execution_time field in Eastern Time. */ export type BookingTradeSettlementDate = { /** * Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. */ day?: number | undefined; /** * Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */ month?: number | undefined; /** * Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */ year?: number | undefined; }; /** * Denotes if the trade is a SELL or a BUY. */ export enum BookingTradeSide { SideUnspecified = "SIDE_UNSPECIFIED", Buy = "BUY", Sell = "SELL", } /** * Denotes if the trade is a SELL or a BUY. */ export type BookingTradeSideOpen = OpenEnum; /** * Side modifier for the trade. */ export enum BookingTradeSideModifier { SideModifierUnspecified = "SIDE_MODIFIER_UNSPECIFIED", Short = "SHORT", ShortExempt = "SHORT_EXEMPT", ShortCover = "SHORT_COVER", Open = "OPEN", Close = "CLOSE", } /** * Side modifier for the trade. */ export type BookingTradeSideModifierOpen = OpenEnum< typeof BookingTradeSideModifier >; export enum BookingTradeSpecialInstructions { 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 BookingTradeSpecialInstructionsOpen = OpenEnum< typeof BookingTradeSpecialInstructions >; /** * Exchange venue */ export enum BookingTradeVenue { ExchangeVenueUnspecified = "EXCHANGE_VENUE_UNSPECIFIED", Amex = "AMEX", Arca = "ARCA", Bats = "BATS", BatsByx = "BATS_BYX", Boston = "BOSTON", Box = "BOX", Bzx = "BZX", C2 = "C2", Cboe = "CBOE", Chicago = "CHICAGO", Cincinnati = "CINCINNATI", Edga = "EDGA", Edgx = "EDGX", Exclearing = "EXCLEARING", Iex = "IEX", Ise = "ISE", IseGemini = "ISE_GEMINI", Miax = "MIAX", Nasdaq = "NASDAQ", NasdaqOmxBx = "NASDAQ_OMX_BX", Nyse = "NYSE", Phlx = "PHLX", Otc = "OTC", Qsr = "QSR", } /** * Exchange venue */ export type BookingTradeVenueOpen = OpenEnum; /** * Denotes that this trade was either when_issued or when_distributed. */ export enum BookingTradeWhenIssued { WhenIssuedTypeUnspecified = "WHEN_ISSUED_TYPE_UNSPECIFIED", WhenIssued = "WHEN_ISSUED", WhenDistributed = "WHEN_DISTRIBUTED", } /** * Denotes that this trade was either when_issued or when_distributed. */ export type BookingTradeWhenIssuedOpen = OpenEnum< typeof BookingTradeWhenIssued >; /** * A Trade represents an entire order made by a client. Trades can hold one or many executions representing partial fills that aggregate into a whole order. */ export type BookingTrade = { /** * A globally unique identifier referencing a single account. */ accountId?: string | undefined; /** * The current activity_id of this trade in the Ledger. */ activityId?: string | 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; /** * Fractional support for market-makers' internal order ids. */ alternateOrderId?: string | undefined; /** * Type of the asset being traded. */ assetType?: BookingTradeAssetTypeOpen | undefined; /** * Broker capacity for the trade. */ brokerCapacity?: BookingTradeBrokerCapacityOpen | undefined; /** * The unique identifier that is associated with an order. Must be unique by date per trade per client. */ clientOrderId?: string | undefined; /** * Executing broker of the trade. */ executingBroker?: string | undefined; /** * The executions (sometimes referred to as partial-fills) that comprise the trade. */ executions?: Array | undefined; /** * Any client calculated fees associated with the trade. Only allowed if trade.open = false. Regulatory fees will be calculated automatically if they are not explicitly overwritten or suppressed. */ fees?: Array | undefined; /** * Identifier (of the type specified in `identifier_type`). Responses will supply the originally requested identifier. */ identifier?: string | undefined; /** * Identifier type for the asset being traded. */ identifierType?: BookingTradeIdentifierTypeOpen | undefined; /** * Unicode CLDR region code. Issuing Region Code is required for some `identifier_type`s, especially CUSIP. */ issuingRegionCode?: string | undefined; /** * Date field to support extended trading hours. */ localMarketTradeDate?: LocalMarketTradeDate | null | undefined; /** * One or many lot matching instructions for the trade. */ lotMatchingInstructions?: Array | undefined; /** * Market Identifier Code */ micCode?: string | undefined; /** * The resource name of the trade. */ name?: string | undefined; /** * State of this trade's completeness in filling. True: trade is not done filling and can append more executions onto the trade False: trade is done filling and cannot append more executions onto the trade By default, trades are closed when they are created. An open trade can later be closed by calling the CompleteTrade endpoint. Additional executions can be appended to an open trade by calling the CreateExecution endpoint. Trades that are left open will be automatically closed nightly before Ledger's EOD. */ open?: boolean | undefined; /** * Street-level order id, unique by day per broker. */ orderId?: string | undefined; /** * Route type for the trade. */ routeType?: BookingTradeRouteTypeOpen | undefined; /** * Defaults to T+1 for equities if this is not provided. Calculated by the execution's execution_time field in Eastern Time. */ settlementDate?: BookingTradeSettlementDate | null | undefined; /** * Denotes if the trade is a SELL or a BUY. */ side?: BookingTradeSideOpen | undefined; /** * Side modifier for the trade. */ sideModifier?: BookingTradeSideModifierOpen | undefined; /** * The source of the submission. */ sourceApplication?: string | undefined; /** * An enumerated list of values used to indicate certain attributes about a trade (E.g. DISCRETION_EXERCISED, BROKER_LIQUIDATION) and/or trigger downstream processing rules (e.g. SUPPRESS_TRACE_REPORTING) */ specialInstructions?: Array | undefined; /** * A ULID to uniquely identify the trade globally. */ tradeId?: string | undefined; /** * Exchange venue */ venue?: BookingTradeVenueOpen | undefined; /** * Denotes that this trade was either when_issued or when_distributed. */ whenIssued?: BookingTradeWhenIssuedOpen | undefined; }; /** @internal */ export const BookingTradeAssetType$inboundSchema: z.ZodType< BookingTradeAssetTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(BookingTradeAssetType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const BookingTradeAssetType$outboundSchema: z.ZodType< BookingTradeAssetTypeOpen, z.ZodTypeDef, BookingTradeAssetTypeOpen > = z.union([ z.nativeEnum(BookingTradeAssetType), 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 BookingTradeAssetType$ { /** @deprecated use `BookingTradeAssetType$inboundSchema` instead. */ export const inboundSchema = BookingTradeAssetType$inboundSchema; /** @deprecated use `BookingTradeAssetType$outboundSchema` instead. */ export const outboundSchema = BookingTradeAssetType$outboundSchema; } /** @internal */ export const BookingTradeBrokerCapacity$inboundSchema: z.ZodType< BookingTradeBrokerCapacityOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(BookingTradeBrokerCapacity), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const BookingTradeBrokerCapacity$outboundSchema: z.ZodType< BookingTradeBrokerCapacityOpen, z.ZodTypeDef, BookingTradeBrokerCapacityOpen > = z.union([ z.nativeEnum(BookingTradeBrokerCapacity), 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 BookingTradeBrokerCapacity$ { /** @deprecated use `BookingTradeBrokerCapacity$inboundSchema` instead. */ export const inboundSchema = BookingTradeBrokerCapacity$inboundSchema; /** @deprecated use `BookingTradeBrokerCapacity$outboundSchema` instead. */ export const outboundSchema = BookingTradeBrokerCapacity$outboundSchema; } /** @internal */ export const BookingTradeIdentifierType$inboundSchema: z.ZodType< BookingTradeIdentifierTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(BookingTradeIdentifierType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const BookingTradeIdentifierType$outboundSchema: z.ZodType< BookingTradeIdentifierTypeOpen, z.ZodTypeDef, BookingTradeIdentifierTypeOpen > = z.union([ z.nativeEnum(BookingTradeIdentifierType), 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 BookingTradeIdentifierType$ { /** @deprecated use `BookingTradeIdentifierType$inboundSchema` instead. */ export const inboundSchema = BookingTradeIdentifierType$inboundSchema; /** @deprecated use `BookingTradeIdentifierType$outboundSchema` instead. */ export const outboundSchema = BookingTradeIdentifierType$outboundSchema; } /** @internal */ export const LocalMarketTradeDate$inboundSchema: z.ZodType< LocalMarketTradeDate, z.ZodTypeDef, unknown > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** @internal */ export type LocalMarketTradeDate$Outbound = { day?: number | undefined; month?: number | undefined; year?: number | undefined; }; /** @internal */ export const LocalMarketTradeDate$outboundSchema: z.ZodType< LocalMarketTradeDate$Outbound, z.ZodTypeDef, LocalMarketTradeDate > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LocalMarketTradeDate$ { /** @deprecated use `LocalMarketTradeDate$inboundSchema` instead. */ export const inboundSchema = LocalMarketTradeDate$inboundSchema; /** @deprecated use `LocalMarketTradeDate$outboundSchema` instead. */ export const outboundSchema = LocalMarketTradeDate$outboundSchema; /** @deprecated use `LocalMarketTradeDate$Outbound` instead. */ export type Outbound = LocalMarketTradeDate$Outbound; } export function localMarketTradeDateToJSON( localMarketTradeDate: LocalMarketTradeDate, ): string { return JSON.stringify( LocalMarketTradeDate$outboundSchema.parse(localMarketTradeDate), ); } export function localMarketTradeDateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LocalMarketTradeDate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LocalMarketTradeDate' from JSON`, ); } /** @internal */ export const BookingTradeRouteType$inboundSchema: z.ZodType< BookingTradeRouteTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(BookingTradeRouteType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const BookingTradeRouteType$outboundSchema: z.ZodType< BookingTradeRouteTypeOpen, z.ZodTypeDef, BookingTradeRouteTypeOpen > = z.union([ z.nativeEnum(BookingTradeRouteType), 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 BookingTradeRouteType$ { /** @deprecated use `BookingTradeRouteType$inboundSchema` instead. */ export const inboundSchema = BookingTradeRouteType$inboundSchema; /** @deprecated use `BookingTradeRouteType$outboundSchema` instead. */ export const outboundSchema = BookingTradeRouteType$outboundSchema; } /** @internal */ export const BookingTradeSettlementDate$inboundSchema: z.ZodType< BookingTradeSettlementDate, z.ZodTypeDef, unknown > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** @internal */ export type BookingTradeSettlementDate$Outbound = { day?: number | undefined; month?: number | undefined; year?: number | undefined; }; /** @internal */ export const BookingTradeSettlementDate$outboundSchema: z.ZodType< BookingTradeSettlementDate$Outbound, z.ZodTypeDef, BookingTradeSettlementDate > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace BookingTradeSettlementDate$ { /** @deprecated use `BookingTradeSettlementDate$inboundSchema` instead. */ export const inboundSchema = BookingTradeSettlementDate$inboundSchema; /** @deprecated use `BookingTradeSettlementDate$outboundSchema` instead. */ export const outboundSchema = BookingTradeSettlementDate$outboundSchema; /** @deprecated use `BookingTradeSettlementDate$Outbound` instead. */ export type Outbound = BookingTradeSettlementDate$Outbound; } export function bookingTradeSettlementDateToJSON( bookingTradeSettlementDate: BookingTradeSettlementDate, ): string { return JSON.stringify( BookingTradeSettlementDate$outboundSchema.parse(bookingTradeSettlementDate), ); } export function bookingTradeSettlementDateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingTradeSettlementDate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingTradeSettlementDate' from JSON`, ); } /** @internal */ export const BookingTradeSide$inboundSchema: z.ZodType< BookingTradeSideOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(BookingTradeSide), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const BookingTradeSide$outboundSchema: z.ZodType< BookingTradeSideOpen, z.ZodTypeDef, BookingTradeSideOpen > = z.union([ z.nativeEnum(BookingTradeSide), 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 BookingTradeSide$ { /** @deprecated use `BookingTradeSide$inboundSchema` instead. */ export const inboundSchema = BookingTradeSide$inboundSchema; /** @deprecated use `BookingTradeSide$outboundSchema` instead. */ export const outboundSchema = BookingTradeSide$outboundSchema; } /** @internal */ export const BookingTradeSideModifier$inboundSchema: z.ZodType< BookingTradeSideModifierOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(BookingTradeSideModifier), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const BookingTradeSideModifier$outboundSchema: z.ZodType< BookingTradeSideModifierOpen, z.ZodTypeDef, BookingTradeSideModifierOpen > = z.union([ z.nativeEnum(BookingTradeSideModifier), 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 BookingTradeSideModifier$ { /** @deprecated use `BookingTradeSideModifier$inboundSchema` instead. */ export const inboundSchema = BookingTradeSideModifier$inboundSchema; /** @deprecated use `BookingTradeSideModifier$outboundSchema` instead. */ export const outboundSchema = BookingTradeSideModifier$outboundSchema; } /** @internal */ export const BookingTradeSpecialInstructions$inboundSchema: z.ZodType< BookingTradeSpecialInstructionsOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(BookingTradeSpecialInstructions), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const BookingTradeSpecialInstructions$outboundSchema: z.ZodType< BookingTradeSpecialInstructionsOpen, z.ZodTypeDef, BookingTradeSpecialInstructionsOpen > = z.union([ z.nativeEnum(BookingTradeSpecialInstructions), 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 BookingTradeSpecialInstructions$ { /** @deprecated use `BookingTradeSpecialInstructions$inboundSchema` instead. */ export const inboundSchema = BookingTradeSpecialInstructions$inboundSchema; /** @deprecated use `BookingTradeSpecialInstructions$outboundSchema` instead. */ export const outboundSchema = BookingTradeSpecialInstructions$outboundSchema; } /** @internal */ export const BookingTradeVenue$inboundSchema: z.ZodType< BookingTradeVenueOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(BookingTradeVenue), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const BookingTradeVenue$outboundSchema: z.ZodType< BookingTradeVenueOpen, z.ZodTypeDef, BookingTradeVenueOpen > = z.union([ z.nativeEnum(BookingTradeVenue), 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 BookingTradeVenue$ { /** @deprecated use `BookingTradeVenue$inboundSchema` instead. */ export const inboundSchema = BookingTradeVenue$inboundSchema; /** @deprecated use `BookingTradeVenue$outboundSchema` instead. */ export const outboundSchema = BookingTradeVenue$outboundSchema; } /** @internal */ export const BookingTradeWhenIssued$inboundSchema: z.ZodType< BookingTradeWhenIssuedOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(BookingTradeWhenIssued), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const BookingTradeWhenIssued$outboundSchema: z.ZodType< BookingTradeWhenIssuedOpen, z.ZodTypeDef, BookingTradeWhenIssuedOpen > = z.union([ z.nativeEnum(BookingTradeWhenIssued), 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 BookingTradeWhenIssued$ { /** @deprecated use `BookingTradeWhenIssued$inboundSchema` instead. */ export const inboundSchema = BookingTradeWhenIssued$inboundSchema; /** @deprecated use `BookingTradeWhenIssued$outboundSchema` instead. */ export const outboundSchema = BookingTradeWhenIssued$outboundSchema; } /** @internal */ export const BookingTrade$inboundSchema: z.ZodType< BookingTrade, z.ZodTypeDef, unknown > = z.object({ account_id: z.string().optional(), activity_id: z.string().optional(), additional_instructions: z.string().optional(), alternate_order_id: z.string().optional(), asset_type: BookingTradeAssetType$inboundSchema.optional(), broker_capacity: BookingTradeBrokerCapacity$inboundSchema.optional(), client_order_id: z.string().optional(), executing_broker: z.string().optional(), executions: z.array(Execution$inboundSchema).optional(), fees: z.array(BookingFee$inboundSchema).optional(), identifier: z.string().optional(), identifier_type: BookingTradeIdentifierType$inboundSchema.optional(), issuing_region_code: z.string().optional(), local_market_trade_date: z.nullable( z.lazy(() => LocalMarketTradeDate$inboundSchema), ).optional(), lot_matching_instructions: z.array(BookingLot$inboundSchema).optional(), mic_code: z.string().optional(), name: z.string().optional(), open: z.boolean().optional(), order_id: z.string().optional(), route_type: BookingTradeRouteType$inboundSchema.optional(), settlement_date: z.nullable( z.lazy(() => BookingTradeSettlementDate$inboundSchema), ).optional(), side: BookingTradeSide$inboundSchema.optional(), side_modifier: BookingTradeSideModifier$inboundSchema.optional(), source_application: z.string().optional(), special_instructions: z.array(BookingTradeSpecialInstructions$inboundSchema) .optional(), trade_id: z.string().optional(), venue: BookingTradeVenue$inboundSchema.optional(), when_issued: BookingTradeWhenIssued$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "account_id": "accountId", "activity_id": "activityId", "additional_instructions": "additionalInstructions", "alternate_order_id": "alternateOrderId", "asset_type": "assetType", "broker_capacity": "brokerCapacity", "client_order_id": "clientOrderId", "executing_broker": "executingBroker", "identifier_type": "identifierType", "issuing_region_code": "issuingRegionCode", "local_market_trade_date": "localMarketTradeDate", "lot_matching_instructions": "lotMatchingInstructions", "mic_code": "micCode", "order_id": "orderId", "route_type": "routeType", "settlement_date": "settlementDate", "side_modifier": "sideModifier", "source_application": "sourceApplication", "special_instructions": "specialInstructions", "trade_id": "tradeId", "when_issued": "whenIssued", }); }); /** @internal */ export type BookingTrade$Outbound = { account_id?: string | undefined; activity_id?: string | undefined; additional_instructions?: string | undefined; alternate_order_id?: string | undefined; asset_type?: string | undefined; broker_capacity?: string | undefined; client_order_id?: string | undefined; executing_broker?: string | undefined; executions?: Array | undefined; fees?: Array | undefined; identifier?: string | undefined; identifier_type?: string | undefined; issuing_region_code?: string | undefined; local_market_trade_date?: LocalMarketTradeDate$Outbound | null | undefined; lot_matching_instructions?: Array | undefined; mic_code?: string | undefined; name?: string | undefined; open?: boolean | undefined; order_id?: string | undefined; route_type?: string | undefined; settlement_date?: BookingTradeSettlementDate$Outbound | null | undefined; side?: string | undefined; side_modifier?: string | undefined; source_application?: string | undefined; special_instructions?: Array | undefined; trade_id?: string | undefined; venue?: string | undefined; when_issued?: string | undefined; }; /** @internal */ export const BookingTrade$outboundSchema: z.ZodType< BookingTrade$Outbound, z.ZodTypeDef, BookingTrade > = z.object({ accountId: z.string().optional(), activityId: z.string().optional(), additionalInstructions: z.string().optional(), alternateOrderId: z.string().optional(), assetType: BookingTradeAssetType$outboundSchema.optional(), brokerCapacity: BookingTradeBrokerCapacity$outboundSchema.optional(), clientOrderId: z.string().optional(), executingBroker: z.string().optional(), executions: z.array(Execution$outboundSchema).optional(), fees: z.array(BookingFee$outboundSchema).optional(), identifier: z.string().optional(), identifierType: BookingTradeIdentifierType$outboundSchema.optional(), issuingRegionCode: z.string().optional(), localMarketTradeDate: z.nullable( z.lazy(() => LocalMarketTradeDate$outboundSchema), ).optional(), lotMatchingInstructions: z.array(BookingLot$outboundSchema).optional(), micCode: z.string().optional(), name: z.string().optional(), open: z.boolean().optional(), orderId: z.string().optional(), routeType: BookingTradeRouteType$outboundSchema.optional(), settlementDate: z.nullable( z.lazy(() => BookingTradeSettlementDate$outboundSchema), ).optional(), side: BookingTradeSide$outboundSchema.optional(), sideModifier: BookingTradeSideModifier$outboundSchema.optional(), sourceApplication: z.string().optional(), specialInstructions: z.array(BookingTradeSpecialInstructions$outboundSchema) .optional(), tradeId: z.string().optional(), venue: BookingTradeVenue$outboundSchema.optional(), whenIssued: BookingTradeWhenIssued$outboundSchema.optional(), }).transform((v) => { return remap$(v, { accountId: "account_id", activityId: "activity_id", additionalInstructions: "additional_instructions", alternateOrderId: "alternate_order_id", assetType: "asset_type", brokerCapacity: "broker_capacity", clientOrderId: "client_order_id", executingBroker: "executing_broker", identifierType: "identifier_type", issuingRegionCode: "issuing_region_code", localMarketTradeDate: "local_market_trade_date", lotMatchingInstructions: "lot_matching_instructions", micCode: "mic_code", orderId: "order_id", routeType: "route_type", settlementDate: "settlement_date", sideModifier: "side_modifier", sourceApplication: "source_application", specialInstructions: "special_instructions", tradeId: "trade_id", 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 BookingTrade$ { /** @deprecated use `BookingTrade$inboundSchema` instead. */ export const inboundSchema = BookingTrade$inboundSchema; /** @deprecated use `BookingTrade$outboundSchema` instead. */ export const outboundSchema = BookingTrade$outboundSchema; /** @deprecated use `BookingTrade$Outbound` instead. */ export type Outbound = BookingTrade$Outbound; } export function bookingTradeToJSON(bookingTrade: BookingTrade): string { return JSON.stringify(BookingTrade$outboundSchema.parse(bookingTrade)); } export function bookingTradeFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => BookingTrade$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BookingTrade' from JSON`, ); }