import type * as Whop from "../index.js"; export interface Trade { /** The account that owns the trading wallet, prefixed `biz_`. `null` when a user owns it. */ account_id: string | null; /** The USDT0 that a deposit, or an order short of trading balance, sends from the wallet, or the USDC that a withdraw sends back, in native units, as a decimal string. A withdraw of `all` shows what it sent once it finishes. `null` otherwise. */ amount: string | null; /** The average fill price of the order, in USD, as a decimal string. `null` when it is not known. */ average_price: string | null; /** The caller's own ID for the trade, unique for the account. `null` when none was sent. */ client_order_id: string | null; /** When the trade ended as completed or failed, as an ISO 8601 timestamp. `null` before that. */ completed_at: string | null; /** When the trade was created, as an ISO 8601 timestamp. */ created_at: string; /** Why the trade failed, or `null`. */ failure_code: Trade.FailureCode | null; /** The size the order filled, in units of the market, as a decimal string. `null` until it fills. */ filled_size: string | null; /** Where the money is when the trade did not complete as asked: `wallet`, `trading_account`, or `unknown` while a person checks it. `null` otherwise. */ funds_location: Trade.FundsLocation | null; /** Trade ID, prefixed `tint_`. */ id: string; /** `perpetual` or `spot` for an order, `perpetual` for a close. `null` for a deposit or withdraw. */ instrument_type: Trade.InstrumentType | null; /** The cross leverage set before an opening perpetual order. `null` for a spot order, close, deposit, withdraw or reduce-only order. */ leverage: number | null; /** The market, for example `BTC` for a perpetual or `HYPE/USDC` for spot. `null` for a deposit or withdraw. */ market: string | null; /** Free-form string-to-string annotations stored on the trade. */ metadata: Record; object: Trade.Object_; /** `market` or `limit` for an order. `null` otherwise. */ order_type: Trade.OrderType | null; /** The limit price of the order in USD. A market order's price is the mid price moved by `slippage_bps`. `null` for other types. */ price: Whop.Money | null; /** Whether the order can only reduce a position. `null` for other types. */ reduce_only: boolean | null; /** `buy` or `sell` for an order. `null` otherwise. */ side: Trade.Side | null; /** The order size in units of the market, as a decimal string. `null` for other types. */ size: string | null; /** `pending` until the trade starts. `processing` while it runs, also while an order that did not fill sends the money it bridged in back to the wallet. `completed` when it did what was asked. `failed` when it did not; `funds_location` says where the money is. `in_review` when the outcome is unknown and a person checks it. */ status: Trade.Status; /** `partial_fill` when the order filled only part of its size. `null` otherwise. */ status_detail: Trade.StatusDetail | null; /** `order` places one order from the trading balance. `deposit` bridges USDT0 from the wallet to the trading balance. `withdraw` sends USDC from the trading balance back to the wallet. `close` closes the whole position in one market with a market reduce-only order; when the account is then flat, a `withdraw` trade sends the trading balance back to the wallet. */ type: Trade.Type; /** When the trade last changed, as an ISO 8601 timestamp. */ updated_at: string; /** The user who owns the trading wallet, prefixed `user_`. `null` when an account owns it. */ user_id: string | null; } export declare namespace Trade { /** Why the trade failed, or `null`. */ const FailureCode: { readonly MarketUnavailable: "market_unavailable"; readonly LeverageTooHigh: "leverage_too_high"; readonly AmountTooSmall: "amount_too_small"; readonly IsolatedPositionOpen: "isolated_position_open"; readonly TradingPaused: "trading_paused"; readonly FundingFailed: "funding_failed"; readonly MarginUnavailable: "margin_unavailable"; readonly BuilderFeeUnapproved: "builder_fee_unapproved"; readonly LeverageRejected: "leverage_rejected"; readonly LeverageUnconfirmed: "leverage_unconfirmed"; readonly OrderRejected: "order_rejected"; readonly CloseRejected: "close_rejected"; readonly ReturnFailed: "return_failed"; readonly WithdrawFailed: "withdraw_failed"; }; type FailureCode = (typeof FailureCode)[keyof typeof FailureCode]; /** Where the money is when the trade did not complete as asked: `wallet`, `trading_account`, or `unknown` while a person checks it. `null` otherwise. */ const FundsLocation: { readonly Wallet: "wallet"; readonly TradingAccount: "trading_account"; readonly Unknown: "unknown"; }; type FundsLocation = (typeof FundsLocation)[keyof typeof FundsLocation]; /** `perpetual` or `spot` for an order, `perpetual` for a close. `null` for a deposit or withdraw. */ const InstrumentType: { readonly Perpetual: "perpetual"; readonly Spot: "spot"; }; type InstrumentType = (typeof InstrumentType)[keyof typeof InstrumentType]; const Object_: { readonly Trade: "trade"; }; type Object_ = (typeof Object_)[keyof typeof Object_]; /** `market` or `limit` for an order. `null` otherwise. */ const OrderType: { readonly Market: "market"; readonly Limit: "limit"; }; type OrderType = (typeof OrderType)[keyof typeof OrderType]; /** `buy` or `sell` for an order. `null` otherwise. */ const Side: { readonly Buy: "buy"; readonly Sell: "sell"; }; type Side = (typeof Side)[keyof typeof Side]; /** `pending` until the trade starts. `processing` while it runs, also while an order that did not fill sends the money it bridged in back to the wallet. `completed` when it did what was asked. `failed` when it did not; `funds_location` says where the money is. `in_review` when the outcome is unknown and a person checks it. */ const Status: { readonly Pending: "pending"; readonly Processing: "processing"; readonly InReview: "in_review"; readonly Completed: "completed"; readonly Failed: "failed"; }; type Status = (typeof Status)[keyof typeof Status]; /** `partial_fill` when the order filled only part of its size. `null` otherwise. */ const StatusDetail: { readonly PartialFill: "partial_fill"; }; type StatusDetail = (typeof StatusDetail)[keyof typeof StatusDetail]; /** `order` places one order from the trading balance. `deposit` bridges USDT0 from the wallet to the trading balance. `withdraw` sends USDC from the trading balance back to the wallet. `close` closes the whole position in one market with a market reduce-only order; when the account is then flat, a `withdraw` trade sends the trading balance back to the wallet. */ const Type: { readonly Close: "close"; readonly Order: "order"; readonly Deposit: "deposit"; readonly Withdraw: "withdraw"; }; type Type = (typeof Type)[keyof typeof Type]; }