/* * 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 { CommissionCreate, CommissionCreate$inboundSchema, CommissionCreate$Outbound, CommissionCreate$outboundSchema, } from "./commissioncreate.js"; import { DateCreate, DateCreate$inboundSchema, DateCreate$Outbound, DateCreate$outboundSchema, } from "./datecreate.js"; import { DecimalCreate, DecimalCreate$inboundSchema, DecimalCreate$Outbound, DecimalCreate$outboundSchema, } from "./decimalcreate.js"; import { FeeCreate, FeeCreate$inboundSchema, FeeCreate$Outbound, FeeCreate$outboundSchema, } from "./feecreate.js"; import { LetterOfIntentCreate, LetterOfIntentCreate$inboundSchema, LetterOfIntentCreate$Outbound, LetterOfIntentCreate$outboundSchema, } from "./letterofintentcreate.js"; import { LimitPriceCreate, LimitPriceCreate$inboundSchema, LimitPriceCreate$Outbound, LimitPriceCreate$outboundSchema, } from "./limitpricecreate.js"; import { RightsOfAccumulationCreate, RightsOfAccumulationCreate$inboundSchema, RightsOfAccumulationCreate$Outbound, RightsOfAccumulationCreate$outboundSchema, } from "./rightsofaccumulationcreate.js"; import { StopPriceCreate, StopPriceCreate$inboundSchema, StopPriceCreate$Outbound, StopPriceCreate$outboundSchema, } from "./stoppricecreate.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 AssetType { 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 AssetTypeOpen = 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 BrokerCapacity { 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 BrokerCapacityOpen = OpenEnum; /** * 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 OrderCreateIdentifierType { 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 OrderCreateIdentifierTypeOpen = OpenEnum< typeof OrderCreateIdentifierType >; /** * 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 OrderType { 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 OrderTypeOpen = OpenEnum; /** * The side of this order. */ export enum Side { SideUnspecified = "SIDE_UNSPECIFIED", Buy = "BUY", Sell = "SELL", } /** * The side of this order. */ export type SideOpen = OpenEnum; export enum SpecialReportingInstructions { 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 SpecialReportingInstructionsOpen = OpenEnum< typeof SpecialReportingInstructions >; /** * 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 TimeInForce { 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 TimeInForceOpen = OpenEnum; /** * Which TradingSession to trade in, defaults to 'CORE'. Only available for Equity orders. */ export enum TradingSession { 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 TradingSessionOpen = OpenEnum; /** * The message describing an order */ export type OrderCreate = { /** * The type of the asset in this order, which must be one of the following: * * @remarks * EQUITY, MUTUAL_FUND, and FIXED_INCOME. */ assetType: AssetTypeOpen; /** * 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?: BrokerCapacityOpen | undefined; /** * User-supplied unique order ID. Cannot be more than 40 characters long. */ clientOrderId: string; /** * 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 applied to an order */ commission?: CommissionCreate | 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; /** * Fees that will be applied to this order. Only the BROKER_FEE type is supported. */ fees?: Array | undefined; /** * Identifier of the asset (of the type specified in `identifier_type`). */ identifier: string; /** * 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: OrderCreateIdentifierTypeOpen; /** * 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?: LetterOfIntentCreate | undefined; /** * A limit price definition */ limitPrice?: LimitPriceCreate | undefined; /** * A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][]. * * @remarks * * [BigDecimal]: * https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html * [decimal.Decimal]: https://docs.python.org/3/library/decimal.html */ maxSellQuantity?: DecimalCreate | undefined; /** * A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][]. * * @remarks * * [BigDecimal]: * https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html * [decimal.Decimal]: https://docs.python.org/3/library/decimal.html */ notionalValue?: DecimalCreate | undefined; /** * Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * * @remarks * * * A full date, with non-zero year, month, and day values * A month and day value, with a zero year, such as an anniversary * A year on its own, with zero month and day values * A year and month value, with a zero day, such as a credit card expiration date * * Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and `google.protobuf.Timestamp`. */ orderDate: DateCreate; /** * 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: OrderTypeOpen; /** * A representation of a decimal value, such as 2.5. Clients may convert values into language-native decimal formats, such as Java's [BigDecimal][] or Python's [decimal.Decimal][]. * * @remarks * * [BigDecimal]: * https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/math/BigDecimal.html * [decimal.Decimal]: https://docs.python.org/3/library/decimal.html */ quantity?: DecimalCreate | 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?: RightsOfAccumulationCreate | undefined; /** * The side of this order. */ side: SideOpen; /** * 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; /** * A stop price definition */ stopPrice?: StopPriceCreate | 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: TimeInForceOpen; /** * Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * * @remarks * * * A full date, with non-zero year, month, and day values * A month and day value, with a zero year, such as an anniversary * A year on its own, with zero month and day values * A year and month value, with a zero day, such as a credit card expiration date * * Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and `google.protobuf.Timestamp`. */ timeInForceExpirationDate?: DateCreate | undefined; /** * Which TradingSession to trade in, defaults to 'CORE'. Only available for Equity orders. */ tradingSession?: TradingSessionOpen | undefined; }; /** @internal */ export const AssetType$inboundSchema: z.ZodType< AssetTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(AssetType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const AssetType$outboundSchema: z.ZodType< AssetTypeOpen, z.ZodTypeDef, AssetTypeOpen > = z.union([ z.nativeEnum(AssetType), 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 AssetType$ { /** @deprecated use `AssetType$inboundSchema` instead. */ export const inboundSchema = AssetType$inboundSchema; /** @deprecated use `AssetType$outboundSchema` instead. */ export const outboundSchema = AssetType$outboundSchema; } /** @internal */ export const BrokerCapacity$inboundSchema: z.ZodType< BrokerCapacityOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(BrokerCapacity), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const BrokerCapacity$outboundSchema: z.ZodType< BrokerCapacityOpen, z.ZodTypeDef, BrokerCapacityOpen > = z.union([ z.nativeEnum(BrokerCapacity), 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 BrokerCapacity$ { /** @deprecated use `BrokerCapacity$inboundSchema` instead. */ export const inboundSchema = BrokerCapacity$inboundSchema; /** @deprecated use `BrokerCapacity$outboundSchema` instead. */ export const outboundSchema = BrokerCapacity$outboundSchema; } /** @internal */ export const OrderCreateIdentifierType$inboundSchema: z.ZodType< OrderCreateIdentifierTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderCreateIdentifierType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderCreateIdentifierType$outboundSchema: z.ZodType< OrderCreateIdentifierTypeOpen, z.ZodTypeDef, OrderCreateIdentifierTypeOpen > = z.union([ z.nativeEnum(OrderCreateIdentifierType), 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 OrderCreateIdentifierType$ { /** @deprecated use `OrderCreateIdentifierType$inboundSchema` instead. */ export const inboundSchema = OrderCreateIdentifierType$inboundSchema; /** @deprecated use `OrderCreateIdentifierType$outboundSchema` instead. */ export const outboundSchema = OrderCreateIdentifierType$outboundSchema; } /** @internal */ export const OrderType$inboundSchema: z.ZodType< OrderTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderType$outboundSchema: z.ZodType< OrderTypeOpen, z.ZodTypeDef, OrderTypeOpen > = z.union([ z.nativeEnum(OrderType), 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 OrderType$ { /** @deprecated use `OrderType$inboundSchema` instead. */ export const inboundSchema = OrderType$inboundSchema; /** @deprecated use `OrderType$outboundSchema` instead. */ export const outboundSchema = OrderType$outboundSchema; } /** @internal */ export const Side$inboundSchema: z.ZodType = z .union([ z.nativeEnum(Side), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const Side$outboundSchema: z.ZodType = z.union([ z.nativeEnum(Side), 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 Side$ { /** @deprecated use `Side$inboundSchema` instead. */ export const inboundSchema = Side$inboundSchema; /** @deprecated use `Side$outboundSchema` instead. */ export const outboundSchema = Side$outboundSchema; } /** @internal */ export const SpecialReportingInstructions$inboundSchema: z.ZodType< SpecialReportingInstructionsOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(SpecialReportingInstructions), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const SpecialReportingInstructions$outboundSchema: z.ZodType< SpecialReportingInstructionsOpen, z.ZodTypeDef, SpecialReportingInstructionsOpen > = z.union([ z.nativeEnum(SpecialReportingInstructions), 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 SpecialReportingInstructions$ { /** @deprecated use `SpecialReportingInstructions$inboundSchema` instead. */ export const inboundSchema = SpecialReportingInstructions$inboundSchema; /** @deprecated use `SpecialReportingInstructions$outboundSchema` instead. */ export const outboundSchema = SpecialReportingInstructions$outboundSchema; } /** @internal */ export const TimeInForce$inboundSchema: z.ZodType< TimeInForceOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(TimeInForce), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const TimeInForce$outboundSchema: z.ZodType< TimeInForceOpen, z.ZodTypeDef, TimeInForceOpen > = z.union([ z.nativeEnum(TimeInForce), 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 TimeInForce$ { /** @deprecated use `TimeInForce$inboundSchema` instead. */ export const inboundSchema = TimeInForce$inboundSchema; /** @deprecated use `TimeInForce$outboundSchema` instead. */ export const outboundSchema = TimeInForce$outboundSchema; } /** @internal */ export const TradingSession$inboundSchema: z.ZodType< TradingSessionOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(TradingSession), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const TradingSession$outboundSchema: z.ZodType< TradingSessionOpen, z.ZodTypeDef, TradingSessionOpen > = z.union([ z.nativeEnum(TradingSession), 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 TradingSession$ { /** @deprecated use `TradingSession$inboundSchema` instead. */ export const inboundSchema = TradingSession$inboundSchema; /** @deprecated use `TradingSession$outboundSchema` instead. */ export const outboundSchema = TradingSession$outboundSchema; } /** @internal */ export const OrderCreate$inboundSchema: z.ZodType< OrderCreate, z.ZodTypeDef, unknown > = z.object({ asset_type: AssetType$inboundSchema, broker_capacity: BrokerCapacity$inboundSchema.optional(), client_order_id: z.string(), 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: CommissionCreate$inboundSchema.optional(), currency_code: z.string().optional(), fees: z.array(FeeCreate$inboundSchema).optional(), identifier: z.string(), identifier_issuing_region_code: z.string().optional(), identifier_type: OrderCreateIdentifierType$inboundSchema, letter_of_intent: LetterOfIntentCreate$inboundSchema.optional(), limit_price: LimitPriceCreate$inboundSchema.optional(), max_sell_quantity: DecimalCreate$inboundSchema.optional(), notional_value: DecimalCreate$inboundSchema.optional(), order_date: DateCreate$inboundSchema, order_type: OrderType$inboundSchema, quantity: DecimalCreate$inboundSchema.optional(), rights_of_accumulation: RightsOfAccumulationCreate$inboundSchema.optional(), side: Side$inboundSchema, special_reporting_instructions: z.array( SpecialReportingInstructions$inboundSchema, ).optional(), stop_price: StopPriceCreate$inboundSchema.optional(), time_in_force: TimeInForce$inboundSchema, time_in_force_expiration_date: DateCreate$inboundSchema.optional(), trading_session: TradingSession$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "asset_type": "assetType", "broker_capacity": "brokerCapacity", "client_order_id": "clientOrderId", "client_received_time": "clientReceivedTime", "client_sent_time": "clientSentTime", "currency_code": "currencyCode", "identifier_issuing_region_code": "identifierIssuingRegionCode", "identifier_type": "identifierType", "letter_of_intent": "letterOfIntent", "limit_price": "limitPrice", "max_sell_quantity": "maxSellQuantity", "notional_value": "notionalValue", "order_date": "orderDate", "order_type": "orderType", "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 OrderCreate$Outbound = { asset_type: string; broker_capacity?: string | undefined; client_order_id: string; client_received_time?: string | null | undefined; client_sent_time?: string | null | undefined; commission?: CommissionCreate$Outbound | undefined; currency_code?: string | undefined; fees?: Array | undefined; identifier: string; identifier_issuing_region_code?: string | undefined; identifier_type: string; letter_of_intent?: LetterOfIntentCreate$Outbound | undefined; limit_price?: LimitPriceCreate$Outbound | undefined; max_sell_quantity?: DecimalCreate$Outbound | undefined; notional_value?: DecimalCreate$Outbound | undefined; order_date: DateCreate$Outbound; order_type: string; quantity?: DecimalCreate$Outbound | undefined; rights_of_accumulation?: RightsOfAccumulationCreate$Outbound | undefined; side: string; special_reporting_instructions?: Array | undefined; stop_price?: StopPriceCreate$Outbound | undefined; time_in_force: string; time_in_force_expiration_date?: DateCreate$Outbound | undefined; trading_session?: string | undefined; }; /** @internal */ export const OrderCreate$outboundSchema: z.ZodType< OrderCreate$Outbound, z.ZodTypeDef, OrderCreate > = z.object({ assetType: AssetType$outboundSchema, brokerCapacity: BrokerCapacity$outboundSchema.optional(), clientOrderId: z.string(), clientReceivedTime: z.nullable(z.date().transform(v => v.toISOString())) .optional(), clientSentTime: z.nullable(z.date().transform(v => v.toISOString())) .optional(), commission: CommissionCreate$outboundSchema.optional(), currencyCode: z.string().optional(), fees: z.array(FeeCreate$outboundSchema).optional(), identifier: z.string(), identifierIssuingRegionCode: z.string().optional(), identifierType: OrderCreateIdentifierType$outboundSchema, letterOfIntent: LetterOfIntentCreate$outboundSchema.optional(), limitPrice: LimitPriceCreate$outboundSchema.optional(), maxSellQuantity: DecimalCreate$outboundSchema.optional(), notionalValue: DecimalCreate$outboundSchema.optional(), orderDate: DateCreate$outboundSchema, orderType: OrderType$outboundSchema, quantity: DecimalCreate$outboundSchema.optional(), rightsOfAccumulation: RightsOfAccumulationCreate$outboundSchema.optional(), side: Side$outboundSchema, specialReportingInstructions: z.array( SpecialReportingInstructions$outboundSchema, ).optional(), stopPrice: StopPriceCreate$outboundSchema.optional(), timeInForce: TimeInForce$outboundSchema, timeInForceExpirationDate: DateCreate$outboundSchema.optional(), tradingSession: TradingSession$outboundSchema.optional(), }).transform((v) => { return remap$(v, { assetType: "asset_type", brokerCapacity: "broker_capacity", clientOrderId: "client_order_id", clientReceivedTime: "client_received_time", clientSentTime: "client_sent_time", currencyCode: "currency_code", identifierIssuingRegionCode: "identifier_issuing_region_code", identifierType: "identifier_type", letterOfIntent: "letter_of_intent", limitPrice: "limit_price", maxSellQuantity: "max_sell_quantity", notionalValue: "notional_value", orderDate: "order_date", orderType: "order_type", 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 OrderCreate$ { /** @deprecated use `OrderCreate$inboundSchema` instead. */ export const inboundSchema = OrderCreate$inboundSchema; /** @deprecated use `OrderCreate$outboundSchema` instead. */ export const outboundSchema = OrderCreate$outboundSchema; /** @deprecated use `OrderCreate$Outbound` instead. */ export type Outbound = OrderCreate$Outbound; } export function orderCreateToJSON(orderCreate: OrderCreate): string { return JSON.stringify(OrderCreate$outboundSchema.parse(orderCreate)); } export function orderCreateFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderCreate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderCreate' from JSON`, ); }