/* * 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"; /** * The type of asset referenced by the security identifier */ export enum OrderCostPreviewResponseAssetType { AssetTypeUnspecified = "ASSET_TYPE_UNSPECIFIED", Equity = "EQUITY", FixedIncome = "FIXED_INCOME", MutualFund = "MUTUAL_FUND", Option = "OPTION", EventContract = "EVENT_CONTRACT", } /** * The type of asset referenced by the security identifier */ export type OrderCostPreviewResponseAssetTypeOpen = OpenEnum< typeof OrderCostPreviewResponseAssetType >; /** * Capacity used in determining the order cost. Defaults to "AGENCY" if no value specified. */ export enum OrderCostPreviewResponseBrokerCapacity { BrokerCapacityUnspecified = "BROKER_CAPACITY_UNSPECIFIED", Agency = "AGENCY", Principal = "PRINCIPAL", } /** * Capacity used in determining the order cost. Defaults to "AGENCY" if no value specified. */ export type OrderCostPreviewResponseBrokerCapacityOpen = OpenEnum< typeof OrderCostPreviewResponseBrokerCapacity >; /** * The estimated total of accrued interest that would be exchanged in an order of the given quantity */ export type EstimatedAccruedInterest = { /** * 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 principal amount involved, which is the notional value of the underlying assets that would be exchanged for the given quantity */ export type EstimatedGrossAmount = { /** * 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; }; /** * Customer disclosure of the estimated gross credit (fee / markup) amount retained by broker based given the price adjustment schedule configured for orders executed in a principal capacity for a given quantity, and limit price. This amount is priced into the estimated_gross_credit_amount and is not separately charged explicitly. */ export type EstimatedGrossCreditAmount = { /** * 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 estimated net notional amount involved in an order of the given quantity, capacity, and limit price. This will be the sum of the estimated gross amount and accrued interest, rounded to two decimal places. (For orders in the principal capacity, this total will include mark-up/mark-down price adjustments.) */ export type EstimatedNetAmount = { /** * 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 used for price calculations. This will be the same value as what was sent on the request. */ export enum OrderCostPreviewResponseIdentifierType { AssetId = "ASSET_ID", Cusip = "CUSIP", Isin = "ISIN", } /** * The identifier type of the asset used for price calculations. This will be the same value as what was sent on the request. */ export type OrderCostPreviewResponseIdentifierTypeOpen = OpenEnum< typeof OrderCostPreviewResponseIdentifierType >; /** * 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 OrderCostPreviewResponsePrice = { /** * 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 OrderCostPreviewResponseType { 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 OrderCostPreviewResponseTypeOpen = OpenEnum< typeof OrderCostPreviewResponseType >; /** * The limit price to use in calculating costs. Only PERCENTAGE_OF_PAR will be accepted and returned. */ export type OrderCostPreviewResponseLimitPrice = { /** * 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?: OrderCostPreviewResponsePrice | 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?: OrderCostPreviewResponseTypeOpen | undefined; }; /** * The quantity of the designated asset that would be ordered. For Fixed Income: Expressed in the par (face-value) amount and may not exceed two decimal places for USD-based currencies. */ export type OrderCostPreviewResponseQuantity = { /** * 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; }; /** * Preview of estimated costs for a chosen quantity, asset, capacity, and limit price */ export type OrderCostPreviewResponse = { /** * The account id used in calculating order costs */ accountId?: string | undefined; /** * Apex Asset ID for this asset. */ assetId?: string | undefined; /** * The type of asset referenced by the security identifier */ assetType?: OrderCostPreviewResponseAssetTypeOpen | undefined; /** * Capacity used in determining the order cost. Defaults to "AGENCY" if no value specified. */ brokerCapacity?: OrderCostPreviewResponseBrokerCapacityOpen | undefined; /** * The estimated total of accrued interest that would be exchanged in an order of the given quantity */ estimatedAccruedInterest?: EstimatedAccruedInterest | null | undefined; /** * The principal amount involved, which is the notional value of the underlying assets that would be exchanged for the given quantity */ estimatedGrossAmount?: EstimatedGrossAmount | null | undefined; /** * Customer disclosure of the estimated gross credit (fee / markup) amount retained by broker based given the price adjustment schedule configured for orders executed in a principal capacity for a given quantity, and limit price. This amount is priced into the estimated_gross_credit_amount and is not separately charged explicitly. */ estimatedGrossCreditAmount?: EstimatedGrossCreditAmount | null | undefined; /** * The estimated net notional amount involved in an order of the given quantity, capacity, and limit price. This will be the sum of the estimated gross amount and accrued interest, rounded to two decimal places. (For orders in the principal capacity, this total will include mark-up/mark-down price adjustments.) */ estimatedNetAmount?: EstimatedNetAmount | null | undefined; /** * Identifier of the asset (of the type specified in `identifier_type`). */ identifier?: string | undefined; /** * The identifier type of the asset used for price calculations. This will be the same value as what was sent on the request. */ identifierType?: OrderCostPreviewResponseIdentifierTypeOpen | undefined; /** * The limit price to use in calculating costs. Only PERCENTAGE_OF_PAR will be accepted and returned. */ limitPrice?: OrderCostPreviewResponseLimitPrice | null | undefined; /** * The quantity of the designated asset that would be ordered. For Fixed Income: Expressed in the par (face-value) amount and may not exceed two decimal places for USD-based currencies. */ quantity?: OrderCostPreviewResponseQuantity | null | undefined; /** * The time the response was generated by the system */ responseGenerationTime?: Date | null | undefined; }; /** @internal */ export const OrderCostPreviewResponseAssetType$inboundSchema: z.ZodType< OrderCostPreviewResponseAssetTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderCostPreviewResponseAssetType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderCostPreviewResponseAssetType$outboundSchema: z.ZodType< OrderCostPreviewResponseAssetTypeOpen, z.ZodTypeDef, OrderCostPreviewResponseAssetTypeOpen > = z.union([ z.nativeEnum(OrderCostPreviewResponseAssetType), 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 OrderCostPreviewResponseAssetType$ { /** @deprecated use `OrderCostPreviewResponseAssetType$inboundSchema` instead. */ export const inboundSchema = OrderCostPreviewResponseAssetType$inboundSchema; /** @deprecated use `OrderCostPreviewResponseAssetType$outboundSchema` instead. */ export const outboundSchema = OrderCostPreviewResponseAssetType$outboundSchema; } /** @internal */ export const OrderCostPreviewResponseBrokerCapacity$inboundSchema: z.ZodType< OrderCostPreviewResponseBrokerCapacityOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderCostPreviewResponseBrokerCapacity), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderCostPreviewResponseBrokerCapacity$outboundSchema: z.ZodType< OrderCostPreviewResponseBrokerCapacityOpen, z.ZodTypeDef, OrderCostPreviewResponseBrokerCapacityOpen > = z.union([ z.nativeEnum(OrderCostPreviewResponseBrokerCapacity), 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 OrderCostPreviewResponseBrokerCapacity$ { /** @deprecated use `OrderCostPreviewResponseBrokerCapacity$inboundSchema` instead. */ export const inboundSchema = OrderCostPreviewResponseBrokerCapacity$inboundSchema; /** @deprecated use `OrderCostPreviewResponseBrokerCapacity$outboundSchema` instead. */ export const outboundSchema = OrderCostPreviewResponseBrokerCapacity$outboundSchema; } /** @internal */ export const EstimatedAccruedInterest$inboundSchema: z.ZodType< EstimatedAccruedInterest, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type EstimatedAccruedInterest$Outbound = { value?: string | undefined; }; /** @internal */ export const EstimatedAccruedInterest$outboundSchema: z.ZodType< EstimatedAccruedInterest$Outbound, z.ZodTypeDef, EstimatedAccruedInterest > = 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 EstimatedAccruedInterest$ { /** @deprecated use `EstimatedAccruedInterest$inboundSchema` instead. */ export const inboundSchema = EstimatedAccruedInterest$inboundSchema; /** @deprecated use `EstimatedAccruedInterest$outboundSchema` instead. */ export const outboundSchema = EstimatedAccruedInterest$outboundSchema; /** @deprecated use `EstimatedAccruedInterest$Outbound` instead. */ export type Outbound = EstimatedAccruedInterest$Outbound; } export function estimatedAccruedInterestToJSON( estimatedAccruedInterest: EstimatedAccruedInterest, ): string { return JSON.stringify( EstimatedAccruedInterest$outboundSchema.parse(estimatedAccruedInterest), ); } export function estimatedAccruedInterestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EstimatedAccruedInterest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EstimatedAccruedInterest' from JSON`, ); } /** @internal */ export const EstimatedGrossAmount$inboundSchema: z.ZodType< EstimatedGrossAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type EstimatedGrossAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const EstimatedGrossAmount$outboundSchema: z.ZodType< EstimatedGrossAmount$Outbound, z.ZodTypeDef, EstimatedGrossAmount > = 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 EstimatedGrossAmount$ { /** @deprecated use `EstimatedGrossAmount$inboundSchema` instead. */ export const inboundSchema = EstimatedGrossAmount$inboundSchema; /** @deprecated use `EstimatedGrossAmount$outboundSchema` instead. */ export const outboundSchema = EstimatedGrossAmount$outboundSchema; /** @deprecated use `EstimatedGrossAmount$Outbound` instead. */ export type Outbound = EstimatedGrossAmount$Outbound; } export function estimatedGrossAmountToJSON( estimatedGrossAmount: EstimatedGrossAmount, ): string { return JSON.stringify( EstimatedGrossAmount$outboundSchema.parse(estimatedGrossAmount), ); } export function estimatedGrossAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EstimatedGrossAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EstimatedGrossAmount' from JSON`, ); } /** @internal */ export const EstimatedGrossCreditAmount$inboundSchema: z.ZodType< EstimatedGrossCreditAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type EstimatedGrossCreditAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const EstimatedGrossCreditAmount$outboundSchema: z.ZodType< EstimatedGrossCreditAmount$Outbound, z.ZodTypeDef, EstimatedGrossCreditAmount > = 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 EstimatedGrossCreditAmount$ { /** @deprecated use `EstimatedGrossCreditAmount$inboundSchema` instead. */ export const inboundSchema = EstimatedGrossCreditAmount$inboundSchema; /** @deprecated use `EstimatedGrossCreditAmount$outboundSchema` instead. */ export const outboundSchema = EstimatedGrossCreditAmount$outboundSchema; /** @deprecated use `EstimatedGrossCreditAmount$Outbound` instead. */ export type Outbound = EstimatedGrossCreditAmount$Outbound; } export function estimatedGrossCreditAmountToJSON( estimatedGrossCreditAmount: EstimatedGrossCreditAmount, ): string { return JSON.stringify( EstimatedGrossCreditAmount$outboundSchema.parse(estimatedGrossCreditAmount), ); } export function estimatedGrossCreditAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EstimatedGrossCreditAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EstimatedGrossCreditAmount' from JSON`, ); } /** @internal */ export const EstimatedNetAmount$inboundSchema: z.ZodType< EstimatedNetAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type EstimatedNetAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const EstimatedNetAmount$outboundSchema: z.ZodType< EstimatedNetAmount$Outbound, z.ZodTypeDef, EstimatedNetAmount > = 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 EstimatedNetAmount$ { /** @deprecated use `EstimatedNetAmount$inboundSchema` instead. */ export const inboundSchema = EstimatedNetAmount$inboundSchema; /** @deprecated use `EstimatedNetAmount$outboundSchema` instead. */ export const outboundSchema = EstimatedNetAmount$outboundSchema; /** @deprecated use `EstimatedNetAmount$Outbound` instead. */ export type Outbound = EstimatedNetAmount$Outbound; } export function estimatedNetAmountToJSON( estimatedNetAmount: EstimatedNetAmount, ): string { return JSON.stringify( EstimatedNetAmount$outboundSchema.parse(estimatedNetAmount), ); } export function estimatedNetAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EstimatedNetAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EstimatedNetAmount' from JSON`, ); } /** @internal */ export const OrderCostPreviewResponseIdentifierType$inboundSchema: z.ZodType< OrderCostPreviewResponseIdentifierTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderCostPreviewResponseIdentifierType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderCostPreviewResponseIdentifierType$outboundSchema: z.ZodType< OrderCostPreviewResponseIdentifierTypeOpen, z.ZodTypeDef, OrderCostPreviewResponseIdentifierTypeOpen > = z.union([ z.nativeEnum(OrderCostPreviewResponseIdentifierType), 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 OrderCostPreviewResponseIdentifierType$ { /** @deprecated use `OrderCostPreviewResponseIdentifierType$inboundSchema` instead. */ export const inboundSchema = OrderCostPreviewResponseIdentifierType$inboundSchema; /** @deprecated use `OrderCostPreviewResponseIdentifierType$outboundSchema` instead. */ export const outboundSchema = OrderCostPreviewResponseIdentifierType$outboundSchema; } /** @internal */ export const OrderCostPreviewResponsePrice$inboundSchema: z.ZodType< OrderCostPreviewResponsePrice, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type OrderCostPreviewResponsePrice$Outbound = { value?: string | undefined; }; /** @internal */ export const OrderCostPreviewResponsePrice$outboundSchema: z.ZodType< OrderCostPreviewResponsePrice$Outbound, z.ZodTypeDef, OrderCostPreviewResponsePrice > = 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 OrderCostPreviewResponsePrice$ { /** @deprecated use `OrderCostPreviewResponsePrice$inboundSchema` instead. */ export const inboundSchema = OrderCostPreviewResponsePrice$inboundSchema; /** @deprecated use `OrderCostPreviewResponsePrice$outboundSchema` instead. */ export const outboundSchema = OrderCostPreviewResponsePrice$outboundSchema; /** @deprecated use `OrderCostPreviewResponsePrice$Outbound` instead. */ export type Outbound = OrderCostPreviewResponsePrice$Outbound; } export function orderCostPreviewResponsePriceToJSON( orderCostPreviewResponsePrice: OrderCostPreviewResponsePrice, ): string { return JSON.stringify( OrderCostPreviewResponsePrice$outboundSchema.parse( orderCostPreviewResponsePrice, ), ); } export function orderCostPreviewResponsePriceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderCostPreviewResponsePrice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderCostPreviewResponsePrice' from JSON`, ); } /** @internal */ export const OrderCostPreviewResponseType$inboundSchema: z.ZodType< OrderCostPreviewResponseTypeOpen, z.ZodTypeDef, unknown > = z .union([ z.nativeEnum(OrderCostPreviewResponseType), z.string().transform(catchUnrecognizedEnum), ]); /** @internal */ export const OrderCostPreviewResponseType$outboundSchema: z.ZodType< OrderCostPreviewResponseTypeOpen, z.ZodTypeDef, OrderCostPreviewResponseTypeOpen > = z.union([ z.nativeEnum(OrderCostPreviewResponseType), 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 OrderCostPreviewResponseType$ { /** @deprecated use `OrderCostPreviewResponseType$inboundSchema` instead. */ export const inboundSchema = OrderCostPreviewResponseType$inboundSchema; /** @deprecated use `OrderCostPreviewResponseType$outboundSchema` instead. */ export const outboundSchema = OrderCostPreviewResponseType$outboundSchema; } /** @internal */ export const OrderCostPreviewResponseLimitPrice$inboundSchema: z.ZodType< OrderCostPreviewResponseLimitPrice, z.ZodTypeDef, unknown > = z.object({ price: z.nullable(z.lazy(() => OrderCostPreviewResponsePrice$inboundSchema)) .optional(), type: OrderCostPreviewResponseType$inboundSchema.optional(), }); /** @internal */ export type OrderCostPreviewResponseLimitPrice$Outbound = { price?: OrderCostPreviewResponsePrice$Outbound | null | undefined; type?: string | undefined; }; /** @internal */ export const OrderCostPreviewResponseLimitPrice$outboundSchema: z.ZodType< OrderCostPreviewResponseLimitPrice$Outbound, z.ZodTypeDef, OrderCostPreviewResponseLimitPrice > = z.object({ price: z.nullable(z.lazy(() => OrderCostPreviewResponsePrice$outboundSchema)) .optional(), type: OrderCostPreviewResponseType$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 OrderCostPreviewResponseLimitPrice$ { /** @deprecated use `OrderCostPreviewResponseLimitPrice$inboundSchema` instead. */ export const inboundSchema = OrderCostPreviewResponseLimitPrice$inboundSchema; /** @deprecated use `OrderCostPreviewResponseLimitPrice$outboundSchema` instead. */ export const outboundSchema = OrderCostPreviewResponseLimitPrice$outboundSchema; /** @deprecated use `OrderCostPreviewResponseLimitPrice$Outbound` instead. */ export type Outbound = OrderCostPreviewResponseLimitPrice$Outbound; } export function orderCostPreviewResponseLimitPriceToJSON( orderCostPreviewResponseLimitPrice: OrderCostPreviewResponseLimitPrice, ): string { return JSON.stringify( OrderCostPreviewResponseLimitPrice$outboundSchema.parse( orderCostPreviewResponseLimitPrice, ), ); } export function orderCostPreviewResponseLimitPriceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderCostPreviewResponseLimitPrice$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderCostPreviewResponseLimitPrice' from JSON`, ); } /** @internal */ export const OrderCostPreviewResponseQuantity$inboundSchema: z.ZodType< OrderCostPreviewResponseQuantity, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type OrderCostPreviewResponseQuantity$Outbound = { value?: string | undefined; }; /** @internal */ export const OrderCostPreviewResponseQuantity$outboundSchema: z.ZodType< OrderCostPreviewResponseQuantity$Outbound, z.ZodTypeDef, OrderCostPreviewResponseQuantity > = 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 OrderCostPreviewResponseQuantity$ { /** @deprecated use `OrderCostPreviewResponseQuantity$inboundSchema` instead. */ export const inboundSchema = OrderCostPreviewResponseQuantity$inboundSchema; /** @deprecated use `OrderCostPreviewResponseQuantity$outboundSchema` instead. */ export const outboundSchema = OrderCostPreviewResponseQuantity$outboundSchema; /** @deprecated use `OrderCostPreviewResponseQuantity$Outbound` instead. */ export type Outbound = OrderCostPreviewResponseQuantity$Outbound; } export function orderCostPreviewResponseQuantityToJSON( orderCostPreviewResponseQuantity: OrderCostPreviewResponseQuantity, ): string { return JSON.stringify( OrderCostPreviewResponseQuantity$outboundSchema.parse( orderCostPreviewResponseQuantity, ), ); } export function orderCostPreviewResponseQuantityFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderCostPreviewResponseQuantity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderCostPreviewResponseQuantity' from JSON`, ); } /** @internal */ export const OrderCostPreviewResponse$inboundSchema: z.ZodType< OrderCostPreviewResponse, z.ZodTypeDef, unknown > = z.object({ account_id: z.string().optional(), asset_id: z.string().optional(), asset_type: OrderCostPreviewResponseAssetType$inboundSchema.optional(), broker_capacity: OrderCostPreviewResponseBrokerCapacity$inboundSchema .optional(), estimated_accrued_interest: z.nullable( z.lazy(() => EstimatedAccruedInterest$inboundSchema), ).optional(), estimated_gross_amount: z.nullable( z.lazy(() => EstimatedGrossAmount$inboundSchema), ).optional(), estimated_gross_credit_amount: z.nullable( z.lazy(() => EstimatedGrossCreditAmount$inboundSchema), ).optional(), estimated_net_amount: z.nullable( z.lazy(() => EstimatedNetAmount$inboundSchema), ).optional(), identifier: z.string().optional(), identifier_type: OrderCostPreviewResponseIdentifierType$inboundSchema .optional(), limit_price: z.nullable( z.lazy(() => OrderCostPreviewResponseLimitPrice$inboundSchema), ).optional(), quantity: z.nullable( z.lazy(() => OrderCostPreviewResponseQuantity$inboundSchema), ).optional(), response_generation_time: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), }).transform((v) => { return remap$(v, { "account_id": "accountId", "asset_id": "assetId", "asset_type": "assetType", "broker_capacity": "brokerCapacity", "estimated_accrued_interest": "estimatedAccruedInterest", "estimated_gross_amount": "estimatedGrossAmount", "estimated_gross_credit_amount": "estimatedGrossCreditAmount", "estimated_net_amount": "estimatedNetAmount", "identifier_type": "identifierType", "limit_price": "limitPrice", "response_generation_time": "responseGenerationTime", }); }); /** @internal */ export type OrderCostPreviewResponse$Outbound = { account_id?: string | undefined; asset_id?: string | undefined; asset_type?: string | undefined; broker_capacity?: string | undefined; estimated_accrued_interest?: | EstimatedAccruedInterest$Outbound | null | undefined; estimated_gross_amount?: EstimatedGrossAmount$Outbound | null | undefined; estimated_gross_credit_amount?: | EstimatedGrossCreditAmount$Outbound | null | undefined; estimated_net_amount?: EstimatedNetAmount$Outbound | null | undefined; identifier?: string | undefined; identifier_type?: string | undefined; limit_price?: OrderCostPreviewResponseLimitPrice$Outbound | null | undefined; quantity?: OrderCostPreviewResponseQuantity$Outbound | null | undefined; response_generation_time?: string | null | undefined; }; /** @internal */ export const OrderCostPreviewResponse$outboundSchema: z.ZodType< OrderCostPreviewResponse$Outbound, z.ZodTypeDef, OrderCostPreviewResponse > = z.object({ accountId: z.string().optional(), assetId: z.string().optional(), assetType: OrderCostPreviewResponseAssetType$outboundSchema.optional(), brokerCapacity: OrderCostPreviewResponseBrokerCapacity$outboundSchema .optional(), estimatedAccruedInterest: z.nullable( z.lazy(() => EstimatedAccruedInterest$outboundSchema), ).optional(), estimatedGrossAmount: z.nullable( z.lazy(() => EstimatedGrossAmount$outboundSchema), ).optional(), estimatedGrossCreditAmount: z.nullable( z.lazy(() => EstimatedGrossCreditAmount$outboundSchema), ).optional(), estimatedNetAmount: z.nullable( z.lazy(() => EstimatedNetAmount$outboundSchema), ).optional(), identifier: z.string().optional(), identifierType: OrderCostPreviewResponseIdentifierType$outboundSchema .optional(), limitPrice: z.nullable( z.lazy(() => OrderCostPreviewResponseLimitPrice$outboundSchema), ).optional(), quantity: z.nullable( z.lazy(() => OrderCostPreviewResponseQuantity$outboundSchema), ).optional(), responseGenerationTime: z.nullable(z.date().transform(v => v.toISOString())) .optional(), }).transform((v) => { return remap$(v, { accountId: "account_id", assetId: "asset_id", assetType: "asset_type", brokerCapacity: "broker_capacity", estimatedAccruedInterest: "estimated_accrued_interest", estimatedGrossAmount: "estimated_gross_amount", estimatedGrossCreditAmount: "estimated_gross_credit_amount", estimatedNetAmount: "estimated_net_amount", identifierType: "identifier_type", limitPrice: "limit_price", responseGenerationTime: "response_generation_time", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace OrderCostPreviewResponse$ { /** @deprecated use `OrderCostPreviewResponse$inboundSchema` instead. */ export const inboundSchema = OrderCostPreviewResponse$inboundSchema; /** @deprecated use `OrderCostPreviewResponse$outboundSchema` instead. */ export const outboundSchema = OrderCostPreviewResponse$outboundSchema; /** @deprecated use `OrderCostPreviewResponse$Outbound` instead. */ export type Outbound = OrderCostPreviewResponse$Outbound; } export function orderCostPreviewResponseToJSON( orderCostPreviewResponse: OrderCostPreviewResponse, ): string { return JSON.stringify( OrderCostPreviewResponse$outboundSchema.parse(orderCostPreviewResponse), ); } export function orderCostPreviewResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OrderCostPreviewResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OrderCostPreviewResponse' from JSON`, ); }