Skip to content

Data Models Reference

FiveTwenty uses Pydantic models to validate request data and parse API responses. Use this reference to find a model, inspect its fields and look up related enums. The features available to a request still depend on the endpoint and OANDA account.

Reading model tables

Tables list Python attribute names, such as closeout_bid. When the SDK sends data to OANDA, it uses API field names such as closeoutBid. Financial attributes use Decimal, and timestamps use Python datetime objects. Fields declared with enum types can hold the enum's string value, such as "MARKET".

You can edit model attributes, and assignments are validated. To apply a change to your account, send it through the appropriate endpoint method; editing a Python object only changes local data.

The Required column tells you which fields you must supply when constructing the model. Defaults and optional fields describe the Python model; a particular API response may omit those fields. Follow the source links for full definitions and validation rules.


Model Categories

Models and enums are organized by resource below.

Enum Models

Enumerations & Constants →

Enums provide names for known API values. Check your account's instrument list and the endpoint requirements before choosing values for a request.

Enum Purpose
Core Trading
InstrumentName Named trading instruments (EUR_USD, GBP_JPY, etc.)
Direction Trade direction (LONG, SHORT)
Currency ISO 4217 currency codes (USD, EUR, GBP, etc.)
InstrumentType Instrument classification (CURRENCY, CFD, METAL)
TransactionType Transaction categories (ORDER_FILL, DAILY_FINANCING, etc.)
Price & Market Data
CandlestickGranularity Time intervals for candlestick data (M1, H1, D, etc.)
PriceStatus Price data status (tradeable, non-tradeable, invalid)
WeeklyAlignment Day of week for weekly candlestick alignment
DayOfWeek Days of the week enumeration
Order Management
OrderType Order types (MARKET, LIMIT, STOP, etc.)
OrderState Order lifecycle state (PENDING, FILLED, CANCELLED)
TimeInForce Order duration policies (GTC, GTD, GFD, FOK, IOC)
OrderPositionFill Position modification behavior for orders
OrderTriggerCondition Price trigger conditions (DEFAULT, BID, ASK, MID)
OrderStateFilter Filter for querying orders by state
CancellableOrderType Types of orders that can be cancelled
Account & Position
AccountFinancingMode Account financing calculation modes
PositionAggregationMode Position aggregation methods
GuaranteedStopLossOrderMode GSL order availability for accounts
GuaranteedStopLossOrderModeForInstrument GSL order availability for instruments
Trade Filtering
TradeState Trade lifecycle state (OPEN, CLOSED, CLOSE_WHEN_TRADEABLE)
TradeStateFilter Filter for querying trades by state

Account Models

Account Management →

Models for account information, balance tracking, and account state management.

Model Purpose
Account Complete account information including balance, margin, and trading statistics
AccountSummary Condensed account information for quick overview and monitoring
AccountProperties Basic account identification and classification information
AccountChanges Track changes to orders, trades, and positions since a transaction ID
AccountChangesState Price-dependent account state for real-time monitoring
CalculatedAccountState Dynamically calculated account state including margin calculations
GuaranteedStopLossOrderParameters Configuration settings for guaranteed stop loss order behavior

Trading Models

Trade & Position Management →

Models for trade lifecycle, position management, and P&L tracking.

Model Purpose
Trade Individual trade record, including open or closed state
TradeSummary Condensed trade information for lists and overviews
TradeSpecifier Trade identification format for API requests
CalculatedTradeState Dynamic trade state with real-time P&L calculations
Position Aggregated position information for an instrument
PositionSide One side (long or short) of a position with detailed metrics

Order Models

Order Management →

Order creation, management, and execution models.

Model Purpose
MarketOrderRequest Request immediate execution subject to its fill policy and available liquidity
LimitOrderRequest Request to create a limit order for execution at specific price or better
StopOrderRequest Request to create a stop order triggered when price reaches stop level
TakeProfitOrderRequest Request to create a take profit order to close trade at profit target
StopLossOrderRequest Request to create a stop loss order to limit trade losses
TrailingStopLossOrderRequest Request to create a trailing stop loss that follows favorable price movement
MarketIfTouchedOrderRequest Request to create an order that becomes market order when price touched
GuaranteedStopLossOrderRequest Request to create a guaranteed stop loss order with guaranteed execution
TakeProfitOrder Active take profit order attached to a trade for profit realization
StopLossOrder Active stop loss order attached to a trade for loss limitation
TrailingStopLossOrder Active trailing stop that automatically adjusts with favorable price moves
MarketIfTouchedOrder Pending order that triggers market execution when price level touched
FixedPriceOrder System-created order with fixed execution price (typically for dividends)
TakeProfitDetails Configuration details for take profit order creation
StopLossDetails Configuration details for stop loss order creation
TrailingStopLossDetails Configuration details for trailing stop loss order creation
GuaranteedStopLossDetails Configuration details for guaranteed stop loss order creation
ClientExtensions Custom metadata and tags for client-side order tracking

Market Data Models

Pricing & Instruments →

Models for real-time pricing, historical data, and instrument specifications.

Model Purpose
ClientPrice Instrument pricing, liquidity buckets, status and observation time
QuoteHomeConversionFactors Currency conversion factors for calculating quote currency amounts in account home currency
HomeConversions Pre-calculated conversion factors for converting instrument P&L to account home currency
PricingHeartbeat Heartbeat record used to observe price-stream activity
UnitsAvailable Maximum tradeable units available for different order scenarios and position states
PriceBucket Market depth information showing available liquidity at specific price levels
Candlestick Historical OHLC price data with volume for technical analysis and charting
CandlestickData Open, High, Low, Close price values for a specific time period
Instrument Trading instrument specifications including precision, margins, and trading rules
InstrumentCommission Commission structure definition showing costs per trade for specific instruments
FinancingDayOfWeek Daily financing charge configuration specifying rollover costs by day of week

Transaction Models

Transaction History →

Models for transaction tracking, audit trails, and order execution history.

Model Purpose
Transaction Base transaction record providing audit trail for all account activity and state changes
OrderFillTransaction Record of order execution showing trade details, fill price, and resulting position changes
OrderCancelTransaction Record of order cancellation with reason code for audit and debugging purposes
MarketOrderTransaction Record of market order creation request with execution parameters and timing
LimitOrderTransaction Record of limit order creation with price level and conditional execution parameters
StopOrderTransaction Record of stop order creation with trigger price and risk management settings
TakeProfitOrderTransaction Record of take profit order creation for automated profit realization on trades
StopLossOrderTransaction Record of stop loss order creation for automated loss limitation on trades
TrailingStopLossOrderTransaction Record of trailing stop creation with dynamic distance-based profit protection

System Models

System & Utilities →

Models for streaming configuration, error handling, and type aliases.

Model Purpose
StreamingConfiguration Configuration for real-time price streaming including heartbeat and timeout settings
ReconnectionPolicy Reconnection attempt budget and configured delay
ErrorDetails Structured API error information with codes and messages for error handling and debugging
ValidationViolation Field-level validation error details showing rejected values and constraint violations