/* * 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 { TradingExecutedPrice, TradingExecutedPrice$inboundSchema, TradingExecutedPrice$Outbound, TradingExecutedPrice$outboundSchema, } from "./tradingexecutedprice.js"; import { TradingExecutions, TradingExecutions$inboundSchema, TradingExecutions$Outbound, TradingExecutions$outboundSchema, } from "./tradingexecutions.js"; import { TradingFee, TradingFee$inboundSchema, TradingFee$Outbound, TradingFee$outboundSchema, } from "./tradingfee.js"; /** * The type of the asset in this order, which must be one of the following: * * @remarks * EQUITY, MUTUAL_FUND, and FIXED_INCOME. */ export enum OrderAssetType { Equity = "EQUITY", FixedIncome = "FIXED_INCOME", MutualFund = "MUTUAL_FUND", EventContract = "EVENT_CONTRACT", } /** * The type of the asset in this order, which must be one of the following: * * @remarks * EQUITY, MUTUAL_FUND, and FIXED_INCOME. */ export type OrderAssetTypeOpen = OpenEnum; /** * Defaults to "AGENCY" if not specified, except for Fixed Income orders from RIA correspondents which default to "PRINCIPAL" when not specified. For Equities: Only "AGENCY" is allowed. For Mutual Funds: Only "AGENCY" is allowed. For Fixed Income: Either "AGENCY" or "PRINCIPAL" are allowed. - RIA correspondents: Defaults to "PRINCIPAL" if not specified. - Other correspondents: Defaults to "AGENCY" if not specified. For Event Contracts: Only "AGENCY" is allowed. */ export enum OrderBrokerCapacity { BrokerCapacityUnspecified = "BROKER_CAPACITY_UNSPECIFIED", Agency = "AGENCY", Principal = "PRINCIPAL", } /** * Defaults to "AGENCY" if not specified, except for Fixed Income orders from RIA correspondents which default to "PRINCIPAL" when not specified. For Equities: Only "AGENCY" is allowed. For Mutual Funds: Only "AGENCY" is allowed. For Fixed Income: Either "AGENCY" or "PRINCIPAL" are allowed. - RIA correspondents: Defaults to "PRINCIPAL" if not specified. - Other correspondents: Defaults to "AGENCY" if not specified. For Event Contracts: Only "AGENCY" is allowed. */ export type OrderBrokerCapacityOpen = OpenEnum; /** * Output only field that is required for Equity Orders for any client who is having Apex do CAT reporting on their behalf. This field denotes the initiator of the cancel request. This field will be present when provided on the CancelOrderRequest */ export enum CancelInitiator { InitiatorUnspecified = "INITIATOR_UNSPECIFIED", Firm = "FIRM", Client = "CLIENT", } /** * Output only field that is required for Equity Orders for any client who is having Apex do CAT reporting on their behalf. This field denotes the initiator of the cancel request. This field will be present when provided on the CancelOrderRequest */ export type CancelInitiatorOpen = OpenEnum; /** * Used to denote when a cancel request has been rejected. */ export enum CancelRejectedReason { CancelRejectReasonUnspecified = "CANCEL_REJECT_REASON_UNSPECIFIED", TooLateToCancel = "TOO_LATE_TO_CANCEL", CancellationUnknownOrder = "CANCELLATION_UNKNOWN_ORDER", BrokerExchangeOption = "BROKER_EXCHANGE_OPTION", OrderAlreadyInPendingCancelOrPendingReplaceStatus = "ORDER_ALREADY_IN_PENDING_CANCEL_OR_PENDING_REPLACE_STATUS", Duplicate = "DUPLICATE", CancellationSystemError = "CANCELLATION_SYSTEM_ERROR", OrderAlreadyCanceled = "ORDER_ALREADY_CANCELED", CancellationMisconfiguredClient = "CANCELLATION_MISCONFIGURED_CLIENT", } /** * Used to denote when a cancel request has been rejected. */ export type CancelRejectedReasonOpen = OpenEnum; /** * The type of commission value being specified. Only the type of "AMOUNT" is supported. */ export enum OrderCommissionType { CommissionTypeUnspecified = "COMMISSION_TYPE_UNSPECIFIED", Amount = "AMOUNT", } /** * The type of commission value being specified. Only the type of "AMOUNT" is supported. */ export type OrderCommissionTypeOpen = OpenEnum; /** * The value of this commission. If type = `AMOUNT`, then this expresses a monetary value in same currency denoted on the order itself. */ export type Value = { /** * 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 custom commission to be applied to this order. When specifying an AMOUNT type, the value represents a notional amount measured in the currency of the order. Only available for Equity, Mutual Fund, and Fixed Income orders. */ export type OrderCommission = { /** * The type of commission value being specified. Only the type of "AMOUNT" is supported. */ type?: OrderCommissionTypeOpen | undefined; /** * The value of this commission. If type = `AMOUNT`, then this expresses a monetary value in same currency denoted on the order itself. */ value?: Value | null | undefined; }; /** * The sum of order quantity & price, across all fills, reported in the currency specified in the order. (This will be rounded to 2 decimal places for USD currencies). Will be absent if an order has no fill information. */ export type CumulativeNotionalValue = { /** * 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; }; /** * Any reporting data provided by the SetExtraReportingData endpoint. */ export type ExtraReportingData = { cancelConfirmedTime?: Date | null | undefined; }; /** * The summed quantity value across all fills in this order, up to a maximum of 5 decimal places. Will be absent if an order has no fill information. */ export type FilledQuantity = { /** * 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 identifier type of the asset being ordered. For Equities: only SYMBOL is supported For Mutual Funds: only SYMBOL and CUSIP are supported For Fixed Income: only CUSIP and ISIN are supported For Event Contracts: only SYMBOL and ASSET_ID are supported */ export enum OrderIdentifierType { AssetId = "ASSET_ID", Symbol = "SYMBOL", Cusip = "CUSIP", Isin = "ISIN", } /** * The identifier type of the asset being ordered. For Equities: only SYMBOL is supported For Mutual Funds: only SYMBOL and CUSIP are supported For Fixed Income: only CUSIP and ISIN are supported For Event Contracts: only SYMBOL and ASSET_ID are supported */ export type OrderIdentifierTypeOpen = OpenEnum; /** * The amount of the LOI. This is a monetary value in the same currency as the order. */ export type OrderAmount = { /** * 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 period start date, specific to the US Eastern Time Zone, of the LOI. Date range: 90 days in the past and 13 months in the future from the order_date. */ export type PeriodStartDate = { /** * 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; }; /** * Letter of Intent (LOI). An LOI allows investors to receive sales charge discounts based on a commitment to buy a specified monetary amount of shares over a period of time, usually 13 months. */ export type LetterOfIntent = { /** * The amount of the LOI. This is a monetary value in the same currency as the order. */ amount?: OrderAmount | null | undefined; /** * The period start date, specific to the US Eastern Time Zone, of the LOI. Date range: 90 days in the past and 13 months in the future from the order_date. */ periodStartDate?: PeriodStartDate | null | undefined; }; /** * The limit price which must be greater than zero if provided. For equity orders in the USD currency, up to 2 decimal places are allowed for prices above $1 and up to 4 decimal places for prices at or below $1. For fixed income orders this is expressed as a percentage of par, which allows up to 4 decimal places in the USD currency. */ export type OrderPrice = { /** * 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 this price, which must be PRICE_PER_UNIT for equity orders, or PERCENTAGE_OF_PAR for fixed income orders. */ export enum OrderLimitPriceType { LimitPriceTypeUnspecified = "LIMIT_PRICE_TYPE_UNSPECIFIED", PricePerUnit = "PRICE_PER_UNIT", PercentageOfPar = "PERCENTAGE_OF_PAR", } /** * The type of this price, which must be PRICE_PER_UNIT for equity orders, or PERCENTAGE_OF_PAR for fixed income orders. */ export type OrderLimitPriceTypeOpen = OpenEnum; /** * The limit price for this order. */ export type LimitPrice = { /** * The limit price which must be greater than zero if provided. For equity orders in the USD currency, up to 2 decimal places are allowed for prices above $1 and up to 4 decimal places for prices at or below $1. For fixed income orders this is expressed as a percentage of par, which allows up to 4 decimal places in the USD currency. */ price?: OrderPrice | null | undefined; /** * The type of this price, which must be PRICE_PER_UNIT for equity orders, or PERCENTAGE_OF_PAR for fixed income orders. */ type?: OrderLimitPriceTypeOpen | undefined; }; /** * The maximum number of shares to be sold for a notional SELL order of an Equity asset type. This field restricts the quantity to sell, even if the notional amount requires more shares to fulfill. REQUIRED if your account is not subject to Apex position checks, and PROHIBITED if your account is subject to Apex position checks. Refer to Position Check for details. When specified, must be greater than 0 and can't exceed 5 decimal places. */ export type MaxSellQuantity = { /** * 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; }; /** * Notional quantity of the order, measured in USD. Maximum 2 decimal place precision. For Equities: This represents the maximum amount to be spent. The final order may may have a smaller notional amount. For Mutual Funds: Only supported for BUY orders. The order will be transacted at the full notional amount specified. For Fixed Income: Not supported, you must specify a `quantity` value. For Event Contracts: Not supported, you must specify a `quantity` value. */ export type NotionalValue = { /** * 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 date on which the order will go to the market: must either be "today" or the next valid trading day. If the current day is not a valid trading day, then the next valid market day must be specified. If the current time is after market close, and before midnight Eastern, then the next valid market day must be specified. In all other cases, the current day, Eastern must be specified. */ export type OrderDate = { /** * 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; }; /** * When an order has the REJECTED status, this will be populated with a system code describing the rejection. */ export enum OrderRejectedReason { OrderRejectReasonUnspecified = "ORDER_REJECT_REASON_UNSPECIFIED", BrokerOption = "BROKER_OPTION", UnknownSecurity = "UNKNOWN_SECURITY", ExchangeClosed = "EXCHANGE_CLOSED", OrderExceedsLimit = "ORDER_EXCEEDS_LIMIT", TooLateToEnter = "TOO_LATE_TO_ENTER", UnknownOrder = "UNKNOWN_ORDER", DuplicateOrder = "DUPLICATE_ORDER", StaleOrder = "STALE_ORDER", BelowNotionalMinimum = "BELOW_NOTIONAL_MINIMUM", OrderDateUnavailable = "ORDER_DATE_UNAVAILABLE", AggressiveLimitPrice = "AGGRESSIVE_LIMIT_PRICE", AccountNotEntitled = "ACCOUNT_NOT_ENTITLED", SystemError = "SYSTEM_ERROR", BlockingCorporateAction = "BLOCKING_CORPORATE_ACTION", UnavailablePriceQuote = "UNAVAILABLE_PRICE_QUOTE", ExecutionMisconfiguredClient = "EXECUTION_MISCONFIGURED_CLIENT", NotionalQuantityNotAllowedForSecurity = "NOTIONAL_QUANTITY_NOT_ALLOWED_FOR_SECURITY", FractionalQuantityNotAllowedForSecurity = "FRACTIONAL_QUANTITY_NOT_ALLOWED_FOR_SECURITY", OnlyFractionalSellOrWholeOrdersAllowedForSecurity = "ONLY_FRACTIONAL_SELL_OR_WHOLE_ORDERS_ALLOWED_FOR_SECURITY", SymbolNotTradeable = "SYMBOL_NOT_TRADEABLE", AboveNotionalMaximum = "ABOVE_NOTIONAL_MAXIMUM", AboveShareMaximum = "ABOVE_SHARE_MAXIMUM", FailedBuyingPower = "FAILED_BUYING_POWER", InsufficientPosition = "INSUFFICIENT_POSITION", MaxSellQuantityRequired = "MAX_SELL_QUANTITY_REQUIRED", MaxSellQuantityProhibited = "MAX_SELL_QUANTITY_PROHIBITED", StopPriceExceedsMarketPrice = "STOP_PRICE_EXCEEDS_MARKET_PRICE", TradesDisabledForAssetType = "TRADES_DISABLED_FOR_ASSET_TYPE", CommissionNotAllowedForNonBrokerDealer = "COMMISSION_NOT_ALLOWED_FOR_NON_BROKER_DEALER", AssetNotSetUpToTrade = "ASSET_NOT_SET_UP_TO_TRADE", InvalidOrderQuantity = "INVALID_ORDER_QUANTITY", ClientReceivedTimeRequired = "CLIENT_RECEIVED_TIME_REQUIRED", ClientNotPermittedToUseTradingSession = "CLIENT_NOT_PERMITTED_TO_USE_TRADING_SESSION", RoundUpAmountTooSmall = "ROUND_UP_AMOUNT_TOO_SMALL", AssetNotSetUpForRoundUps = "ASSET_NOT_SET_UP_FOR_ROUND_UPS", BelowRoundUpMinimum = "BELOW_ROUND_UP_MINIMUM", StopPriceBelowMarketPrice = "STOP_PRICE_BELOW_MARKET_PRICE", } /** * When an order has the REJECTED status, this will be populated with a system code describing the rejection. */ export type OrderRejectedReasonOpen = OpenEnum; /** * The processing status of the order */ export enum OrderStatus { OrderStatusUnspecified = "ORDER_STATUS_UNSPECIFIED", PendingNew = "PENDING_NEW", New = "NEW", PendingQueued = "PENDING_QUEUED", Queued = "QUEUED", PartiallyFilled = "PARTIALLY_FILLED", Filled = "FILLED", PendingCancel = "PENDING_CANCEL", Canceled = "CANCELED", Rejected = "REJECTED", } /** * The processing status of the order */ export type OrderStatusOpen = OpenEnum; /** * The execution type of this order. For Equities: MARKET, LIMIT, STOP and MARKET_IF_TOUCHED are supported. For Mutual Funds: only MARKET is supported. For Fixed Income: only LIMIT is supported. For Event Contracts: only MARKET and LIMIT are supported. */ export enum OrderOrderType { Limit = "LIMIT", Market = "MARKET", Stop = "STOP", MarketIfTouched = "MARKET_IF_TOUCHED", } /** * The execution type of this order. For Equities: MARKET, LIMIT, STOP and MARKET_IF_TOUCHED are supported. For Mutual Funds: only MARKET is supported. For Fixed Income: only LIMIT is supported. For Event Contracts: only MARKET and LIMIT are supported. */ export type OrderOrderTypeOpen = OpenEnum; /** * The prevailing market price, calculated as a weighted average of the fills in this order, up to a maximum of 5 decimal places. Can be up to 8 decimal places when asset_type = FIXED_INCOME. Will be absent if an order has no executions. */ export type OrderPrevailingMarketPrice = { /** * 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; }; /** * Numeric quantity of the order. For Equities: Represents the number of shares, must be greater than zero and may not exceed 5 decimal places. For Mutual Funds: Only supported for SELL orders. Represents the number of shares, up to a maximum of 3 decimal places. For Fixed Income: Represents the par (face-value) amount being ordered, and may not exceed two decimal places for USD-based currencies. For Event Contracts: Represents the number of contracts being ordered, and must be whole numbers for BUY orders or up to a maximum of 2 decimal places for SELL orders. Either a quantity or notional_value MUST be specified (but not both). */ export type OrderQuantity = { /** * 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 amount of the ROA. This is a monetary value in the same currency as the order. Only 9999999.99 is supported. */ export type OrderRightsOfAccumulationAmount = { /** * 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; }; /** * Rights of Accumulation (ROA). An ROA allows an investor to aggregate their own fund shares with the holdings of certain related parties toward achieving the investment thresholds at which sales charge discounts become available. */ export type RightsOfAccumulation = { /** * The amount of the ROA. This is a monetary value in the same currency as the order. Only 9999999.99 is supported. */ amount?: OrderRightsOfAccumulationAmount | null | undefined; }; /** * The side of this order. */ export enum OrderSide { SideUnspecified = "SIDE_UNSPECIFIED", Buy = "BUY", Sell = "SELL", } /** * The side of this order. */ export type OrderSideOpen = OpenEnum; export enum OrderSpecialReportingInstructions { SpecialReportingInstructionsUnspecified = "SPECIAL_REPORTING_INSTRUCTIONS_UNSPECIFIED", CustomerDirected = "CUSTOMER_DIRECTED", WithDividend = "WITH_DIVIDEND", WithRights = "WITH_RIGHTS", DiscretionExercised = "DISCRETION_EXERCISED", DiscretionNotExercised = "DISCRETION_NOT_EXERCISED", BrokerDealerOrder = "BROKER_DEALER_ORDER", FullyRegistered = "FULLY_REGISTERED", 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", InternetOrder = "INTERNET_ORDER", MarginSellout = "MARGIN_SELLOUT", NegativeNetProceed = "NEGATIVE_NET_PROCEED", RisklessPrincipal = "RISKLESS_PRINCIPAL", ThirdMarket = "THIRD_MARKET", SuppressTraceReporting = "SUPPRESS_TRACE_REPORTING", WhenDistributed = "WHEN_DISTRIBUTED", RoundUp = "ROUND_UP", CatParentAlgo = "CAT_PARENT_ALGO", CatParentGtc = "CAT_PARENT_GTC", } export type OrderSpecialReportingInstructionsOpen = OpenEnum< typeof OrderSpecialReportingInstructions >; /** * The stop price which must be greater than zero if provided. For equity orders in the USD currency, up to 2 decimal places are allowed for prices above $1 and up to 4 decimal places for prices at or below $1. */ export type OrderStopPricePrice = { /** * 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 this price, which must PRICE_PER_UNIT for equity orders. (Fixed income and mutual fund assets do not support stop orders.) */ export enum OrderStopPriceType { StopPriceTypeUnspecified = "STOP_PRICE_TYPE_UNSPECIFIED", PricePerUnit = "PRICE_PER_UNIT", } /** * The type of this price, which must PRICE_PER_UNIT for equity orders. (Fixed income and mutual fund assets do not support stop orders.) */ export type OrderStopPriceTypeOpen = OpenEnum; /** * The stop price for this order. Only allowed for equities. */ export type StopPrice = { /** * The stop price which must be greater than zero if provided. For equity orders in the USD currency, up to 2 decimal places are allowed for prices above $1 and up to 4 decimal places for prices at or below $1. */ price?: OrderStopPricePrice | null | undefined; /** * The type of this price, which must PRICE_PER_UNIT for equity orders. (Fixed income and mutual fund assets do not support stop orders.) */ type?: OrderStopPriceTypeOpen | undefined; }; /** * For Equities: Either "DAY" or "GOOD_TILL_DATE" are allowed. For Mutual Funds: Only "DAY" is allowed. For Fixed Income: Only "DAY" is allowed. For Event Contracts: Either "DAY", "GOOD_TILL_DATE", "GOOD_TILL_CANCELED", "IMMEDIATE_OR_CANCEL", or "FILL_OR_KILL" are allowed. */ export enum OrderTimeInForce { Day = "DAY", GoodTillDate = "GOOD_TILL_DATE", GoodTillCanceled = "GOOD_TILL_CANCELED", ImmediateOrCancel = "IMMEDIATE_OR_CANCEL", FillOrKill = "FILL_OR_KILL", } /** * For Equities: Either "DAY" or "GOOD_TILL_DATE" are allowed. For Mutual Funds: Only "DAY" is allowed. For Fixed Income: Only "DAY" is allowed. For Event Contracts: Either "DAY", "GOOD_TILL_DATE", "GOOD_TILL_CANCELED", "IMMEDIATE_OR_CANCEL", or "FILL_OR_KILL" are allowed. */ export type OrderTimeInForceOpen = OpenEnum; /** * The date till which a GOOD_TILL_DATE order will remain valid. If the order is a STOP/MIT order with TimeInForce as GOOD_TILL_DATE, then this must be populated. */ export type TimeInForceExpirationDate = { /** * 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; }; /** * Which TradingSession to trade in, defaults to 'CORE'. Only available for Equity orders. */ export enum OrderTradingSession { TradingSessionUnspecified = "TRADING_SESSION_UNSPECIFIED", Core = "CORE", Pre = "PRE", Post = "POST", Overnight = "OVERNIGHT", Apex24 = "APEX24", Gtx = "GTX", } /** * Which TradingSession to trade in, defaults to 'CORE'. Only available for Equity orders. */ export type OrderTradingSessionOpen = OpenEnum; /** * The message describing an order */ export type Order = { /** * The identifier of the account transacting this order */ accountId?: string | undefined; /** * Apex Asset ID for this asset. When the identifier_type is not ASSET_ID, this field will not be returned in the initial CreateOrder response and will be available after an order completes validation. If the provided identifier does not match any Apex asset available for trading, an OrderRejectReason of "UNKNOWN_SECURITY" will be returned and the asset_id will not be set. */ assetId?: string | undefined; /** * The type of the asset in this order, which must be one of the following: * * @remarks * EQUITY, MUTUAL_FUND, and FIXED_INCOME. */ assetType?: OrderAssetTypeOpen | undefined; /** * The average prices, as weighted averages, across all executions in this order. Will be absent if an order has no executions. * * @remarks * * When asset_type = EQUITY or MUTUAL_FUND, there will be at most one value present, with a type of PRICE_PER_UNIT. This will have up to 4 decimal places for USD amounts less than $1, and a maximum of two for larger USD amounts. * * When asset_type = FIXED_INCOME, there may be more than one value present which would have a type other than PRICE_PER_UNIT. Price values in PERCENTAGE_OF_PAR will have up to 8 decimal places of precision, and price values measured in yields will support up to 7 decimal places. */ averagePrices?: Array | undefined; /** * Defaults to "AGENCY" if not specified, except for Fixed Income orders from RIA correspondents which default to "PRINCIPAL" when not specified. For Equities: Only "AGENCY" is allowed. For Mutual Funds: Only "AGENCY" is allowed. For Fixed Income: Either "AGENCY" or "PRINCIPAL" are allowed. - RIA correspondents: Defaults to "PRINCIPAL" if not specified. - Other correspondents: Defaults to "AGENCY" if not specified. For Event Contracts: Only "AGENCY" is allowed. */ brokerCapacity?: OrderBrokerCapacityOpen | undefined; /** * Output only field that is required for Equity Orders for any client who is having Apex do CAT reporting on their behalf. This field denotes the initiator of the cancel request. This field will be present when provided on the CancelOrderRequest */ cancelInitiator?: CancelInitiatorOpen | undefined; /** * Used to explain why an order is canceled */ cancelReason?: string | undefined; /** * Used to denote when a cancel request has been rejected. */ cancelRejectedReason?: CancelRejectedReasonOpen | undefined; /** * Output only field for Equity Orders related to CAT reporting on behalf of clients. This field will be present when provided on the CancelOrderRequest */ clientCancelReceivedTime?: Date | null | undefined; /** * Output only field for Equity Orders related to CAT reporting on behalf of clients. This field will be present when provided on the CancelOrderRequest */ clientCancelSentTime?: Date | null | undefined; /** * User-supplied unique order ID. Cannot be more than 40 characters long. */ clientOrderId?: string | undefined; /** * Required for Equity Orders for any client who is having Apex do CAT reporting on their behalf. A value may be provided for non-Equity orders, and will be remembered, but valid timestamps will have no impact on how they are processed. */ clientReceivedTime?: Date | null | undefined; /** * Only relevant for CAT reporting when clients have Apex do CAT reporting on their behalf. Denotes the time the client sent the order to Apex. A value may be provided for non-Equity orders, and will be remembered, but valid timestamps will have no impact on how they are processed. */ clientSentTime?: Date | null | undefined; /** * A custom commission to be applied to this order. When specifying an AMOUNT type, the value represents a notional amount measured in the currency of the order. Only available for Equity, Mutual Fund, and Fixed Income orders. */ commission?: OrderCommission | null | undefined; /** * Time of the order creation */ createTime?: Date | null | undefined; /** * The sum of order quantity & price, across all fills, reported in the currency specified in the order. (This will be rounded to 2 decimal places for USD currencies). Will be absent if an order has no fill information. */ cumulativeNotionalValue?: CumulativeNotionalValue | null | undefined; /** * Defaults to "USD". Only "USD" is supported. Full list of currency codes is defined at: https://en.wikipedia.org/wiki/ISO_4217 */ currencyCode?: string | undefined; /** * The execution-level details that compose this order */ executions?: Array | undefined; /** * Any reporting data provided by the SetExtraReportingData endpoint. */ extraReportingData?: ExtraReportingData | null | undefined; /** * Fees that will be applied to this order. Only the BROKER_FEE type is supported. */ fees?: Array | undefined; /** * The summed quantity value across all fills in this order, up to a maximum of 5 decimal places. Will be absent if an order has no fill information. */ filledQuantity?: FilledQuantity | null | undefined; /** * Identifier of the asset (of the type specified in `identifier_type`). */ identifier?: string | undefined; /** * A string attribute denoting the country of issuance or where the asset is trading. * Only available for Mutual Fund and Fixed Income orders. * Only available when the identifier_type is SYMBOL or CUSIP. * Defaults to US when the identifier_type is SYMBOL or CUSIP. * Complies with ISO-3166 Alpha-2 Codes */ identifierIssuingRegionCode?: string | undefined; /** * The identifier type of the asset being ordered. For Equities: only SYMBOL is supported For Mutual Funds: only SYMBOL and CUSIP are supported For Fixed Income: only CUSIP and ISIN are supported For Event Contracts: only SYMBOL and ASSET_ID are supported */ identifierType?: OrderIdentifierTypeOpen | undefined; /** * Time of the last order update */ lastUpdateTime?: Date | null | undefined; /** * Letter of Intent (LOI). An LOI allows investors to receive sales charge discounts based on a commitment to buy a specified monetary amount of shares over a period of time, usually 13 months. */ letterOfIntent?: LetterOfIntent | null | undefined; /** * The limit price for this order. */ limitPrice?: LimitPrice | null | undefined; /** * The maximum number of shares to be sold for a notional SELL order of an Equity asset type. This field restricts the quantity to sell, even if the notional amount requires more shares to fulfill. REQUIRED if your account is not subject to Apex position checks, and PROHIBITED if your account is subject to Apex position checks. Refer to Position Check for details. When specified, must be greater than 0 and can't exceed 5 decimal places. */ maxSellQuantity?: MaxSellQuantity | null | undefined; /** * System generated name of the order. */ name?: string | undefined; /** * Notional quantity of the order, measured in USD. Maximum 2 decimal place precision. For Equities: This represents the maximum amount to be spent. The final order may may have a smaller notional amount. For Mutual Funds: Only supported for BUY orders. The order will be transacted at the full notional amount specified. For Fixed Income: Not supported, you must specify a `quantity` value. For Event Contracts: Not supported, you must specify a `quantity` value. */ notionalValue?: NotionalValue | null | undefined; /** * A value derived from the order_status, indicating whether the order is still open. The statuses that indicate an order is open are: PENDING_NEW, NEW, PENDING_QUEUED, QUEUED, PARTIALLY_FILLED, and PENDING_CANCEL. An order with any other status is not considered open. */ open?: boolean | undefined; /** * The date on which the order will go to the market: must either be "today" or the next valid trading day. If the current day is not a valid trading day, then the next valid market day must be specified. If the current time is after market close, and before midnight Eastern, then the next valid market day must be specified. In all other cases, the current day, Eastern must be specified. */ orderDate?: OrderDate | null | undefined; /** * System generated unique id for the order. */ orderId?: string | undefined; /** * When an order has the REJECTED status, this will be populated with a system code describing the rejection. */ orderRejectedReason?: OrderRejectedReasonOpen | undefined; /** * The processing status of the order */ orderStatus?: OrderStatusOpen | undefined; /** * The execution type of this order. For Equities: MARKET, LIMIT, STOP and MARKET_IF_TOUCHED are supported. For Mutual Funds: only MARKET is supported. For Fixed Income: only LIMIT is supported. For Event Contracts: only MARKET and LIMIT are supported. */ orderType?: OrderOrderTypeOpen | undefined; /** * The prevailing market price, calculated as a weighted average of the fills in this order, up to a maximum of 5 decimal places. Can be up to 8 decimal places when asset_type = FIXED_INCOME. Will be absent if an order has no executions. */ prevailingMarketPrice?: OrderPrevailingMarketPrice | null | undefined; /** * Numeric quantity of the order. For Equities: Represents the number of shares, must be greater than zero and may not exceed 5 decimal places. For Mutual Funds: Only supported for SELL orders. Represents the number of shares, up to a maximum of 3 decimal places. For Fixed Income: Represents the par (face-value) amount being ordered, and may not exceed two decimal places for USD-based currencies. For Event Contracts: Represents the number of contracts being ordered, and must be whole numbers for BUY orders or up to a maximum of 2 decimal places for SELL orders. Either a quantity or notional_value MUST be specified (but not both). */ quantity?: OrderQuantity | null | undefined; /** * Rights of Accumulation (ROA). An ROA allows an investor to aggregate their own fund shares with the holdings of certain related parties toward achieving the investment thresholds at which sales charge discounts become available. */ rightsOfAccumulation?: RightsOfAccumulation | null | undefined; /** * The side of this order. */ side?: OrderSideOpen | undefined; /** * Special Reporting Instructions to be applied to this order. Can include multiple Instructions. Only available for Equity, Mutual Fund, and Fixed Income orders. */ specialReportingInstructions?: | Array | undefined; /** * The stop price for this order. Only allowed for equities. */ stopPrice?: StopPrice | null | undefined; /** * For Equities: Either "DAY" or "GOOD_TILL_DATE" are allowed. For Mutual Funds: Only "DAY" is allowed. For Fixed Income: Only "DAY" is allowed. For Event Contracts: Either "DAY", "GOOD_TILL_DATE", "GOOD_TILL_CANCELED", "IMMEDIATE_OR_CANCEL", or "FILL_OR_KILL" are allowed. */ timeInForce?: OrderTimeInForceOpen | undefined; /** * The date till which a GOOD_TILL_DATE order will remain valid. If the order is a STOP/MIT order with TimeInForce as GOOD_TILL_DATE, then this must be populated. */ timeInForceExpirationDate?: TimeInForceExpirationDate | null | undefined; /** * Which TradingSession to trade in, defaults to 'CORE'. Only available for Equity orders. */ tradingSession?: OrderTradingSessionOpen | undefined; }; /** @internal */ export const OrderAssetType$inboundSchema: z.ZodType< OrderAssetTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderAssetType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderAssetType$outboundSchema: z.ZodType< OrderAssetTypeOpen, z.ZodTypeDef, OrderAssetTypeOpen > = z.union([ z.nativeEnum(OrderAssetType), 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 OrderAssetType$ { /** @deprecated use `OrderAssetType$inboundSchema` instead. */ export const inboundSchema = OrderAssetType$inboundSchema; /** @deprecated use `OrderAssetType$outboundSchema` instead. */ export const outboundSchema = OrderAssetType$outboundSchema; } /** @internal */ export const OrderBrokerCapacity$inboundSchema: z.ZodType< OrderBrokerCapacityOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderBrokerCapacity), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderBrokerCapacity$outboundSchema: z.ZodType< OrderBrokerCapacityOpen, z.ZodTypeDef, OrderBrokerCapacityOpen > = z.union([ z.nativeEnum(OrderBrokerCapacity), 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 OrderBrokerCapacity$ { /** @deprecated use `OrderBrokerCapacity$inboundSchema` instead. */ export const inboundSchema = OrderBrokerCapacity$inboundSchema; /** @deprecated use `OrderBrokerCapacity$outboundSchema` instead. */ export const outboundSchema = OrderBrokerCapacity$outboundSchema; } /** @internal */ export const CancelInitiator$inboundSchema: z.ZodType< CancelInitiatorOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(CancelInitiator), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const CancelInitiator$outboundSchema: z.ZodType< CancelInitiatorOpen, z.ZodTypeDef, CancelInitiatorOpen > = z.union([ z.nativeEnum(CancelInitiator), 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 CancelInitiator$ { /** @deprecated use `CancelInitiator$inboundSchema` instead. */ export const inboundSchema = CancelInitiator$inboundSchema; /** @deprecated use `CancelInitiator$outboundSchema` instead. */ export const outboundSchema = CancelInitiator$outboundSchema; } /** @internal */ export const CancelRejectedReason$inboundSchema: z.ZodType< CancelRejectedReasonOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(CancelRejectedReason), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const CancelRejectedReason$outboundSchema: z.ZodType< CancelRejectedReasonOpen, z.ZodTypeDef, CancelRejectedReasonOpen > = z.union([ z.nativeEnum(CancelRejectedReason), 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 CancelRejectedReason$ { /** @deprecated use `CancelRejectedReason$inboundSchema` instead. */ export const inboundSchema = CancelRejectedReason$inboundSchema; /** @deprecated use `CancelRejectedReason$outboundSchema` instead. */ export const outboundSchema = CancelRejectedReason$outboundSchema; } /** @internal */ export const OrderCommissionType$inboundSchema: z.ZodType< OrderCommissionTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderCommissionType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderCommissionType$outboundSchema: z.ZodType< OrderCommissionTypeOpen, z.ZodTypeDef, OrderCommissionTypeOpen > = z.union([ z.nativeEnum(OrderCommissionType), 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 OrderCommissionType$ { /** @deprecated use `OrderCommissionType$inboundSchema` instead. */ export const inboundSchema = OrderCommissionType$inboundSchema; /** @deprecated use `OrderCommissionType$outboundSchema` instead. */ export const outboundSchema = OrderCommissionType$outboundSchema; } /** @internal */ export const Value$inboundSchema: z.ZodType = z .object({ value: z.string().optional(), }); /** @internal */ export type Value$Outbound = { value?: string | undefined; }; /** @internal */ export const Value$outboundSchema: z.ZodType< Value$Outbound, z.ZodTypeDef, Value > = 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 Value$ { /** @deprecated use `Value$inboundSchema` instead. */ export const inboundSchema = Value$inboundSchema; /** @deprecated use `Value$outboundSchema` instead. */ export const outboundSchema = Value$outboundSchema; /** @deprecated use `Value$Outbound` instead. */ export type Outbound = Value$Outbound; } export function valueToJSON(value: Value): string { return JSON.stringify(Value$outboundSchema.parse(value)); } export function valueFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Value$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Value' from JSON`, ); } /** @internal */ export const OrderCommission$inboundSchema: z.ZodType< OrderCommission, z.ZodTypeDef, unknown > = z.object({ type: OrderCommissionType$inboundSchema.optional(), value: z.nullable(z.lazy(() => Value$inboundSchema)).optional(), }); /** @internal */ export type OrderCommission$Outbound = { type?: string | undefined; value?: Value$Outbound | null | undefined; }; /** @internal */ export const OrderCommission$outboundSchema: z.ZodType< OrderCommission$Outbound, z.ZodTypeDef, OrderCommission > = z.object({ type: OrderCommissionType$outboundSchema.optional(), value: z.nullable(z.lazy(() => Value$outboundSchema)).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace OrderCommission$ { /** @deprecated use `OrderCommission$inboundSchema` instead. */ export const inboundSchema = OrderCommission$inboundSchema; /** @deprecated use `OrderCommission$outboundSchema` instead. */ export const outboundSchema = OrderCommission$outboundSchema; /** @deprecated use `OrderCommission$Outbound` instead. */ export type Outbound = OrderCommission$Outbound; } export function orderCommissionToJSON( orderCommission: OrderCommission, ): string { return JSON.stringify(OrderCommission$outboundSchema.parse(orderCommission)); } export function orderCommissionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderCommission$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderCommission' from JSON`, ); } /** @internal */ export const CumulativeNotionalValue$inboundSchema: z.ZodType< CumulativeNotionalValue, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type CumulativeNotionalValue$Outbound = { value?: string | undefined; }; /** @internal */ export const CumulativeNotionalValue$outboundSchema: z.ZodType< CumulativeNotionalValue$Outbound, z.ZodTypeDef, CumulativeNotionalValue > = 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 CumulativeNotionalValue$ { /** @deprecated use `CumulativeNotionalValue$inboundSchema` instead. */ export const inboundSchema = CumulativeNotionalValue$inboundSchema; /** @deprecated use `CumulativeNotionalValue$outboundSchema` instead. */ export const outboundSchema = CumulativeNotionalValue$outboundSchema; /** @deprecated use `CumulativeNotionalValue$Outbound` instead. */ export type Outbound = CumulativeNotionalValue$Outbound; } export function cumulativeNotionalValueToJSON( cumulativeNotionalValue: CumulativeNotionalValue, ): string { return JSON.stringify( CumulativeNotionalValue$outboundSchema.parse(cumulativeNotionalValue), ); } export function cumulativeNotionalValueFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CumulativeNotionalValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CumulativeNotionalValue' from JSON`, ); } /** @internal */ export const ExtraReportingData$inboundSchema: z.ZodType< ExtraReportingData, z.ZodTypeDef, unknown > = z.object({ cancel_confirmed_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), }).transform((v) => { return remap$(v, { "cancel_confirmed_time": "cancelConfirmedTime", }); }); /** @internal */ export type ExtraReportingData$Outbound = { cancel_confirmed_time?: string | null | undefined; }; /** @internal */ export const ExtraReportingData$outboundSchema: z.ZodType< ExtraReportingData$Outbound, z.ZodTypeDef, ExtraReportingData > = z.object({ cancelConfirmedTime: z.nullable(z.date().transform(v => v.toISOString())) .optional(), }).transform((v) => { return remap$(v, { cancelConfirmedTime: "cancel_confirmed_time", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ExtraReportingData$ { /** @deprecated use `ExtraReportingData$inboundSchema` instead. */ export const inboundSchema = ExtraReportingData$inboundSchema; /** @deprecated use `ExtraReportingData$outboundSchema` instead. */ export const outboundSchema = ExtraReportingData$outboundSchema; /** @deprecated use `ExtraReportingData$Outbound` instead. */ export type Outbound = ExtraReportingData$Outbound; } export function extraReportingDataToJSON( extraReportingData: ExtraReportingData, ): string { return JSON.stringify( ExtraReportingData$outboundSchema.parse(extraReportingData), ); } export function extraReportingDataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ExtraReportingData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExtraReportingData' from JSON`, ); } /** @internal */ export const FilledQuantity$inboundSchema: z.ZodType< FilledQuantity, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type FilledQuantity$Outbound = { value?: string | undefined; }; /** @internal */ export const FilledQuantity$outboundSchema: z.ZodType< FilledQuantity$Outbound, z.ZodTypeDef, FilledQuantity > = 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 FilledQuantity$ { /** @deprecated use `FilledQuantity$inboundSchema` instead. */ export const inboundSchema = FilledQuantity$inboundSchema; /** @deprecated use `FilledQuantity$outboundSchema` instead. */ export const outboundSchema = FilledQuantity$outboundSchema; /** @deprecated use `FilledQuantity$Outbound` instead. */ export type Outbound = FilledQuantity$Outbound; } export function filledQuantityToJSON(filledQuantity: FilledQuantity): string { return JSON.stringify(FilledQuantity$outboundSchema.parse(filledQuantity)); } export function filledQuantityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FilledQuantity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FilledQuantity' from JSON`, ); } /** @internal */ export const OrderIdentifierType$inboundSchema: z.ZodType< OrderIdentifierTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderIdentifierType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderIdentifierType$outboundSchema: z.ZodType< OrderIdentifierTypeOpen, z.ZodTypeDef, OrderIdentifierTypeOpen > = z.union([ z.nativeEnum(OrderIdentifierType), 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 OrderIdentifierType$ { /** @deprecated use `OrderIdentifierType$inboundSchema` instead. */ export const inboundSchema = OrderIdentifierType$inboundSchema; /** @deprecated use `OrderIdentifierType$outboundSchema` instead. */ export const outboundSchema = OrderIdentifierType$outboundSchema; } /** @internal */ export const OrderAmount$inboundSchema: z.ZodType< OrderAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type OrderAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const OrderAmount$outboundSchema: z.ZodType< OrderAmount$Outbound, z.ZodTypeDef, OrderAmount > = 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 OrderAmount$ { /** @deprecated use `OrderAmount$inboundSchema` instead. */ export const inboundSchema = OrderAmount$inboundSchema; /** @deprecated use `OrderAmount$outboundSchema` instead. */ export const outboundSchema = OrderAmount$outboundSchema; /** @deprecated use `OrderAmount$Outbound` instead. */ export type Outbound = OrderAmount$Outbound; } export function orderAmountToJSON(orderAmount: OrderAmount): string { return JSON.stringify(OrderAmount$outboundSchema.parse(orderAmount)); } export function orderAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderAmount' from JSON`, ); } /** @internal */ export const PeriodStartDate$inboundSchema: z.ZodType< PeriodStartDate, z.ZodTypeDef, unknown > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** @internal */ export type PeriodStartDate$Outbound = { day?: number | undefined; month?: number | undefined; year?: number | undefined; }; /** @internal */ export const PeriodStartDate$outboundSchema: z.ZodType< PeriodStartDate$Outbound, z.ZodTypeDef, PeriodStartDate > = 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 PeriodStartDate$ { /** @deprecated use `PeriodStartDate$inboundSchema` instead. */ export const inboundSchema = PeriodStartDate$inboundSchema; /** @deprecated use `PeriodStartDate$outboundSchema` instead. */ export const outboundSchema = PeriodStartDate$outboundSchema; /** @deprecated use `PeriodStartDate$Outbound` instead. */ export type Outbound = PeriodStartDate$Outbound; } export function periodStartDateToJSON( periodStartDate: PeriodStartDate, ): string { return JSON.stringify(PeriodStartDate$outboundSchema.parse(periodStartDate)); } export function periodStartDateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PeriodStartDate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PeriodStartDate' from JSON`, ); } /** @internal */ export const LetterOfIntent$inboundSchema: z.ZodType< LetterOfIntent, z.ZodTypeDef, unknown > = z.object({ amount: z.nullable(z.lazy(() => OrderAmount$inboundSchema)).optional(), period_start_date: z.nullable(z.lazy(() => PeriodStartDate$inboundSchema)) .optional(), }).transform((v) => { return remap$(v, { "period_start_date": "periodStartDate", }); }); /** @internal */ export type LetterOfIntent$Outbound = { amount?: OrderAmount$Outbound | null | undefined; period_start_date?: PeriodStartDate$Outbound | null | undefined; }; /** @internal */ export const LetterOfIntent$outboundSchema: z.ZodType< LetterOfIntent$Outbound, z.ZodTypeDef, LetterOfIntent > = z.object({ amount: z.nullable(z.lazy(() => OrderAmount$outboundSchema)).optional(), periodStartDate: z.nullable(z.lazy(() => PeriodStartDate$outboundSchema)) .optional(), }).transform((v) => { return remap$(v, { periodStartDate: "period_start_date", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LetterOfIntent$ { /** @deprecated use `LetterOfIntent$inboundSchema` instead. */ export const inboundSchema = LetterOfIntent$inboundSchema; /** @deprecated use `LetterOfIntent$outboundSchema` instead. */ export const outboundSchema = LetterOfIntent$outboundSchema; /** @deprecated use `LetterOfIntent$Outbound` instead. */ export type Outbound = LetterOfIntent$Outbound; } export function letterOfIntentToJSON(letterOfIntent: LetterOfIntent): string { return JSON.stringify(LetterOfIntent$outboundSchema.parse(letterOfIntent)); } export function letterOfIntentFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LetterOfIntent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LetterOfIntent' from JSON`, ); } /** @internal */ export const OrderPrice$inboundSchema: z.ZodType< OrderPrice, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type OrderPrice$Outbound = { value?: string | undefined; }; /** @internal */ export const OrderPrice$outboundSchema: z.ZodType< OrderPrice$Outbound, z.ZodTypeDef, OrderPrice > = 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 OrderPrice$ { /** @deprecated use `OrderPrice$inboundSchema` instead. */ export const inboundSchema = OrderPrice$inboundSchema; /** @deprecated use `OrderPrice$outboundSchema` instead. */ export const outboundSchema = OrderPrice$outboundSchema; /** @deprecated use `OrderPrice$Outbound` instead. */ export type Outbound = OrderPrice$Outbound; } export function orderPriceToJSON(orderPrice: OrderPrice): string { return JSON.stringify(OrderPrice$outboundSchema.parse(orderPrice)); } export function orderPriceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderPrice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderPrice' from JSON`, ); } /** @internal */ export const OrderLimitPriceType$inboundSchema: z.ZodType< OrderLimitPriceTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderLimitPriceType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderLimitPriceType$outboundSchema: z.ZodType< OrderLimitPriceTypeOpen, z.ZodTypeDef, OrderLimitPriceTypeOpen > = z.union([ z.nativeEnum(OrderLimitPriceType), 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 OrderLimitPriceType$ { /** @deprecated use `OrderLimitPriceType$inboundSchema` instead. */ export const inboundSchema = OrderLimitPriceType$inboundSchema; /** @deprecated use `OrderLimitPriceType$outboundSchema` instead. */ export const outboundSchema = OrderLimitPriceType$outboundSchema; } /** @internal */ export const LimitPrice$inboundSchema: z.ZodType< LimitPrice, z.ZodTypeDef, unknown > = z.object({ price: z.nullable(z.lazy(() => OrderPrice$inboundSchema)).optional(), type: OrderLimitPriceType$inboundSchema.optional(), }); /** @internal */ export type LimitPrice$Outbound = { price?: OrderPrice$Outbound | null | undefined; type?: string | undefined; }; /** @internal */ export const LimitPrice$outboundSchema: z.ZodType< LimitPrice$Outbound, z.ZodTypeDef, LimitPrice > = z.object({ price: z.nullable(z.lazy(() => OrderPrice$outboundSchema)).optional(), type: OrderLimitPriceType$outboundSchema.optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace LimitPrice$ { /** @deprecated use `LimitPrice$inboundSchema` instead. */ export const inboundSchema = LimitPrice$inboundSchema; /** @deprecated use `LimitPrice$outboundSchema` instead. */ export const outboundSchema = LimitPrice$outboundSchema; /** @deprecated use `LimitPrice$Outbound` instead. */ export type Outbound = LimitPrice$Outbound; } export function limitPriceToJSON(limitPrice: LimitPrice): string { return JSON.stringify(LimitPrice$outboundSchema.parse(limitPrice)); } export function limitPriceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => LimitPrice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LimitPrice' from JSON`, ); } /** @internal */ export const MaxSellQuantity$inboundSchema: z.ZodType< MaxSellQuantity, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type MaxSellQuantity$Outbound = { value?: string | undefined; }; /** @internal */ export const MaxSellQuantity$outboundSchema: z.ZodType< MaxSellQuantity$Outbound, z.ZodTypeDef, MaxSellQuantity > = 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 MaxSellQuantity$ { /** @deprecated use `MaxSellQuantity$inboundSchema` instead. */ export const inboundSchema = MaxSellQuantity$inboundSchema; /** @deprecated use `MaxSellQuantity$outboundSchema` instead. */ export const outboundSchema = MaxSellQuantity$outboundSchema; /** @deprecated use `MaxSellQuantity$Outbound` instead. */ export type Outbound = MaxSellQuantity$Outbound; } export function maxSellQuantityToJSON( maxSellQuantity: MaxSellQuantity, ): string { return JSON.stringify(MaxSellQuantity$outboundSchema.parse(maxSellQuantity)); } export function maxSellQuantityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => MaxSellQuantity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MaxSellQuantity' from JSON`, ); } /** @internal */ export const NotionalValue$inboundSchema: z.ZodType< NotionalValue, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type NotionalValue$Outbound = { value?: string | undefined; }; /** @internal */ export const NotionalValue$outboundSchema: z.ZodType< NotionalValue$Outbound, z.ZodTypeDef, NotionalValue > = 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 NotionalValue$ { /** @deprecated use `NotionalValue$inboundSchema` instead. */ export const inboundSchema = NotionalValue$inboundSchema; /** @deprecated use `NotionalValue$outboundSchema` instead. */ export const outboundSchema = NotionalValue$outboundSchema; /** @deprecated use `NotionalValue$Outbound` instead. */ export type Outbound = NotionalValue$Outbound; } export function notionalValueToJSON(notionalValue: NotionalValue): string { return JSON.stringify(NotionalValue$outboundSchema.parse(notionalValue)); } export function notionalValueFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => NotionalValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NotionalValue' from JSON`, ); } /** @internal */ export const OrderDate$inboundSchema: z.ZodType< OrderDate, z.ZodTypeDef, unknown > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** @internal */ export type OrderDate$Outbound = { day?: number | undefined; month?: number | undefined; year?: number | undefined; }; /** @internal */ export const OrderDate$outboundSchema: z.ZodType< OrderDate$Outbound, z.ZodTypeDef, OrderDate > = 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 OrderDate$ { /** @deprecated use `OrderDate$inboundSchema` instead. */ export const inboundSchema = OrderDate$inboundSchema; /** @deprecated use `OrderDate$outboundSchema` instead. */ export const outboundSchema = OrderDate$outboundSchema; /** @deprecated use `OrderDate$Outbound` instead. */ export type Outbound = OrderDate$Outbound; } export function orderDateToJSON(orderDate: OrderDate): string { return JSON.stringify(OrderDate$outboundSchema.parse(orderDate)); } export function orderDateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderDate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderDate' from JSON`, ); } /** @internal */ export const OrderRejectedReason$inboundSchema: z.ZodType< OrderRejectedReasonOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderRejectedReason), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderRejectedReason$outboundSchema: z.ZodType< OrderRejectedReasonOpen, z.ZodTypeDef, OrderRejectedReasonOpen > = z.union([ z.nativeEnum(OrderRejectedReason), 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 OrderRejectedReason$ { /** @deprecated use `OrderRejectedReason$inboundSchema` instead. */ export const inboundSchema = OrderRejectedReason$inboundSchema; /** @deprecated use `OrderRejectedReason$outboundSchema` instead. */ export const outboundSchema = OrderRejectedReason$outboundSchema; } /** @internal */ export const OrderStatus$inboundSchema: z.ZodType< OrderStatusOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderStatus), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderStatus$outboundSchema: z.ZodType< OrderStatusOpen, z.ZodTypeDef, OrderStatusOpen > = z.union([ z.nativeEnum(OrderStatus), 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 OrderStatus$ { /** @deprecated use `OrderStatus$inboundSchema` instead. */ export const inboundSchema = OrderStatus$inboundSchema; /** @deprecated use `OrderStatus$outboundSchema` instead. */ export const outboundSchema = OrderStatus$outboundSchema; } /** @internal */ export const OrderOrderType$inboundSchema: z.ZodType< OrderOrderTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderOrderType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderOrderType$outboundSchema: z.ZodType< OrderOrderTypeOpen, z.ZodTypeDef, OrderOrderTypeOpen > = z.union([ z.nativeEnum(OrderOrderType), 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 OrderOrderType$ { /** @deprecated use `OrderOrderType$inboundSchema` instead. */ export const inboundSchema = OrderOrderType$inboundSchema; /** @deprecated use `OrderOrderType$outboundSchema` instead. */ export const outboundSchema = OrderOrderType$outboundSchema; } /** @internal */ export const OrderPrevailingMarketPrice$inboundSchema: z.ZodType< OrderPrevailingMarketPrice, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type OrderPrevailingMarketPrice$Outbound = { value?: string | undefined; }; /** @internal */ export const OrderPrevailingMarketPrice$outboundSchema: z.ZodType< OrderPrevailingMarketPrice$Outbound, z.ZodTypeDef, OrderPrevailingMarketPrice > = 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 OrderPrevailingMarketPrice$ { /** @deprecated use `OrderPrevailingMarketPrice$inboundSchema` instead. */ export const inboundSchema = OrderPrevailingMarketPrice$inboundSchema; /** @deprecated use `OrderPrevailingMarketPrice$outboundSchema` instead. */ export const outboundSchema = OrderPrevailingMarketPrice$outboundSchema; /** @deprecated use `OrderPrevailingMarketPrice$Outbound` instead. */ export type Outbound = OrderPrevailingMarketPrice$Outbound; } export function orderPrevailingMarketPriceToJSON( orderPrevailingMarketPrice: OrderPrevailingMarketPrice, ): string { return JSON.stringify( OrderPrevailingMarketPrice$outboundSchema.parse(orderPrevailingMarketPrice), ); } export function orderPrevailingMarketPriceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderPrevailingMarketPrice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderPrevailingMarketPrice' from JSON`, ); } /** @internal */ export const OrderQuantity$inboundSchema: z.ZodType< OrderQuantity, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type OrderQuantity$Outbound = { value?: string | undefined; }; /** @internal */ export const OrderQuantity$outboundSchema: z.ZodType< OrderQuantity$Outbound, z.ZodTypeDef, OrderQuantity > = 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 OrderQuantity$ { /** @deprecated use `OrderQuantity$inboundSchema` instead. */ export const inboundSchema = OrderQuantity$inboundSchema; /** @deprecated use `OrderQuantity$outboundSchema` instead. */ export const outboundSchema = OrderQuantity$outboundSchema; /** @deprecated use `OrderQuantity$Outbound` instead. */ export type Outbound = OrderQuantity$Outbound; } export function orderQuantityToJSON(orderQuantity: OrderQuantity): string { return JSON.stringify(OrderQuantity$outboundSchema.parse(orderQuantity)); } export function orderQuantityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderQuantity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderQuantity' from JSON`, ); } /** @internal */ export const OrderRightsOfAccumulationAmount$inboundSchema: z.ZodType< OrderRightsOfAccumulationAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type OrderRightsOfAccumulationAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const OrderRightsOfAccumulationAmount$outboundSchema: z.ZodType< OrderRightsOfAccumulationAmount$Outbound, z.ZodTypeDef, OrderRightsOfAccumulationAmount > = 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 OrderRightsOfAccumulationAmount$ { /** @deprecated use `OrderRightsOfAccumulationAmount$inboundSchema` instead. */ export const inboundSchema = OrderRightsOfAccumulationAmount$inboundSchema; /** @deprecated use `OrderRightsOfAccumulationAmount$outboundSchema` instead. */ export const outboundSchema = OrderRightsOfAccumulationAmount$outboundSchema; /** @deprecated use `OrderRightsOfAccumulationAmount$Outbound` instead. */ export type Outbound = OrderRightsOfAccumulationAmount$Outbound; } export function orderRightsOfAccumulationAmountToJSON( orderRightsOfAccumulationAmount: OrderRightsOfAccumulationAmount, ): string { return JSON.stringify( OrderRightsOfAccumulationAmount$outboundSchema.parse( orderRightsOfAccumulationAmount, ), ); } export function orderRightsOfAccumulationAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderRightsOfAccumulationAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderRightsOfAccumulationAmount' from JSON`, ); } /** @internal */ export const RightsOfAccumulation$inboundSchema: z.ZodType< RightsOfAccumulation, z.ZodTypeDef, unknown > = z.object({ amount: z.nullable( z.lazy(() => OrderRightsOfAccumulationAmount$inboundSchema), ).optional(), }); /** @internal */ export type RightsOfAccumulation$Outbound = { amount?: OrderRightsOfAccumulationAmount$Outbound | null | undefined; }; /** @internal */ export const RightsOfAccumulation$outboundSchema: z.ZodType< RightsOfAccumulation$Outbound, z.ZodTypeDef, RightsOfAccumulation > = z.object({ amount: z.nullable( z.lazy(() => OrderRightsOfAccumulationAmount$outboundSchema), ).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace RightsOfAccumulation$ { /** @deprecated use `RightsOfAccumulation$inboundSchema` instead. */ export const inboundSchema = RightsOfAccumulation$inboundSchema; /** @deprecated use `RightsOfAccumulation$outboundSchema` instead. */ export const outboundSchema = RightsOfAccumulation$outboundSchema; /** @deprecated use `RightsOfAccumulation$Outbound` instead. */ export type Outbound = RightsOfAccumulation$Outbound; } export function rightsOfAccumulationToJSON( rightsOfAccumulation: RightsOfAccumulation, ): string { return JSON.stringify( RightsOfAccumulation$outboundSchema.parse(rightsOfAccumulation), ); } export function rightsOfAccumulationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RightsOfAccumulation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RightsOfAccumulation' from JSON`, ); } /** @internal */ export const OrderSide$inboundSchema: z.ZodType< OrderSideOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderSide), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderSide$outboundSchema: z.ZodType< OrderSideOpen, z.ZodTypeDef, OrderSideOpen > = z.union([ z.nativeEnum(OrderSide), 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 OrderSide$ { /** @deprecated use `OrderSide$inboundSchema` instead. */ export const inboundSchema = OrderSide$inboundSchema; /** @deprecated use `OrderSide$outboundSchema` instead. */ export const outboundSchema = OrderSide$outboundSchema; } /** @internal */ export const OrderSpecialReportingInstructions$inboundSchema: z.ZodType< OrderSpecialReportingInstructionsOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderSpecialReportingInstructions), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderSpecialReportingInstructions$outboundSchema: z.ZodType< OrderSpecialReportingInstructionsOpen, z.ZodTypeDef, OrderSpecialReportingInstructionsOpen > = z.union([ z.nativeEnum(OrderSpecialReportingInstructions), 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 OrderSpecialReportingInstructions$ { /** @deprecated use `OrderSpecialReportingInstructions$inboundSchema` instead. */ export const inboundSchema = OrderSpecialReportingInstructions$inboundSchema; /** @deprecated use `OrderSpecialReportingInstructions$outboundSchema` instead. */ export const outboundSchema = OrderSpecialReportingInstructions$outboundSchema; } /** @internal */ export const OrderStopPricePrice$inboundSchema: z.ZodType< OrderStopPricePrice, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type OrderStopPricePrice$Outbound = { value?: string | undefined; }; /** @internal */ export const OrderStopPricePrice$outboundSchema: z.ZodType< OrderStopPricePrice$Outbound, z.ZodTypeDef, OrderStopPricePrice > = 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 OrderStopPricePrice$ { /** @deprecated use `OrderStopPricePrice$inboundSchema` instead. */ export const inboundSchema = OrderStopPricePrice$inboundSchema; /** @deprecated use `OrderStopPricePrice$outboundSchema` instead. */ export const outboundSchema = OrderStopPricePrice$outboundSchema; /** @deprecated use `OrderStopPricePrice$Outbound` instead. */ export type Outbound = OrderStopPricePrice$Outbound; } export function orderStopPricePriceToJSON( orderStopPricePrice: OrderStopPricePrice, ): string { return JSON.stringify( OrderStopPricePrice$outboundSchema.parse(orderStopPricePrice), ); } export function orderStopPricePriceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderStopPricePrice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderStopPricePrice' from JSON`, ); } /** @internal */ export const OrderStopPriceType$inboundSchema: z.ZodType< OrderStopPriceTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderStopPriceType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderStopPriceType$outboundSchema: z.ZodType< OrderStopPriceTypeOpen, z.ZodTypeDef, OrderStopPriceTypeOpen > = z.union([ z.nativeEnum(OrderStopPriceType), 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 OrderStopPriceType$ { /** @deprecated use `OrderStopPriceType$inboundSchema` instead. */ export const inboundSchema = OrderStopPriceType$inboundSchema; /** @deprecated use `OrderStopPriceType$outboundSchema` instead. */ export const outboundSchema = OrderStopPriceType$outboundSchema; } /** @internal */ export const StopPrice$inboundSchema: z.ZodType< StopPrice, z.ZodTypeDef, unknown > = z.object({ price: z.nullable(z.lazy(() => OrderStopPricePrice$inboundSchema)).optional(), type: OrderStopPriceType$inboundSchema.optional(), }); /** @internal */ export type StopPrice$Outbound = { price?: OrderStopPricePrice$Outbound | null | undefined; type?: string | undefined; }; /** @internal */ export const StopPrice$outboundSchema: z.ZodType< StopPrice$Outbound, z.ZodTypeDef, StopPrice > = z.object({ price: z.nullable(z.lazy(() => OrderStopPricePrice$outboundSchema)) .optional(), type: OrderStopPriceType$outboundSchema.optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace StopPrice$ { /** @deprecated use `StopPrice$inboundSchema` instead. */ export const inboundSchema = StopPrice$inboundSchema; /** @deprecated use `StopPrice$outboundSchema` instead. */ export const outboundSchema = StopPrice$outboundSchema; /** @deprecated use `StopPrice$Outbound` instead. */ export type Outbound = StopPrice$Outbound; } export function stopPriceToJSON(stopPrice: StopPrice): string { return JSON.stringify(StopPrice$outboundSchema.parse(stopPrice)); } export function stopPriceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => StopPrice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'StopPrice' from JSON`, ); } /** @internal */ export const OrderTimeInForce$inboundSchema: z.ZodType< OrderTimeInForceOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderTimeInForce), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderTimeInForce$outboundSchema: z.ZodType< OrderTimeInForceOpen, z.ZodTypeDef, OrderTimeInForceOpen > = z.union([ z.nativeEnum(OrderTimeInForce), 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 OrderTimeInForce$ { /** @deprecated use `OrderTimeInForce$inboundSchema` instead. */ export const inboundSchema = OrderTimeInForce$inboundSchema; /** @deprecated use `OrderTimeInForce$outboundSchema` instead. */ export const outboundSchema = OrderTimeInForce$outboundSchema; } /** @internal */ export const TimeInForceExpirationDate$inboundSchema: z.ZodType< TimeInForceExpirationDate, z.ZodTypeDef, unknown > = z.object({ day: z.number().int().optional(), month: z.number().int().optional(), year: z.number().int().optional(), }); /** @internal */ export type TimeInForceExpirationDate$Outbound = { day?: number | undefined; month?: number | undefined; year?: number | undefined; }; /** @internal */ export const TimeInForceExpirationDate$outboundSchema: z.ZodType< TimeInForceExpirationDate$Outbound, z.ZodTypeDef, TimeInForceExpirationDate > = 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 TimeInForceExpirationDate$ { /** @deprecated use `TimeInForceExpirationDate$inboundSchema` instead. */ export const inboundSchema = TimeInForceExpirationDate$inboundSchema; /** @deprecated use `TimeInForceExpirationDate$outboundSchema` instead. */ export const outboundSchema = TimeInForceExpirationDate$outboundSchema; /** @deprecated use `TimeInForceExpirationDate$Outbound` instead. */ export type Outbound = TimeInForceExpirationDate$Outbound; } export function timeInForceExpirationDateToJSON( timeInForceExpirationDate: TimeInForceExpirationDate, ): string { return JSON.stringify( TimeInForceExpirationDate$outboundSchema.parse(timeInForceExpirationDate), ); } export function timeInForceExpirationDateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TimeInForceExpirationDate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TimeInForceExpirationDate' from JSON`, ); } /** @internal */ export const OrderTradingSession$inboundSchema: z.ZodType< OrderTradingSessionOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderTradingSession), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderTradingSession$outboundSchema: z.ZodType< OrderTradingSessionOpen, z.ZodTypeDef, OrderTradingSessionOpen > = z.union([ z.nativeEnum(OrderTradingSession), 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 OrderTradingSession$ { /** @deprecated use `OrderTradingSession$inboundSchema` instead. */ export const inboundSchema = OrderTradingSession$inboundSchema; /** @deprecated use `OrderTradingSession$outboundSchema` instead. */ export const outboundSchema = OrderTradingSession$outboundSchema; } /** @internal */ export const Order$inboundSchema: z.ZodType = z .object({ account_id: z.string().optional(), asset_id: z.string().optional(), asset_type: OrderAssetType$inboundSchema.optional(), average_prices: z.array(TradingExecutedPrice$inboundSchema).optional(), broker_capacity: OrderBrokerCapacity$inboundSchema.optional(), cancel_initiator: CancelInitiator$inboundSchema.optional(), cancel_reason: z.string().optional(), cancel_rejected_reason: CancelRejectedReason$inboundSchema.optional(), client_cancel_received_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), client_cancel_sent_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), client_order_id: z.string().optional(), client_received_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), client_sent_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), commission: z.nullable(z.lazy(() => OrderCommission$inboundSchema)) .optional(), create_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), cumulative_notional_value: z.nullable( z.lazy(() => CumulativeNotionalValue$inboundSchema), ).optional(), currency_code: z.string().optional(), executions: z.array(TradingExecutions$inboundSchema).optional(), extra_reporting_data: z.nullable( z.lazy(() => ExtraReportingData$inboundSchema), ).optional(), fees: z.array(TradingFee$inboundSchema).optional(), filled_quantity: z.nullable(z.lazy(() => FilledQuantity$inboundSchema)) .optional(), identifier: z.string().optional(), identifier_issuing_region_code: z.string().optional(), identifier_type: OrderIdentifierType$inboundSchema.optional(), last_update_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), letter_of_intent: z.nullable(z.lazy(() => LetterOfIntent$inboundSchema)) .optional(), limit_price: z.nullable(z.lazy(() => LimitPrice$inboundSchema)).optional(), max_sell_quantity: z.nullable(z.lazy(() => MaxSellQuantity$inboundSchema)) .optional(), name: z.string().optional(), notional_value: z.nullable(z.lazy(() => NotionalValue$inboundSchema)) .optional(), open: z.boolean().optional(), order_date: z.nullable(z.lazy(() => OrderDate$inboundSchema)).optional(), order_id: z.string().optional(), order_rejected_reason: OrderRejectedReason$inboundSchema.optional(), order_status: OrderStatus$inboundSchema.optional(), order_type: OrderOrderType$inboundSchema.optional(), prevailing_market_price: z.nullable( z.lazy(() => OrderPrevailingMarketPrice$inboundSchema), ).optional(), quantity: z.nullable(z.lazy(() => OrderQuantity$inboundSchema)).optional(), rights_of_accumulation: z.nullable( z.lazy(() => RightsOfAccumulation$inboundSchema), ).optional(), side: OrderSide$inboundSchema.optional(), special_reporting_instructions: z.array( OrderSpecialReportingInstructions$inboundSchema, ).optional(), stop_price: z.nullable(z.lazy(() => StopPrice$inboundSchema)).optional(), time_in_force: OrderTimeInForce$inboundSchema.optional(), time_in_force_expiration_date: z.nullable( z.lazy(() => TimeInForceExpirationDate$inboundSchema), ).optional(), trading_session: OrderTradingSession$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "account_id": "accountId", "asset_id": "assetId", "asset_type": "assetType", "average_prices": "averagePrices", "broker_capacity": "brokerCapacity", "cancel_initiator": "cancelInitiator", "cancel_reason": "cancelReason", "cancel_rejected_reason": "cancelRejectedReason", "client_cancel_received_time": "clientCancelReceivedTime", "client_cancel_sent_time": "clientCancelSentTime", "client_order_id": "clientOrderId", "client_received_time": "clientReceivedTime", "client_sent_time": "clientSentTime", "create_time": "createTime", "cumulative_notional_value": "cumulativeNotionalValue", "currency_code": "currencyCode", "extra_reporting_data": "extraReportingData", "filled_quantity": "filledQuantity", "identifier_issuing_region_code": "identifierIssuingRegionCode", "identifier_type": "identifierType", "last_update_time": "lastUpdateTime", "letter_of_intent": "letterOfIntent", "limit_price": "limitPrice", "max_sell_quantity": "maxSellQuantity", "notional_value": "notionalValue", "order_date": "orderDate", "order_id": "orderId", "order_rejected_reason": "orderRejectedReason", "order_status": "orderStatus", "order_type": "orderType", "prevailing_market_price": "prevailingMarketPrice", "rights_of_accumulation": "rightsOfAccumulation", "special_reporting_instructions": "specialReportingInstructions", "stop_price": "stopPrice", "time_in_force": "timeInForce", "time_in_force_expiration_date": "timeInForceExpirationDate", "trading_session": "tradingSession", }); }); /** @internal */ export type Order$Outbound = { account_id?: string | undefined; asset_id?: string | undefined; asset_type?: string | undefined; average_prices?: Array | undefined; broker_capacity?: string | undefined; cancel_initiator?: string | undefined; cancel_reason?: string | undefined; cancel_rejected_reason?: string | undefined; client_cancel_received_time?: string | null | undefined; client_cancel_sent_time?: string | null | undefined; client_order_id?: string | undefined; client_received_time?: string | null | undefined; client_sent_time?: string | null | undefined; commission?: OrderCommission$Outbound | null | undefined; create_time?: string | null | undefined; cumulative_notional_value?: | CumulativeNotionalValue$Outbound | null | undefined; currency_code?: string | undefined; executions?: Array | undefined; extra_reporting_data?: ExtraReportingData$Outbound | null | undefined; fees?: Array | undefined; filled_quantity?: FilledQuantity$Outbound | null | undefined; identifier?: string | undefined; identifier_issuing_region_code?: string | undefined; identifier_type?: string | undefined; last_update_time?: string | null | undefined; letter_of_intent?: LetterOfIntent$Outbound | null | undefined; limit_price?: LimitPrice$Outbound | null | undefined; max_sell_quantity?: MaxSellQuantity$Outbound | null | undefined; name?: string | undefined; notional_value?: NotionalValue$Outbound | null | undefined; open?: boolean | undefined; order_date?: OrderDate$Outbound | null | undefined; order_id?: string | undefined; order_rejected_reason?: string | undefined; order_status?: string | undefined; order_type?: string | undefined; prevailing_market_price?: | OrderPrevailingMarketPrice$Outbound | null | undefined; quantity?: OrderQuantity$Outbound | null | undefined; rights_of_accumulation?: RightsOfAccumulation$Outbound | null | undefined; side?: string | undefined; special_reporting_instructions?: Array | undefined; stop_price?: StopPrice$Outbound | null | undefined; time_in_force?: string | undefined; time_in_force_expiration_date?: | TimeInForceExpirationDate$Outbound | null | undefined; trading_session?: string | undefined; }; /** @internal */ export const Order$outboundSchema: z.ZodType< Order$Outbound, z.ZodTypeDef, Order > = z.object({ accountId: z.string().optional(), assetId: z.string().optional(), assetType: OrderAssetType$outboundSchema.optional(), averagePrices: z.array(TradingExecutedPrice$outboundSchema).optional(), brokerCapacity: OrderBrokerCapacity$outboundSchema.optional(), cancelInitiator: CancelInitiator$outboundSchema.optional(), cancelReason: z.string().optional(), cancelRejectedReason: CancelRejectedReason$outboundSchema.optional(), clientCancelReceivedTime: z.nullable(z.date().transform(v => v.toISOString())) .optional(), clientCancelSentTime: z.nullable(z.date().transform(v => v.toISOString())) .optional(), clientOrderId: z.string().optional(), clientReceivedTime: z.nullable(z.date().transform(v => v.toISOString())) .optional(), clientSentTime: z.nullable(z.date().transform(v => v.toISOString())) .optional(), commission: z.nullable(z.lazy(() => OrderCommission$outboundSchema)) .optional(), createTime: z.nullable(z.date().transform(v => v.toISOString())).optional(), cumulativeNotionalValue: z.nullable( z.lazy(() => CumulativeNotionalValue$outboundSchema), ).optional(), currencyCode: z.string().optional(), executions: z.array(TradingExecutions$outboundSchema).optional(), extraReportingData: z.nullable( z.lazy(() => ExtraReportingData$outboundSchema), ).optional(), fees: z.array(TradingFee$outboundSchema).optional(), filledQuantity: z.nullable(z.lazy(() => FilledQuantity$outboundSchema)) .optional(), identifier: z.string().optional(), identifierIssuingRegionCode: z.string().optional(), identifierType: OrderIdentifierType$outboundSchema.optional(), lastUpdateTime: z.nullable(z.date().transform(v => v.toISOString())) .optional(), letterOfIntent: z.nullable(z.lazy(() => LetterOfIntent$outboundSchema)) .optional(), limitPrice: z.nullable(z.lazy(() => LimitPrice$outboundSchema)).optional(), maxSellQuantity: z.nullable(z.lazy(() => MaxSellQuantity$outboundSchema)) .optional(), name: z.string().optional(), notionalValue: z.nullable(z.lazy(() => NotionalValue$outboundSchema)) .optional(), open: z.boolean().optional(), orderDate: z.nullable(z.lazy(() => OrderDate$outboundSchema)).optional(), orderId: z.string().optional(), orderRejectedReason: OrderRejectedReason$outboundSchema.optional(), orderStatus: OrderStatus$outboundSchema.optional(), orderType: OrderOrderType$outboundSchema.optional(), prevailingMarketPrice: z.nullable( z.lazy(() => OrderPrevailingMarketPrice$outboundSchema), ).optional(), quantity: z.nullable(z.lazy(() => OrderQuantity$outboundSchema)).optional(), rightsOfAccumulation: z.nullable( z.lazy(() => RightsOfAccumulation$outboundSchema), ).optional(), side: OrderSide$outboundSchema.optional(), specialReportingInstructions: z.array( OrderSpecialReportingInstructions$outboundSchema, ).optional(), stopPrice: z.nullable(z.lazy(() => StopPrice$outboundSchema)).optional(), timeInForce: OrderTimeInForce$outboundSchema.optional(), timeInForceExpirationDate: z.nullable( z.lazy(() => TimeInForceExpirationDate$outboundSchema), ).optional(), tradingSession: OrderTradingSession$outboundSchema.optional(), }).transform((v) => { return remap$(v, { accountId: "account_id", assetId: "asset_id", assetType: "asset_type", averagePrices: "average_prices", brokerCapacity: "broker_capacity", cancelInitiator: "cancel_initiator", cancelReason: "cancel_reason", cancelRejectedReason: "cancel_rejected_reason", clientCancelReceivedTime: "client_cancel_received_time", clientCancelSentTime: "client_cancel_sent_time", clientOrderId: "client_order_id", clientReceivedTime: "client_received_time", clientSentTime: "client_sent_time", createTime: "create_time", cumulativeNotionalValue: "cumulative_notional_value", currencyCode: "currency_code", extraReportingData: "extra_reporting_data", filledQuantity: "filled_quantity", identifierIssuingRegionCode: "identifier_issuing_region_code", identifierType: "identifier_type", lastUpdateTime: "last_update_time", letterOfIntent: "letter_of_intent", limitPrice: "limit_price", maxSellQuantity: "max_sell_quantity", notionalValue: "notional_value", orderDate: "order_date", orderId: "order_id", orderRejectedReason: "order_rejected_reason", orderStatus: "order_status", orderType: "order_type", prevailingMarketPrice: "prevailing_market_price", rightsOfAccumulation: "rights_of_accumulation", specialReportingInstructions: "special_reporting_instructions", stopPrice: "stop_price", timeInForce: "time_in_force", timeInForceExpirationDate: "time_in_force_expiration_date", tradingSession: "trading_session", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Order$ { /** @deprecated use `Order$inboundSchema` instead. */ export const inboundSchema = Order$inboundSchema; /** @deprecated use `Order$outboundSchema` instead. */ export const outboundSchema = Order$outboundSchema; /** @deprecated use `Order$Outbound` instead. */ export type Outbound = Order$Outbound; } export function orderToJSON(order: Order): string { return JSON.stringify(Order$outboundSchema.parse(order)); } export function orderFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Order$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Order' from JSON`, ); }