/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import { CalculateCashBalanceResponseOpenOrderSummary, CalculateCashBalanceResponseOpenOrderSummary$inboundSchema, CalculateCashBalanceResponseOpenOrderSummary$Outbound, CalculateCashBalanceResponseOpenOrderSummary$outboundSchema, } from "./calculatecashbalanceresponseopenordersummary.js"; import { CalculateCashBalanceResponseTradeSummary, CalculateCashBalanceResponseTradeSummary$inboundSchema, CalculateCashBalanceResponseTradeSummary$Outbound, CalculateCashBalanceResponseTradeSummary$outboundSchema, } from "./calculatecashbalanceresponsetradesummary.js"; import { CalculateCashBalanceResponseTransferSummary, CalculateCashBalanceResponseTransferSummary$inboundSchema, CalculateCashBalanceResponseTransferSummary$Outbound, CalculateCashBalanceResponseTransferSummary$outboundSchema, } from "./calculatecashbalanceresponsetransfersummary.js"; /** * The account's available cash to withdraw in USD. It is calculated based on the `open_balance_amount` and account activity. This value is always non-negative. If `unadjusted_available_cash_to_withdraw_amount` is negative, this value will be `0`. */ export type AvailableCashToWithdrawAmount = { /** * 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 account's available liquidity in USD including the value of cash and equity positions. It is calculated based on the `open_liquidity_amount` and account activity. This value can be negative. */ export type AvailableLiquidityAmount = { /** * 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 account's fully paid unsettled funds in USD. Fully paid unsettled funds are proceeds from sales of assets paid for with cash and not bought on margin. If `include_fully_paid_unsettled_funds` is `false`, this value is **subtracted** from `open_balance_amount` and `open_liquidity_amount` to calculate `available_cash_to_withdraw_amount` and `available_liquidity_amount`. This value is always non-negative. */ export type FullyPaidUnsettledFundsAmount = { /** * 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 account's starting cash balance for the day in USD as calculated by the margin system. It is used as the base to calculate `available_cash_to_withdraw_amount`. This value is always non-negative. */ export type OpenBalanceAmount = { /** * 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 account's starting liquidity for the day in USD as calculated by the margin system. It includes the value of all asset positions (e.g. cash, equities, fixed income, etc). It is used as the base to calculate `available_liquidity_amount`. This value can be negative. */ export type OpenLiquidityAmount = { /** * 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 account's pending debit dividends in USD. The value is **subtracted** from `open_balance_amount` and `open_liquidity_amount` to calculate `available_cash_to_withdraw_amount` and `available_liquidity_amount`. This value is always non-negative. */ export type PendingDebitDividendsAmount = { /** * 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 account's pending debit interest in USD. The value is **subtracted** from `open_balance_amount` and `open_liquidity_amount` to calculate `available_cash_to_withdraw_amount` and `available_liquidity_amount`. This value is always non-negative. */ export type PendingDebitInterestAmount = { /** * 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 account's total settled balance in USD. Net balance of settled cash and settled cash equivalents This value can be positive or negative. */ export type SettledCashAvailableToWithdraw = { /** * 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 account's total trade balance in USD. Real Time net balance of cash and cash equivalents in the investor account, inclusive of current day activity. This value can be positive or negative. */ export type TradeCashAvailableToWithdraw = { /** * 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 account's unadjusted available cash to withdraw in USD. It is calculated based on the `open_balance_amount` and account activity. This value can be negative. */ export type UnadjustedAvailableCashToWithdrawAmount = { /** * 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 account's withheld deposit threshold. Amounts in `withheld_deposits` up to this threshold will be not be subtracted to calculate `available_cash_to_withdraw_amount` and `available_liquidity_amount`. This value is always non-negative. */ export type WithheldDepositThresholdAmount = { /** * 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 cash balance of an account. */ export type CalculateCashBalanceResponse = { /** * The account. */ account?: string | undefined; /** * The account's available cash to withdraw in USD. It is calculated based on the `open_balance_amount` and account activity. This value is always non-negative. If `unadjusted_available_cash_to_withdraw_amount` is negative, this value will be `0`. */ availableCashToWithdrawAmount?: | AvailableCashToWithdrawAmount | null | undefined; /** * The account's available liquidity in USD including the value of cash and equity positions. It is calculated based on the `open_liquidity_amount` and account activity. This value can be negative. */ availableLiquidityAmount?: AvailableLiquidityAmount | null | undefined; /** * The account's fully paid unsettled funds in USD. Fully paid unsettled funds are proceeds from sales of assets paid for with cash and not bought on margin. If `include_fully_paid_unsettled_funds` is `false`, this value is **subtracted** from `open_balance_amount` and `open_liquidity_amount` to calculate `available_cash_to_withdraw_amount` and `available_liquidity_amount`. This value is always non-negative. */ fullyPaidUnsettledFundsAmount?: | FullyPaidUnsettledFundsAmount | null | undefined; /** * Whether fully paid unsettled funds are included in balances. */ includeFullyPaidUnsettledFunds?: boolean | undefined; /** * The account's intraday buy trades. The net amounts are **subtracted** from `open_balance_amount` and `open_liquidity_amount` to calculate `available_cash_to_withdraw_amount` and `available_liquidity_amount`. Since trades have positive amounts, the calculated values will **decrease**. */ intradayBuyTrades?: | Array | undefined; /** * The account's eligible intraday deposits that have posted to the ledger. Intraday deposits may be eligible based on mechanism (e.g. intraday ICT deposits are eligible for ICT withdrawals, but not ACH withdrawals). The amounts are **added** to `open_balance_amount` and `open_liquidity_amount` to calculate `available_cash_to_withdraw_amount` and `available_liquidity_amount`. Since deposits have positive amounts, the calculated values will **increase**. */ intradayDeposits?: | Array | undefined; /** * The account's intraday returns. The amounts are **subtracted** from `open_balance_amount` and `open_liquidity_amount` to calculate `available_cash_to_withdraw_amount` and `available_liquidity_amount`. Returned deposits will **decrease** calculated values because they have positive amounts and returned withdrawals will **increase** calculated values because they have negative amounts. */ intradayReturns?: | Array | undefined; /** * The account's intraday withdrawals that have posted to the ledger. The amounts are **added** to `open_balance_amount` and `open_liquidity_amount` to calculate `available_cash_to_withdraw_amount` and `available_liquidity_amount`. Since withdrawals have negative amounts, the calculated values will **decrease**. */ intradayWithdrawals?: | Array | undefined; /** * The account's starting cash balance for the day in USD as calculated by the margin system. It is used as the base to calculate `available_cash_to_withdraw_amount`. This value is always non-negative. */ openBalanceAmount?: OpenBalanceAmount | null | undefined; /** * The account's open buy orders. The expected notional ceilings are **subtracted** from `open_balance_amount` and `open_liquidity_amount` to calculate `available_cash_to_withdraw_amount` and `available_liquidity_amount`. Since open orders have positive expected notional ceilings, the calculated values will **decrease**. */ openBuyOrders?: | Array | undefined; /** * The account's starting liquidity for the day in USD as calculated by the margin system. It includes the value of all asset positions (e.g. cash, equities, fixed income, etc). It is used as the base to calculate `available_liquidity_amount`. This value can be negative. */ openLiquidityAmount?: OpenLiquidityAmount | null | undefined; /** * The account's pending debit dividends in USD. The value is **subtracted** from `open_balance_amount` and `open_liquidity_amount` to calculate `available_cash_to_withdraw_amount` and `available_liquidity_amount`. This value is always non-negative. */ pendingDebitDividendsAmount?: PendingDebitDividendsAmount | null | undefined; /** * The account's pending debit interest in USD. The value is **subtracted** from `open_balance_amount` and `open_liquidity_amount` to calculate `available_cash_to_withdraw_amount` and `available_liquidity_amount`. This value is always non-negative. */ pendingDebitInterestAmount?: PendingDebitInterestAmount | null | undefined; /** * The account's pending withdrawals. Pending withdrawals may need review and have yet to post to the ledger. The amounts are **added** to `open_balance_amount` and `open_liquidity_amount` to calculate `available_cash_to_withdraw_amount` and `available_liquidity_amount`. Since withdrawals have negative amounts, the calculated values will **decrease**. */ pendingWithdrawals?: | Array | undefined; /** * The account's total settled balance in USD. Net balance of settled cash and settled cash equivalents This value can be positive or negative. */ settledCashAvailableToWithdraw?: | SettledCashAvailableToWithdraw | null | undefined; /** * The account's total trade balance in USD. Real Time net balance of cash and cash equivalents in the investor account, inclusive of current day activity. This value can be positive or negative. */ tradeCashAvailableToWithdraw?: | TradeCashAvailableToWithdraw | null | undefined; /** * The account's unadjusted available cash to withdraw in USD. It is calculated based on the `open_balance_amount` and account activity. This value can be negative. */ unadjustedAvailableCashToWithdrawAmount?: | UnadjustedAvailableCashToWithdrawAmount | null | undefined; /** * The account's withheld deposit threshold. Amounts in `withheld_deposits` up to this threshold will be not be subtracted to calculate `available_cash_to_withdraw_amount` and `available_liquidity_amount`. This value is always non-negative. */ withheldDepositThresholdAmount?: | WithheldDepositThresholdAmount | null | undefined; /** * The account's withheld deposits. Deposits are withheld if there is a risk of a return (e.g. ACH deposits). Typically, they are withheld for 5 business days after completing. The amounts are **subtracted** from `open_balance_amount` and `open_liquidity_amount` to calculate `available_cash_to_withdraw_amount` and `available_liquidity_amount`. Since deposits have positive amounts, the calculated values will **decrease**. However, withheld deposits will not be subtracted up to the `withheld_deposit_threshold_amount`. */ withheldDeposits?: | Array | undefined; }; /** @internal */ export const AvailableCashToWithdrawAmount$inboundSchema: z.ZodType< AvailableCashToWithdrawAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type AvailableCashToWithdrawAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const AvailableCashToWithdrawAmount$outboundSchema: z.ZodType< AvailableCashToWithdrawAmount$Outbound, z.ZodTypeDef, AvailableCashToWithdrawAmount > = 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 AvailableCashToWithdrawAmount$ { /** @deprecated use `AvailableCashToWithdrawAmount$inboundSchema` instead. */ export const inboundSchema = AvailableCashToWithdrawAmount$inboundSchema; /** @deprecated use `AvailableCashToWithdrawAmount$outboundSchema` instead. */ export const outboundSchema = AvailableCashToWithdrawAmount$outboundSchema; /** @deprecated use `AvailableCashToWithdrawAmount$Outbound` instead. */ export type Outbound = AvailableCashToWithdrawAmount$Outbound; } export function availableCashToWithdrawAmountToJSON( availableCashToWithdrawAmount: AvailableCashToWithdrawAmount, ): string { return JSON.stringify( AvailableCashToWithdrawAmount$outboundSchema.parse( availableCashToWithdrawAmount, ), ); } export function availableCashToWithdrawAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AvailableCashToWithdrawAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AvailableCashToWithdrawAmount' from JSON`, ); } /** @internal */ export const AvailableLiquidityAmount$inboundSchema: z.ZodType< AvailableLiquidityAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type AvailableLiquidityAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const AvailableLiquidityAmount$outboundSchema: z.ZodType< AvailableLiquidityAmount$Outbound, z.ZodTypeDef, AvailableLiquidityAmount > = 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 AvailableLiquidityAmount$ { /** @deprecated use `AvailableLiquidityAmount$inboundSchema` instead. */ export const inboundSchema = AvailableLiquidityAmount$inboundSchema; /** @deprecated use `AvailableLiquidityAmount$outboundSchema` instead. */ export const outboundSchema = AvailableLiquidityAmount$outboundSchema; /** @deprecated use `AvailableLiquidityAmount$Outbound` instead. */ export type Outbound = AvailableLiquidityAmount$Outbound; } export function availableLiquidityAmountToJSON( availableLiquidityAmount: AvailableLiquidityAmount, ): string { return JSON.stringify( AvailableLiquidityAmount$outboundSchema.parse(availableLiquidityAmount), ); } export function availableLiquidityAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => AvailableLiquidityAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AvailableLiquidityAmount' from JSON`, ); } /** @internal */ export const FullyPaidUnsettledFundsAmount$inboundSchema: z.ZodType< FullyPaidUnsettledFundsAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type FullyPaidUnsettledFundsAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const FullyPaidUnsettledFundsAmount$outboundSchema: z.ZodType< FullyPaidUnsettledFundsAmount$Outbound, z.ZodTypeDef, FullyPaidUnsettledFundsAmount > = 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 FullyPaidUnsettledFundsAmount$ { /** @deprecated use `FullyPaidUnsettledFundsAmount$inboundSchema` instead. */ export const inboundSchema = FullyPaidUnsettledFundsAmount$inboundSchema; /** @deprecated use `FullyPaidUnsettledFundsAmount$outboundSchema` instead. */ export const outboundSchema = FullyPaidUnsettledFundsAmount$outboundSchema; /** @deprecated use `FullyPaidUnsettledFundsAmount$Outbound` instead. */ export type Outbound = FullyPaidUnsettledFundsAmount$Outbound; } export function fullyPaidUnsettledFundsAmountToJSON( fullyPaidUnsettledFundsAmount: FullyPaidUnsettledFundsAmount, ): string { return JSON.stringify( FullyPaidUnsettledFundsAmount$outboundSchema.parse( fullyPaidUnsettledFundsAmount, ), ); } export function fullyPaidUnsettledFundsAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => FullyPaidUnsettledFundsAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'FullyPaidUnsettledFundsAmount' from JSON`, ); } /** @internal */ export const OpenBalanceAmount$inboundSchema: z.ZodType< OpenBalanceAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type OpenBalanceAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const OpenBalanceAmount$outboundSchema: z.ZodType< OpenBalanceAmount$Outbound, z.ZodTypeDef, OpenBalanceAmount > = 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 OpenBalanceAmount$ { /** @deprecated use `OpenBalanceAmount$inboundSchema` instead. */ export const inboundSchema = OpenBalanceAmount$inboundSchema; /** @deprecated use `OpenBalanceAmount$outboundSchema` instead. */ export const outboundSchema = OpenBalanceAmount$outboundSchema; /** @deprecated use `OpenBalanceAmount$Outbound` instead. */ export type Outbound = OpenBalanceAmount$Outbound; } export function openBalanceAmountToJSON( openBalanceAmount: OpenBalanceAmount, ): string { return JSON.stringify( OpenBalanceAmount$outboundSchema.parse(openBalanceAmount), ); } export function openBalanceAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OpenBalanceAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenBalanceAmount' from JSON`, ); } /** @internal */ export const OpenLiquidityAmount$inboundSchema: z.ZodType< OpenLiquidityAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type OpenLiquidityAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const OpenLiquidityAmount$outboundSchema: z.ZodType< OpenLiquidityAmount$Outbound, z.ZodTypeDef, OpenLiquidityAmount > = 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 OpenLiquidityAmount$ { /** @deprecated use `OpenLiquidityAmount$inboundSchema` instead. */ export const inboundSchema = OpenLiquidityAmount$inboundSchema; /** @deprecated use `OpenLiquidityAmount$outboundSchema` instead. */ export const outboundSchema = OpenLiquidityAmount$outboundSchema; /** @deprecated use `OpenLiquidityAmount$Outbound` instead. */ export type Outbound = OpenLiquidityAmount$Outbound; } export function openLiquidityAmountToJSON( openLiquidityAmount: OpenLiquidityAmount, ): string { return JSON.stringify( OpenLiquidityAmount$outboundSchema.parse(openLiquidityAmount), ); } export function openLiquidityAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => OpenLiquidityAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OpenLiquidityAmount' from JSON`, ); } /** @internal */ export const PendingDebitDividendsAmount$inboundSchema: z.ZodType< PendingDebitDividendsAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type PendingDebitDividendsAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const PendingDebitDividendsAmount$outboundSchema: z.ZodType< PendingDebitDividendsAmount$Outbound, z.ZodTypeDef, PendingDebitDividendsAmount > = 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 PendingDebitDividendsAmount$ { /** @deprecated use `PendingDebitDividendsAmount$inboundSchema` instead. */ export const inboundSchema = PendingDebitDividendsAmount$inboundSchema; /** @deprecated use `PendingDebitDividendsAmount$outboundSchema` instead. */ export const outboundSchema = PendingDebitDividendsAmount$outboundSchema; /** @deprecated use `PendingDebitDividendsAmount$Outbound` instead. */ export type Outbound = PendingDebitDividendsAmount$Outbound; } export function pendingDebitDividendsAmountToJSON( pendingDebitDividendsAmount: PendingDebitDividendsAmount, ): string { return JSON.stringify( PendingDebitDividendsAmount$outboundSchema.parse( pendingDebitDividendsAmount, ), ); } export function pendingDebitDividendsAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PendingDebitDividendsAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PendingDebitDividendsAmount' from JSON`, ); } /** @internal */ export const PendingDebitInterestAmount$inboundSchema: z.ZodType< PendingDebitInterestAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type PendingDebitInterestAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const PendingDebitInterestAmount$outboundSchema: z.ZodType< PendingDebitInterestAmount$Outbound, z.ZodTypeDef, PendingDebitInterestAmount > = 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 PendingDebitInterestAmount$ { /** @deprecated use `PendingDebitInterestAmount$inboundSchema` instead. */ export const inboundSchema = PendingDebitInterestAmount$inboundSchema; /** @deprecated use `PendingDebitInterestAmount$outboundSchema` instead. */ export const outboundSchema = PendingDebitInterestAmount$outboundSchema; /** @deprecated use `PendingDebitInterestAmount$Outbound` instead. */ export type Outbound = PendingDebitInterestAmount$Outbound; } export function pendingDebitInterestAmountToJSON( pendingDebitInterestAmount: PendingDebitInterestAmount, ): string { return JSON.stringify( PendingDebitInterestAmount$outboundSchema.parse(pendingDebitInterestAmount), ); } export function pendingDebitInterestAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PendingDebitInterestAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PendingDebitInterestAmount' from JSON`, ); } /** @internal */ export const SettledCashAvailableToWithdraw$inboundSchema: z.ZodType< SettledCashAvailableToWithdraw, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type SettledCashAvailableToWithdraw$Outbound = { value?: string | undefined; }; /** @internal */ export const SettledCashAvailableToWithdraw$outboundSchema: z.ZodType< SettledCashAvailableToWithdraw$Outbound, z.ZodTypeDef, SettledCashAvailableToWithdraw > = 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 SettledCashAvailableToWithdraw$ { /** @deprecated use `SettledCashAvailableToWithdraw$inboundSchema` instead. */ export const inboundSchema = SettledCashAvailableToWithdraw$inboundSchema; /** @deprecated use `SettledCashAvailableToWithdraw$outboundSchema` instead. */ export const outboundSchema = SettledCashAvailableToWithdraw$outboundSchema; /** @deprecated use `SettledCashAvailableToWithdraw$Outbound` instead. */ export type Outbound = SettledCashAvailableToWithdraw$Outbound; } export function settledCashAvailableToWithdrawToJSON( settledCashAvailableToWithdraw: SettledCashAvailableToWithdraw, ): string { return JSON.stringify( SettledCashAvailableToWithdraw$outboundSchema.parse( settledCashAvailableToWithdraw, ), ); } export function settledCashAvailableToWithdrawFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => SettledCashAvailableToWithdraw$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SettledCashAvailableToWithdraw' from JSON`, ); } /** @internal */ export const TradeCashAvailableToWithdraw$inboundSchema: z.ZodType< TradeCashAvailableToWithdraw, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type TradeCashAvailableToWithdraw$Outbound = { value?: string | undefined; }; /** @internal */ export const TradeCashAvailableToWithdraw$outboundSchema: z.ZodType< TradeCashAvailableToWithdraw$Outbound, z.ZodTypeDef, TradeCashAvailableToWithdraw > = 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 TradeCashAvailableToWithdraw$ { /** @deprecated use `TradeCashAvailableToWithdraw$inboundSchema` instead. */ export const inboundSchema = TradeCashAvailableToWithdraw$inboundSchema; /** @deprecated use `TradeCashAvailableToWithdraw$outboundSchema` instead. */ export const outboundSchema = TradeCashAvailableToWithdraw$outboundSchema; /** @deprecated use `TradeCashAvailableToWithdraw$Outbound` instead. */ export type Outbound = TradeCashAvailableToWithdraw$Outbound; } export function tradeCashAvailableToWithdrawToJSON( tradeCashAvailableToWithdraw: TradeCashAvailableToWithdraw, ): string { return JSON.stringify( TradeCashAvailableToWithdraw$outboundSchema.parse( tradeCashAvailableToWithdraw, ), ); } export function tradeCashAvailableToWithdrawFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TradeCashAvailableToWithdraw$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TradeCashAvailableToWithdraw' from JSON`, ); } /** @internal */ export const UnadjustedAvailableCashToWithdrawAmount$inboundSchema: z.ZodType< UnadjustedAvailableCashToWithdrawAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type UnadjustedAvailableCashToWithdrawAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const UnadjustedAvailableCashToWithdrawAmount$outboundSchema: z.ZodType< UnadjustedAvailableCashToWithdrawAmount$Outbound, z.ZodTypeDef, UnadjustedAvailableCashToWithdrawAmount > = 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 UnadjustedAvailableCashToWithdrawAmount$ { /** @deprecated use `UnadjustedAvailableCashToWithdrawAmount$inboundSchema` instead. */ export const inboundSchema = UnadjustedAvailableCashToWithdrawAmount$inboundSchema; /** @deprecated use `UnadjustedAvailableCashToWithdrawAmount$outboundSchema` instead. */ export const outboundSchema = UnadjustedAvailableCashToWithdrawAmount$outboundSchema; /** @deprecated use `UnadjustedAvailableCashToWithdrawAmount$Outbound` instead. */ export type Outbound = UnadjustedAvailableCashToWithdrawAmount$Outbound; } export function unadjustedAvailableCashToWithdrawAmountToJSON( unadjustedAvailableCashToWithdrawAmount: UnadjustedAvailableCashToWithdrawAmount, ): string { return JSON.stringify( UnadjustedAvailableCashToWithdrawAmount$outboundSchema.parse( unadjustedAvailableCashToWithdrawAmount, ), ); } export function unadjustedAvailableCashToWithdrawAmountFromJSON( jsonString: string, ): SafeParseResult< UnadjustedAvailableCashToWithdrawAmount, SDKValidationError > { return safeParse( jsonString, (x) => UnadjustedAvailableCashToWithdrawAmount$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'UnadjustedAvailableCashToWithdrawAmount' from JSON`, ); } /** @internal */ export const WithheldDepositThresholdAmount$inboundSchema: z.ZodType< WithheldDepositThresholdAmount, z.ZodTypeDef, unknown > = z.object({ value: z.string().optional(), }); /** @internal */ export type WithheldDepositThresholdAmount$Outbound = { value?: string | undefined; }; /** @internal */ export const WithheldDepositThresholdAmount$outboundSchema: z.ZodType< WithheldDepositThresholdAmount$Outbound, z.ZodTypeDef, WithheldDepositThresholdAmount > = 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 WithheldDepositThresholdAmount$ { /** @deprecated use `WithheldDepositThresholdAmount$inboundSchema` instead. */ export const inboundSchema = WithheldDepositThresholdAmount$inboundSchema; /** @deprecated use `WithheldDepositThresholdAmount$outboundSchema` instead. */ export const outboundSchema = WithheldDepositThresholdAmount$outboundSchema; /** @deprecated use `WithheldDepositThresholdAmount$Outbound` instead. */ export type Outbound = WithheldDepositThresholdAmount$Outbound; } export function withheldDepositThresholdAmountToJSON( withheldDepositThresholdAmount: WithheldDepositThresholdAmount, ): string { return JSON.stringify( WithheldDepositThresholdAmount$outboundSchema.parse( withheldDepositThresholdAmount, ), ); } export function withheldDepositThresholdAmountFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WithheldDepositThresholdAmount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WithheldDepositThresholdAmount' from JSON`, ); } /** @internal */ export const CalculateCashBalanceResponse$inboundSchema: z.ZodType< CalculateCashBalanceResponse, z.ZodTypeDef, unknown > = z.object({ account: z.string().optional(), available_cash_to_withdraw_amount: z.nullable( z.lazy(() => AvailableCashToWithdrawAmount$inboundSchema), ).optional(), available_liquidity_amount: z.nullable( z.lazy(() => AvailableLiquidityAmount$inboundSchema), ).optional(), fully_paid_unsettled_funds_amount: z.nullable( z.lazy(() => FullyPaidUnsettledFundsAmount$inboundSchema), ).optional(), include_fully_paid_unsettled_funds: z.boolean().optional(), intraday_buy_trades: z.array( CalculateCashBalanceResponseTradeSummary$inboundSchema, ).optional(), intraday_deposits: z.array( CalculateCashBalanceResponseTransferSummary$inboundSchema, ).optional(), intraday_returns: z.array( CalculateCashBalanceResponseTransferSummary$inboundSchema, ).optional(), intraday_withdrawals: z.array( CalculateCashBalanceResponseTransferSummary$inboundSchema, ).optional(), open_balance_amount: z.nullable(z.lazy(() => OpenBalanceAmount$inboundSchema)) .optional(), open_buy_orders: z.array( CalculateCashBalanceResponseOpenOrderSummary$inboundSchema, ).optional(), open_liquidity_amount: z.nullable( z.lazy(() => OpenLiquidityAmount$inboundSchema), ).optional(), pending_debit_dividends_amount: z.nullable( z.lazy(() => PendingDebitDividendsAmount$inboundSchema), ).optional(), pending_debit_interest_amount: z.nullable( z.lazy(() => PendingDebitInterestAmount$inboundSchema), ).optional(), pending_withdrawals: z.array( CalculateCashBalanceResponseTransferSummary$inboundSchema, ).optional(), settled_cash_available_to_withdraw: z.nullable( z.lazy(() => SettledCashAvailableToWithdraw$inboundSchema), ).optional(), trade_cash_available_to_withdraw: z.nullable( z.lazy(() => TradeCashAvailableToWithdraw$inboundSchema), ).optional(), unadjusted_available_cash_to_withdraw_amount: z.nullable( z.lazy(() => UnadjustedAvailableCashToWithdrawAmount$inboundSchema), ).optional(), withheld_deposit_threshold_amount: z.nullable( z.lazy(() => WithheldDepositThresholdAmount$inboundSchema), ).optional(), withheld_deposits: z.array( CalculateCashBalanceResponseTransferSummary$inboundSchema, ).optional(), }).transform((v) => { return remap$(v, { "available_cash_to_withdraw_amount": "availableCashToWithdrawAmount", "available_liquidity_amount": "availableLiquidityAmount", "fully_paid_unsettled_funds_amount": "fullyPaidUnsettledFundsAmount", "include_fully_paid_unsettled_funds": "includeFullyPaidUnsettledFunds", "intraday_buy_trades": "intradayBuyTrades", "intraday_deposits": "intradayDeposits", "intraday_returns": "intradayReturns", "intraday_withdrawals": "intradayWithdrawals", "open_balance_amount": "openBalanceAmount", "open_buy_orders": "openBuyOrders", "open_liquidity_amount": "openLiquidityAmount", "pending_debit_dividends_amount": "pendingDebitDividendsAmount", "pending_debit_interest_amount": "pendingDebitInterestAmount", "pending_withdrawals": "pendingWithdrawals", "settled_cash_available_to_withdraw": "settledCashAvailableToWithdraw", "trade_cash_available_to_withdraw": "tradeCashAvailableToWithdraw", "unadjusted_available_cash_to_withdraw_amount": "unadjustedAvailableCashToWithdrawAmount", "withheld_deposit_threshold_amount": "withheldDepositThresholdAmount", "withheld_deposits": "withheldDeposits", }); }); /** @internal */ export type CalculateCashBalanceResponse$Outbound = { account?: string | undefined; available_cash_to_withdraw_amount?: | AvailableCashToWithdrawAmount$Outbound | null | undefined; available_liquidity_amount?: | AvailableLiquidityAmount$Outbound | null | undefined; fully_paid_unsettled_funds_amount?: | FullyPaidUnsettledFundsAmount$Outbound | null | undefined; include_fully_paid_unsettled_funds?: boolean | undefined; intraday_buy_trades?: | Array | undefined; intraday_deposits?: | Array | undefined; intraday_returns?: | Array | undefined; intraday_withdrawals?: | Array | undefined; open_balance_amount?: OpenBalanceAmount$Outbound | null | undefined; open_buy_orders?: | Array | undefined; open_liquidity_amount?: OpenLiquidityAmount$Outbound | null | undefined; pending_debit_dividends_amount?: | PendingDebitDividendsAmount$Outbound | null | undefined; pending_debit_interest_amount?: | PendingDebitInterestAmount$Outbound | null | undefined; pending_withdrawals?: | Array | undefined; settled_cash_available_to_withdraw?: | SettledCashAvailableToWithdraw$Outbound | null | undefined; trade_cash_available_to_withdraw?: | TradeCashAvailableToWithdraw$Outbound | null | undefined; unadjusted_available_cash_to_withdraw_amount?: | UnadjustedAvailableCashToWithdrawAmount$Outbound | null | undefined; withheld_deposit_threshold_amount?: | WithheldDepositThresholdAmount$Outbound | null | undefined; withheld_deposits?: | Array | undefined; }; /** @internal */ export const CalculateCashBalanceResponse$outboundSchema: z.ZodType< CalculateCashBalanceResponse$Outbound, z.ZodTypeDef, CalculateCashBalanceResponse > = z.object({ account: z.string().optional(), availableCashToWithdrawAmount: z.nullable( z.lazy(() => AvailableCashToWithdrawAmount$outboundSchema), ).optional(), availableLiquidityAmount: z.nullable( z.lazy(() => AvailableLiquidityAmount$outboundSchema), ).optional(), fullyPaidUnsettledFundsAmount: z.nullable( z.lazy(() => FullyPaidUnsettledFundsAmount$outboundSchema), ).optional(), includeFullyPaidUnsettledFunds: z.boolean().optional(), intradayBuyTrades: z.array( CalculateCashBalanceResponseTradeSummary$outboundSchema, ).optional(), intradayDeposits: z.array( CalculateCashBalanceResponseTransferSummary$outboundSchema, ).optional(), intradayReturns: z.array( CalculateCashBalanceResponseTransferSummary$outboundSchema, ).optional(), intradayWithdrawals: z.array( CalculateCashBalanceResponseTransferSummary$outboundSchema, ).optional(), openBalanceAmount: z.nullable(z.lazy(() => OpenBalanceAmount$outboundSchema)) .optional(), openBuyOrders: z.array( CalculateCashBalanceResponseOpenOrderSummary$outboundSchema, ).optional(), openLiquidityAmount: z.nullable( z.lazy(() => OpenLiquidityAmount$outboundSchema), ).optional(), pendingDebitDividendsAmount: z.nullable( z.lazy(() => PendingDebitDividendsAmount$outboundSchema), ).optional(), pendingDebitInterestAmount: z.nullable( z.lazy(() => PendingDebitInterestAmount$outboundSchema), ).optional(), pendingWithdrawals: z.array( CalculateCashBalanceResponseTransferSummary$outboundSchema, ).optional(), settledCashAvailableToWithdraw: z.nullable( z.lazy(() => SettledCashAvailableToWithdraw$outboundSchema), ).optional(), tradeCashAvailableToWithdraw: z.nullable( z.lazy(() => TradeCashAvailableToWithdraw$outboundSchema), ).optional(), unadjustedAvailableCashToWithdrawAmount: z.nullable( z.lazy(() => UnadjustedAvailableCashToWithdrawAmount$outboundSchema), ).optional(), withheldDepositThresholdAmount: z.nullable( z.lazy(() => WithheldDepositThresholdAmount$outboundSchema), ).optional(), withheldDeposits: z.array( CalculateCashBalanceResponseTransferSummary$outboundSchema, ).optional(), }).transform((v) => { return remap$(v, { availableCashToWithdrawAmount: "available_cash_to_withdraw_amount", availableLiquidityAmount: "available_liquidity_amount", fullyPaidUnsettledFundsAmount: "fully_paid_unsettled_funds_amount", includeFullyPaidUnsettledFunds: "include_fully_paid_unsettled_funds", intradayBuyTrades: "intraday_buy_trades", intradayDeposits: "intraday_deposits", intradayReturns: "intraday_returns", intradayWithdrawals: "intraday_withdrawals", openBalanceAmount: "open_balance_amount", openBuyOrders: "open_buy_orders", openLiquidityAmount: "open_liquidity_amount", pendingDebitDividendsAmount: "pending_debit_dividends_amount", pendingDebitInterestAmount: "pending_debit_interest_amount", pendingWithdrawals: "pending_withdrawals", settledCashAvailableToWithdraw: "settled_cash_available_to_withdraw", tradeCashAvailableToWithdraw: "trade_cash_available_to_withdraw", unadjustedAvailableCashToWithdrawAmount: "unadjusted_available_cash_to_withdraw_amount", withheldDepositThresholdAmount: "withheld_deposit_threshold_amount", withheldDeposits: "withheld_deposits", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CalculateCashBalanceResponse$ { /** @deprecated use `CalculateCashBalanceResponse$inboundSchema` instead. */ export const inboundSchema = CalculateCashBalanceResponse$inboundSchema; /** @deprecated use `CalculateCashBalanceResponse$outboundSchema` instead. */ export const outboundSchema = CalculateCashBalanceResponse$outboundSchema; /** @deprecated use `CalculateCashBalanceResponse$Outbound` instead. */ export type Outbound = CalculateCashBalanceResponse$Outbound; } export function calculateCashBalanceResponseToJSON( calculateCashBalanceResponse: CalculateCashBalanceResponse, ): string { return JSON.stringify( CalculateCashBalanceResponse$outboundSchema.parse( calculateCashBalanceResponse, ), ); } export function calculateCashBalanceResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CalculateCashBalanceResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CalculateCashBalanceResponse' from JSON`, ); }