Data Models Reference¶
Complete API reference for FiveTwenty's comprehensive data model system, covering all OANDA v20 API data structures.
Model Categories¶
FiveTwenty provides 80+ comprehensive data models organized into logical categories:
Enum Models¶
Type-safe enumerations for all OANDA API parameters and values.
| Enum | Purpose |
|---|---|
| Core Trading | |
| InstrumentName | Available trading instrument pairs (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¶
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¶
Models for trade lifecycle, position management, and P&L tracking.
| Model | Purpose |
|---|---|
| Trade | Represents an open trade position with full lifecycle details |
| 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¶
Comprehensive order creation, management, and execution models.
| Model | Purpose |
|---|---|
| MarketOrderRequest | Request to create a market order for immediate execution at current market price |
| 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¶
Models for real-time pricing, historical data, and instrument specifications.
| Model | Purpose |
|---|---|
| ClientPrice | Real-time tradeable prices with bid/ask spreads and closeout rates for immediate trading decisions |
| 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 | Streaming heartbeat message to confirm active price stream connection and prevent timeouts |
| 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¶
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¶
Models for streaming configuration, error handling, and type aliases.
| Model | Purpose |
|---|---|
| StreamingConfiguration | Configuration for real-time price streaming including heartbeat and timeout settings |
| ReconnectionPolicy | Automated reconnection strategy with exponential backoff for resilient streaming connections |
| 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 |