developers:websocket:messages

This is an old revision of the document!


T4 Protocol Message Reference

This document provides a reference for all messages in the T4 Protocol. The protocol uses Protocol Buffers (protobuf) for message serialization.

All communication in the T4 Protocol is done via a pair of envelope messages: ClientMessage (client to server) and ServerMessage (server to client). These messages encapsulate all other message types using Protocol Buffers' oneof field.

The ClientMessage is sent from the client to the server and can contain any of the following payloads:

Field Type Description
heartbeat Heartbeat A simple heartbeat to maintain connection
login_request LoginRequest Authentication request
market_depth_subscribe MarketDepthSubscribe Request to subscribe to market depth data
market_by_order_subscribe MarketByOrderSubscribe Request to subscribe to market by order data
account_subscribe AccountSubscribe Request to subscribe to account data
order_submit OrderSubmit Submit a new order
order_revise OrderRevise Modify an existing order
order_pull OrderPull Cancel an existing order
create_uds CreateUDS Create a user-defined strategy

The ServerMessage is sent from the server to the client and can contain any of the following payloads:

Field Type Description
heartbeat Heartbeat A simple heartbeat to maintain connection
login_response LoginResponse Authentication response
market_depth_subscribe_reject MarketDepthSubscribeReject Rejection of market depth subscription
market_by_order_subscribe_reject MarketByOrderSubscribeReject Rejection of market by order subscription
market_details MarketDetails Details about a market
market_depth MarketDepth Market depth data
market_depth_trade MarketDepthTrade Trade data for a market
market_high_low MarketHighLow High/low prices for a market
market_price_limits MarketPriceLimits Price limits for a market
market_settlement MarketSettlement Settlement data for a market
market_snapshot MarketSnapshot Complete snapshot of a market
market_by_order_snapshot MarketByOrderSnapshot Complete snapshot of order book
market_by_order_update MarketByOrderUpdate Update to the order book
account_subscribe_response AccountSubscribeResponse Response to account subscription
account_currency AccountCurrency Account currency information
account_position AccountPosition Position data for an account
account_update AccountUpdate Update to account data
account_details AccountDetails Detailed account information
account_snapshot AccountSnapshot Complete snapshot of account data
order_update OrderUpdate Update to an order
order_update_multi OrderUpdateMulti Multiple order updates
order_update_failed OrderUpdateFailed Failed order update
order_update_status OrderUpdateStatus Order status update
order_update_trade OrderUpdateTrade Trade update for an order
order_update_trade_leg OrderUpdateTradeLeg Trade leg update for a complex order
create_uds_response CreateUDSResponse Response to user-defined strategy creation

The Heartbeat message is used to maintain an active connection between client and server.

Field Type Description
timestamp int64 UTC timestamp in milliseconds

The LoginRequest message is used to authenticate with the server. It supports either API key authentication or username/password authentication.

Field Type Description
api_key string API key for authentication (if used, this is the only required field)
firm string Firm name/identifier for username/password authentication
username string Username for authentication
password string Password for authentication
app_name string Application name
app_license string Application license key

The LoginResponse message is the server's response to a login request.

Field Type Description
result LoginResult Result of the login attempt
session_id string Session identifier for the authenticated session
user_id string User identifier
firm_id string Firm identifier
roles repeated string List of roles the user has
error_message string Error message if login failed
exchanges repeated Exchange List of exchanges the user has access to
accounts repeated Account List of accounts the user has access to

The Exchange message inside LoginResponse contains details about an exchange the user has access to.

Field Type Description
exchange_id string Exchange identifier
user_id string User identifier for this exchange
market_data_type MarketDataType Type of market data available
has_executing_account bool Whether the user has an executing account on this exchange
primary_user_id string Primary user identifier
secondary_user_id string Secondary user identifier
location string Location identifier
smp_id string SMP identifier
extra_detail map<string, string> Additional exchange-specific details

The Account message inside LoginResponse contains details about an account the user has access to.

Field Type Description
account_id string Account identifier
account_number string Account number
account_name string Account name
display_name string Display name for the account
mode AccountMode Account mode

The MarketDepthSubscribe message is used to subscribe to market depth data for a specific market.

Field Type Description
exchange_id string Exchange identifier
contract_id string Contract identifier
market_id string Market identifier
buffer DepthBuffer Type of depth buffer to subscribe to
depth_levels DepthLevels Number of depth levels to receive

The MarketDepthSubscribeReject message is sent when a market depth subscription request is rejected.

Field Type Description
market_id string Market identifier
time google.protobuf.Timestamp Time of rejection
mode MarketMode Current market mode

The MarketByOrderSubscribe message is used to subscribe to market-by-order data for a specific market.

Field Type Description
exchange_id string Exchange identifier
contract_id string Contract identifier
market_id string Market identifier
subscribe bool Whether to subscribe (true) or unsubscribe (false)

The MarketByOrderSubscribeReject message is sent when a market-by-order subscription request is rejected.

Field Type Description
market_id string Market identifier
time google.protobuf.Timestamp Time of rejection
mode MarketMode Current market mode

The MarketDetails message contains detailed information about a specific market.

Field Type Description
market_id string Market identifier
exchange_id string Exchange identifier
contract_id string Contract identifier
expiry_date int32 Expiry date of the contract
contract_type ContractType Type of contract
decimals int32 Number of decimal places in prices
point_value Decimal Value of one price point
min_price_increment Price Minimum price increment
order_types int32 Bitfield of supported order types
activation_date google.protobuf.Timestamp Activation date of the market
last_trading_date google.protobuf.Timestamp Last trading date of the market
last_client_update_time google.protobuf.Timestamp Time of last client update
delist_date int64 Date when market will be delisted
exchange_delist_date int64 Exchange's delist date for the market
market_ref string Market reference
group string Market group
legs repeated LegItem Market legs (for multi-leg markets)
details string Additional market details
strategy_type StrategyType Type of strategy (for multi-leg markets)
price_code string Price code
real_decimals int32 Actual number of decimal places
display_decimals int32 Number of decimal places to display
clearing_decimals int32 Number of decimal places for clearing
min_cab_price Price Minimum cabinet price
strike_price Price Strike price (for options)
volume_increment int32 Volume increment
strategy_ratio double Strategy ratio
disabled bool Whether the market is disabled
underlying_market_id string Identifier of the underlying market
vtt string Variance Time Trading identifier
maint_intra_margin double Maintenance intraday margin
maint_margin double Maintenance margin
maint_vol_scan double Maintenance volume scan

The LegItem message is a component of MarketDetails and describes a leg in a multi-leg market.

Field Type Description
market_id string Market identifier of the leg
group int32 Group identifier
volume int32 Volume/ratio of the leg
delta string Delta value
price Price Price of the leg

The MarketDepth message contains market depth information for a specific market.

Field Type Description
market_id string Market identifier
depth_levels DepthLevels Number of depth levels provided
depth_buffer DepthBuffer Type of depth buffer
time google.protobuf.Timestamp Time of the update
delayed bool Whether the data is delayed
bids repeated DepthLine Bid depth levels
offers repeated DepthLine Offer depth levels
implied_bids repeated DepthLine Implied bid depth levels
implied_offers repeated DepthLine Implied offer depth levels
mode MarketMode Current market mode
flags MarketFlags2 Market flags
trade_data TradeData Trade data

The DepthLine message is a component of MarketDepth and describes a single depth level.

Field Type Description
price Price Price at this depth level
volume int32 Volume available at this depth level
num_orders int32 Number of orders at this depth level

The TradeData message is a component of MarketDepth and contains trade information.

Field Type Description
total_traded_volume int32 Total traded volume
total_trade_count int32 Total number of trades
last_trade_price Price Price of the last trade
last_trade_volume int32 Volume of the last trade
last_trade_total_volume int32 Cumulative volume of the last trade
last_trade_spd_price Price Price of the last spread trade
last_trade_spd_volume int32 Volume of the last spread trade
last_trade_spd_total_volume int32 Cumulative volume of the last spread trade
due_to_spread bool Whether the trade was due to a spread
at_bid_or_offer BidOffer Whether the trade was at the bid or offer
time google.protobuf.Timestamp Time of the trade

The MarketDepthTrade message contains information about a trade in a specific market.

Field Type Description
market_id string Market identifier
time google.protobuf.Timestamp Time of the trade
total_traded_volume int32 Total traded volume
last_trade_volume int32 Volume of the last trade
due_to_spread bool Whether the trade was due to a spread
at_bid_or_offer BidOffer Whether the trade was at the bid or offer
delayed bool Whether the data is delayed
order_volumes repeated int32 Volumes of individual orders in the trade
total_trade_count int32 Total number of trades
last_trade_price Price Price of the last trade
mode MarketMode Current market mode

The MarketHighLow message contains high/low price information for a specific market.

Field Type Description
market_id string Market identifier
open_price Price Opening price
high_price Price Highest price
low_price Price Lowest price
trade_date int64 Trade date
time google.protobuf.Timestamp Time of the update
delayed bool Whether the data is delayed

The MarketPriceLimits message contains price limit information for a specific market.

Field Type Description
market_id string Market identifier
high_price Price Upper price limit
low_price Price Lower price limit
time google.protobuf.Timestamp Time of the update
delayed bool Whether the data is delayed

The MarketSettlement message contains settlement information for a specific market.

Field Type Description
exchange_id string Exchange identifier
market_id string Market identifier
delayed bool Whether the data is delayed
settlement_price Price Settlement price
settlement_time google.protobuf.Timestamp Time of settlement
settlement_trade_date google.protobuf.Timestamp Trade date of settlement
settlement_held_price string Held settlement price
settlement_held_time google.protobuf.Timestamp Time of held settlement
settlement_held_trade_date google.protobuf.Timestamp Trade date of held settlement
implied_price Price Implied price
implied_held_price Price Held implied price
implied_time google.protobuf.Timestamp Time of implied price
open_interest int32 Open interest
open_interest_time google.protobuf.Timestamp Time of open interest update
open_interest_trade_date google.protobuf.Timestamp Trade date of open interest
cleared_volume int32 Cleared volume
cleared_volume_time google.protobuf.Timestamp Time of cleared volume update
cleared_volume_trade_date google.protobuf.Timestamp Trade date of cleared volume
vwap_price Price Volume-weighted average price
vwap_time google.protobuf.Timestamp Time of VWAP update
vwap_trade_date google.protobuf.Timestamp Trade date of VWAP

The MarketSnapshotMessage message is a container for different types of market update messages.

Field Type Description
payload oneof One of the following message types: MarketDepth, MarketDepthTrade, MarketHighLow, MarketPriceLimits, MarketSettlement

The MarketSnapshot message contains a complete snapshot of a market's state.

Field Type Description
market_id string Market identifier
mode MarketMode Current market mode
due_to_connection bool Whether the snapshot is due to a new connection
delayed bool Whether the data is delayed
messages repeated MarketSnapshotMessage Market update messages

The MarketByOrderSnapshot message contains a complete snapshot of a market's order book.

Field Type Description
market_id string Market identifier
time google.protobuf.Timestamp Time of the snapshot
mode MarketMode Current market mode
last_sequence uint64 Last sequence number
orders repeated Order Orders in the book

The Order message is a component of MarketByOrderSnapshot and describes a single order in the book.

Field Type Description
order_id uint64 Order identifier
bid_offer BidOffer Whether the order is a bid or offer
price Price Price of the order
volume int32 Volume of the order
priority uint64 Priority of the order

The MarketByOrderUpdate message contains updates to a market's order book.

Field Type Description
market_id string Market identifier
time google.protobuf.Timestamp Time of the update
mode MarketMode Current market mode
sequence uint64 Sequence number
updates repeated Update Order updates

The Update message is a component of MarketByOrderUpdate and describes an update to an order in the book.

Field Type Description
update_type UpdateType Type of update
order_id uint64 Order identifier
bid_offer BidOffer Whether the order is a bid or offer
price Price Price of the order
volume int32 Volume of the order
priority uint64 Priority of the order
  • developers/websocket/messages.1742050496.txt.gz
  • Last modified: 2025/03/15 14:54
  • by chad