syntax = "proto3";

package DTC_PB;

//============================================================================
// DTC protocol version
enum DTCVersion 
{
    DTC_VERSION_UNSET = 0;
	CURRENT_VERSION = 8;
}


//============================================================================
// All messages are preceded by the following 4-byte little-endian binary
// header on the wire:
//
//	uint16 Size;  // size of the entire message including this 4-byte header
//	uint16 Type;  // DTC message type - see DTCProtocol.h
//
//
// Note: DateTime fields have three different types based on the field type:
//
// * sfixed64 - standard UNIX Date-Time
// * sfixed32 - 4-byte UNIX Date-Time value used in messages where compactness is an important consideration. Or where only the Date is needed.
// * double   - UNIX Date-Time value with fractional portion for milliseconds
//

//============================================================================
//----Message types----

enum DTCMessageType 
{
    MESSAGE_TYPE_UNSET = 0;
    
	// Authentication and connection monitoring
	LOGON_REQUEST = 1;
	LOGON_RESPONSE = 2;
	HEARTBEAT = 3;
	LOGOFF = 5;
	ENCODING_REQUEST = 6;
	ENCODING_RESPONSE = 7;

	// Market data
	MARKET_DATA_REQUEST = 101;
	MARKET_DATA_REJECT = 103;
	MARKET_DATA_SNAPSHOT = 104;
	MARKET_DATA_SNAPSHOT_INT = 125;

	MARKET_DATA_UPDATE_TRADE = 107;
	MARKET_DATA_UPDATE_TRADE_COMPACT = 112;
	MARKET_DATA_UPDATE_TRADE_INT = 126;
	MARKET_DATA_UPDATE_LAST_TRADE_SNAPSHOT = 134;

	MARKET_DATA_UPDATE_BID_ASK = 108;
	MARKET_DATA_UPDATE_BID_ASK_COMPACT = 117;
	MARKET_DATA_UPDATE_BID_ASK_INT = 127;

	MARKET_DATA_UPDATE_SESSION_OPEN = 120;
	MARKET_DATA_UPDATE_SESSION_OPEN_INT = 128;
	MARKET_DATA_UPDATE_SESSION_HIGH = 114;
	MARKET_DATA_UPDATE_SESSION_HIGH_INT = 129;
	MARKET_DATA_UPDATE_SESSION_LOW = 115;
	MARKET_DATA_UPDATE_SESSION_LOW_INT = 130;
	MARKET_DATA_UPDATE_SESSION_VOLUME = 113;
	MARKET_DATA_UPDATE_OPEN_INTEREST = 124;
	MARKET_DATA_UPDATE_SESSION_SETTLEMENT = 119;
	MARKET_DATA_UPDATE_SESSION_SETTLEMENT_INT = 131;
	MARKET_DATA_UPDATE_SESSION_NUM_TRADES = 135;
	MARKET_DATA_UPDATE_TRADING_SESSION_DATE = 136;

	MARKET_DEPTH_REQUEST = 102;
	MARKET_DEPTH_REJECT = 121;
	MARKET_DEPTH_SNAPSHOT_LEVEL = 122;
	MARKET_DEPTH_SNAPSHOT_LEVEL_INT = 132;
	MARKET_DEPTH_UPDATE_LEVEL = 106;
	MARKET_DEPTH_UPDATE_LEVEL_COMPACT = 118;
	MARKET_DEPTH_UPDATE_LEVEL_INT = 133;
	MARKET_DEPTH_FULL_UPDATE_10 = 123;
	MARKET_DEPTH_FULL_UPDATE_20 = 105;

	MARKET_DATA_FEED_STATUS = 100;
	MARKET_DATA_FEED_SYMBOL_STATUS = 116;

	// Order entry and modification
	SUBMIT_NEW_SINGLE_ORDER = 208;
	SUBMIT_NEW_SINGLE_ORDER_INT = 206;

	SUBMIT_NEW_OCO_ORDER = 201;
	SUBMIT_NEW_OCO_ORDER_INT = 207;

	CANCEL_ORDER = 203;

	CANCEL_REPLACE_ORDER = 204;
	CANCEL_REPLACE_ORDER_INT = 205;

	// Trading related
	OPEN_ORDERS_REQUEST = 300;
	OPEN_ORDERS_REJECT = 302;

	ORDER_UPDATE = 301;

	HISTORICAL_ORDER_FILLS_REQUEST = 303;
	HISTORICAL_ORDER_FILL_RESPONSE = 304;
	HISTORICAL_ORDER_FILLS_REJECT = 308;

	CURRENT_POSITIONS_REQUEST = 305;
	CURRENT_POSITIONS_REJECT = 307;
	POSITION_UPDATE = 306;

	// Account list
	TRADE_ACCOUNTS_REQUEST = 400;
	TRADE_ACCOUNT_RESPONSE = 401;

	// Symbol discovery and security definitions
	EXCHANGE_LIST_REQUEST = 500;
	EXCHANGE_LIST_RESPONSE = 501;

	SYMBOLS_FOR_EXCHANGE_REQUEST = 502;
	UNDERLYING_SYMBOLS_FOR_EXCHANGE_REQUEST = 503;
	SYMBOLS_FOR_UNDERLYING_REQUEST = 504;
	SECURITY_DEFINITION_FOR_SYMBOL_REQUEST = 506;
	SECURITY_DEFINITION_RESPONSE = 507;

	SYMBOL_SEARCH_REQUEST = 508;

	SECURITY_DEFINITION_REJECT = 509;

	// Account balance
	ACCOUNT_BALANCE_REQUEST = 601;
	ACCOUNT_BALANCE_REJECT = 602;	
	ACCOUNT_BALANCE_UPDATE = 600;

	// Logging
	USER_MESSAGE = 700;
	GENERAL_LOG_MESSAGE = 701;

	// Historical price data
	HISTORICAL_PRICE_DATA_REQUEST= 800;
	HISTORICAL_PRICE_DATA_RESPONSE_HEADER = 801;
	HISTORICAL_PRICE_DATA_REJECT = 802;
	HISTORICAL_PRICE_DATA_RECORD_RESPONSE = 803;
	HISTORICAL_PRICE_DATA_TICK_RECORD_RESPONSE = 804;
	HISTORICAL_PRICE_DATA_RECORD_RESPONSE_INT = 805;
	HISTORICAL_PRICE_DATA_TICK_RECORD_RESPONSE_INT = 806;
}

//============================================================================
enum EncodingEnum
{
  BINARY_ENCODING = 0;
  BINARY_WITH_VARIABLE_LENGTH_STRINGS = 1;
  JSON_ENCODING = 2;
  JSON_COMPACT_ENCODING = 3;
  PROTOCOL_BUFFERS = 4;
}

//============================================================================
enum LogonStatusEnum 
{
  LOGON_STATUS_UNSET = 0;
  LOGON_SUCCESS = 1;
  LOGON_ERROR = 2;
  LOGON_ERROR_NO_RECONNECT = 3;
  LOGON_RECONNECT_NEW_ADDRESS = 4;
}

//============================================================================
enum MessageSupportedEnum 
{
  MESSAGE_UNSUPPORTED = 0;
  MESSAGE_SUPPORTED = 1;
}

//============================================================================
enum TradeModeEnum 
{
  TRADE_MODE_UNSET= 0;
  TRADE_MODE_DEMO = 1;
  TRADE_MODE_SIMULATED = 2;
  TRADE_MODE_LIVE = 3;
}

//============================================================================
enum RequestActionEnum 
{
  REQUEST_ACTION_UNSET = 0;
  SUBSCRIBE = 1;
  UNSUBSCRIBE = 2;
  SNAPSHOT = 3;
}

/*==========================================================================*/
enum UnbundledTradeIndicatorEnum 
{
  UNBUNDLED_TRADE_NONE = 0;
  FIRST_SUB_TRADE_OF_UNBUNDLED_TRADE = 1;
  LAST_SUB_TRADE_OF_UNBUNDLED_TRADE = 2;
};

//============================================================================
enum OrderStatusEnum 
{
  ORDER_STATUS_UNSPECIFIED = 0;
  ORDER_STATUS_ORDER_SENT = 1;
  ORDER_STATUS_PENDING_OPEN = 2;
  ORDER_STATUS_PENDING_CHILD = 3;
  ORDER_STATUS_OPEN = 4;
  ORDER_STATUS_PENDING_CANCEL_REPLACE = 5;
  ORDER_STATUS_PENDING_CANCEL = 6;
  ORDER_STATUS_FILLED = 7;
  ORDER_STATUS_CANCELED = 8;
  ORDER_STATUS_REJECTED = 9;
  ORDER_STATUS_PARTIALLY_FILLED = 10;
}

//============================================================================
enum OrderUpdateReasonEnum 
{
  ORDER_UPDATE_REASON_UNSET = 0;
  OPEN_ORDERS_REQUEST_RESPONSE = 1;
  NEW_ORDER_ACCEPTED = 2;
  GENERAL_ORDER_UPDATE = 3;
  ORDER_FILLED = 4;
  ORDER_FILLED_PARTIALLY = 5;
  ORDER_CANCELED = 6;
  ORDER_CANCEL_REPLACE_COMPLETE = 7;
  NEW_ORDER_REJECTED = 8;
  ORDER_CANCEL_REJECTED = 9;
  ORDER_CANCEL_REPLACE_REJECTED = 10;
}

//============================================================================
enum AtBidOrAskEnum 
{
  BID_ASK_UNSET = 0;
  AT_BID = 1;
  AT_ASK = 2;
}

//============================================================================
enum AtBidOrAskEnum8 
{
  BID_ASK_UNSET_8 = 0;
  AT_BID_8 = 1;
  AT_ASK_8 = 2;
}

//============================================================================
enum MarketDepthUpdateTypeEnum 
{
  DEPTH_UNSET = 0;
  MARKET_DEPTH_INSERT_UPDATE_LEVEL = 1; // Insert or update depth at the given price level
  MARKET_DEPTH_DELETE_LEVEL = 2; // Delete depth at the given price level
}

//============================================================================
enum OrderTypeEnum 
{
  ORDER_TYPE_UNSET = 0;
  ORDER_TYPE_MARKET = 1;
  ORDER_TYPE_LIMIT = 2;
  ORDER_TYPE_STOP = 3;
  ORDER_TYPE_STOP_LIMIT = 4;
  ORDER_TYPE_MARKET_IF_TOUCHED = 5;
  ORDER_TYPE_LIMIT_IF_TOUCHED = 6;
}

//============================================================================
enum TimeInForceEnum 
{
  TIF_UNSET = 0;
  TIF_DAY = 1;
  TIF_GOOD_TILL_CANCELED = 2;
  TIF_GOOD_TILL_DATE_TIME = 3;
  TIF_IMMEDIATE_OR_CANCEL = 4;
  TIF_ALL_OR_NONE = 5;
  TIF_FILL_OR_KILL = 6;
}

//============================================================================
enum BuySellEnum 
{
  BUY_SELL_UNSET = 0;
  BUY = 1;
  SELL = 2;
}

//============================================================================
enum OpenCloseTradeEnum 
{
  TRADE_UNSET = 0;
  TRADE_OPEN = 1;
  TRADE_CLOSE = 2;
}

//============================================================================
enum PartialFillHandlingEnum 
{
  PARTIAL_FILL_UNSET = 0;
  PARTIAL_FILL_HANDLING_REDUCE_QUANTITY = 1;
  PARTIAL_FILL_HANDLING_IMMEDIATE_CANCEL = 2;
}

//============================================================================
enum MarketDataFeedStatusEnum 
{
  MARKET_DATA_FEED_STATUS_UNSET = 0;
  MARKET_DATA_FEED_UNAVAILABLE = 1;
  MARKET_DATA_FEED_AVAILABLE = 2;
}

//============================================================================
enum PriceDisplayFormatEnum 
{
  PRICE_DISPLAY_FORMAT_DECIMAL_0 = 0;
  PRICE_DISPLAY_FORMAT_DECIMAL_1 = 1;
  PRICE_DISPLAY_FORMAT_DECIMAL_2 = 2;
  PRICE_DISPLAY_FORMAT_DECIMAL_3 = 3;
  PRICE_DISPLAY_FORMAT_DECIMAL_4 = 4;
  PRICE_DISPLAY_FORMAT_DECIMAL_5 = 5;
  PRICE_DISPLAY_FORMAT_DECIMAL_6 = 6;
  PRICE_DISPLAY_FORMAT_DECIMAL_7 = 7;
  PRICE_DISPLAY_FORMAT_DECIMAL_8 = 8;
  PRICE_DISPLAY_FORMAT_DECIMAL_9 = 9;
  PRICE_DISPLAY_FORMAT_DENOMINATOR_256 = 356;
  PRICE_DISPLAY_FORMAT_DENOMINATOR_128 = 228;
  PRICE_DISPLAY_FORMAT_DENOMINATOR_64 = 164;
  PRICE_DISPLAY_FORMAT_DENOMINATOR_32_QUARTERS = 136;
  PRICE_DISPLAY_FORMAT_DENOMINATOR_32_HALVES = 134;
  PRICE_DISPLAY_FORMAT_DENOMINATOR_32 = 132;
  PRICE_DISPLAY_FORMAT_DENOMINATOR_16 = 116;
  PRICE_DISPLAY_FORMAT_DENOMINATOR_8 = 108;
  PRICE_DISPLAY_FORMAT_DENOMINATOR_4 = 104;
  PRICE_DISPLAY_FORMAT_DENOMINATOR_2 = 102;
  PRICE_DISPLAY_FORMAT_UNSET =  -1;
}

//============================================================================
enum SecurityTypeEnum 
{
  SECURITY_TYPE_UNSET = 0;
  SECURITY_TYPE_FUTURE = 1;
  SECURITY_TYPE_STOCK = 2;
  SECURITY_TYPE_FOREX = 3;
  SECURITY_TYPE_INDEX = 4;
  SECURITY_TYPE_FUTURES_STRATEGY = 5;
  SECURITY_TYPE_FUTURES_OPTION = 7;
  SECURITY_TYPE_STOCK_OPTION = 6;
  SECURITY_TYPE_INDEX_OPTION = 8;
  SECURITY_TYPE_BOND = 9;
  SECURITY_TYPE_MUTUAL_FUND = 10;
}

//============================================================================
enum PutCallEnum 
{
  PC_UNSET = 0;
  PC_CALL = 1;
  PC_PUT = 2;
}

//============================================================================
enum SearchTypeEnum 
{
  SEARCH_TYPE_UNSET = 0;
  SEARCH_TYPE_BY_SYMBOL = 1;
  SEARCH_TYPE_BY_DESCRIPTION = 2;
}

//============================================================================
enum HistoricalDataIntervalEnum 
{
  INTERVAL_TICK = 0;
  INTERVAL_1_SECOND = 1;
  INTERVAL_2_SECONDS = 2;
  INTERVAL_4_SECONDS = 4;
  INTERVAL_5_SECONDS = 5;
  INTERVAL_10_SECONDS = 10;
  INTERVAL_30_SECONDS = 30;
  INTERVAL_1_MINUTE = 60;
  INTERVAL_1_DAY = 86400;
  INTERVAL_1_WEEK = 604800;
}

//============================================================================
enum HistoricalPriceDataRejectReasonCodeEnum
{
  HPDR_UNSET = 0;
  HPDR_UNABLE_TO_SERVE_DATA_RETRY_LATER = 1;
  HPDR_UNABLE_TO_SERVE_DATA_DO_NOT_RETRY = 2;
  HPDR_DATA_REQUEST_OUTSIDE_BOUNDS_OF_AVAILABLE_DATA = 3;
  HPDR_GENERAL_REJECT_ERROR = 4;
}



//============================================================================
message EncodingRequest
{
	int32 ProtocolVersion = 1;
	EncodingEnum Encoding = 2;
	string ProtocolType = 3;
}

//============================================================================
message EncodingResponse
{
	int32 ProtocolVersion = 1;
	EncodingEnum Encoding = 2;
	string ProtocolType = 3;
}

//============================================================================
message LogonRequest
{
	int32  ProtocolVersion = 1;
	string Username = 2;
	string Password = 3;
	string GeneralTextData = 4;
	int32  Integer_1 = 5;
	int32  Integer_2 = 6;
	int32  HeartbeatIntervalInSeconds = 7;
	TradeModeEnum TradeMode = 8;
	string TradeAccount = 9;
	string HardwareIdentifier = 10;
	string ClientName = 11;
}

//============================================================================
message LogonResponse
{
	int32  ProtocolVersion = 1;
	LogonStatusEnum Result = 2;
	string ResultText = 3;
	string ReconnectAddress = 4;
	int32  Integer_1 = 5;
	string ServerName = 6;
	uint32 MarketDepthUpdatesBestBidAndAsk = 7;
	uint32 TradingIsSupported = 8;
	uint32 OCOOrdersSupported = 9;
	uint32 OrderCancelReplaceSupported = 10;
	string SymbolExchangeDelimiter = 11;
	uint32 SecurityDefinitionsSupported = 12;
	uint32 HistoricalPriceDataSupported = 13;
	uint32 ResubscribeWhenMarketDataFeedAvailable = 14;
	uint32 MarketDepthIsSupported = 15;
	uint32 OneHistoricalPriceDataRequestPerConnection = 16;
	uint32 BracketOrdersSupported = 17;
	uint32 UseIntegerPriceOrderMessages = 18;
	uint32 UsesMultiplePositionsPerSymbolAndTradeAccount = 19;
	uint32 MarketDataSupported = 20;
}

//============================================================================
message Logoff
{
	string Reason = 1;
	uint32 DoNotReconnect = 2;
}

//============================================================================
message Heartbeat
{
	uint32 NumDroppedMessages = 1;
	sfixed64 CurrentDateTime = 2;
}

//============================================================================
message MarketDataFeedStatus
{
	MarketDataFeedStatusEnum Status = 1;
}

//============================================================================
message MarketDataFeedSymbolStatus
{
	uint32 SymbolID = 1;
	MarketDataFeedStatusEnum Status = 2;
}

//============================================================================
message MarketDataRequest
{
	RequestActionEnum RequestAction = 1;
	uint32 SymbolID = 2;
	string Symbol = 3;
	string Exchange = 4;
}

//============================================================================
message MarketDepthRequest
{
	RequestActionEnum RequestAction = 1;
	uint32 SymbolID = 2;
	string Symbol = 3;
	string Exchange = 4;
	int32 NumLevels = 5;
}

//============================================================================
message MarketDataReject
{
	uint32 SymbolID = 1;
	string RejectText = 2;
}

//============================================================================
message MarketDataSnapshot
{
	uint32 SymbolID = 1;
	double SessionSettlementPrice = 2;
	double SessionOpenPrice = 3;
	double SessionHighPrice = 4;
	double SessionLowPrice = 5;
	double SessionVolume = 6;
	uint32 SessionNumTrades = 7;
	uint32 OpenInterest = 8;

	double BidPrice = 9;
	double AskPrice = 10;
	double AskQuantity = 11;
	double BidQuantity = 12;
	double LastTradePrice = 13;
	double LastTradeVolume = 14;
	double LastTradeDateTime = 15;
	double BidAskDateTime = 16;
	uint32 SessionSettlementDateTime = 17;
	uint32 TradingSessionDate = 18;
}

//============================================================================
message MarketDataSnapshot_Int
{
	uint32 SymbolID = 1;
	int32 SessionSettlementPrice = 2;
	int32 SessionOpenPrice = 3;
	int32 SessionHighPrice = 4;
	int32 SessionLowPrice = 5;
	int32 SessionVolume = 6;
	uint32 SessionNumTrades = 7;
	uint32 OpenInterest = 8;

	int32 BidPrice = 9;
	int32 AskPrice = 10;
	int32 AskQuantity = 11;
	int32 BidQuantity = 12;
	int32 LastTradePrice = 13;
	int32 LastTradeVolume = 14;
	double LastTradeDateTime = 15;
	double BidAskDateTime = 16;
	uint32 SessionSettlementDateTime = 17;
	uint32 TradingSessionDate = 18;
}

//============================================================================
message DepthEntry
{
	double Price = 1;
	float Quantity = 12;
}

//============================================================================
message MarketDepthFullUpdate20
{
	uint32 SymbolID = 1;

	repeated DepthEntry BidDepth = 2;
	repeated DepthEntry AskDepth = 3;
}

//============================================================================
message MarketDepthFullUpdate10
{
	uint32 SymbolID = 1;

	repeated DepthEntry BidDepth = 2;
	repeated DepthEntry AskDepth = 3;
}

//============================================================================
message MarketDepthSnapshotLevel
{
	uint32 SymbolID = 1;
	AtBidOrAskEnum Side = 2;
	double Price = 3;
	double Quantity = 4;
	uint32 Level = 5;

	uint32 IsFirstMessageInBatch = 6;
	uint32 IsLastMessageInBatch = 7;
	double DateTime = 8;

	uint32 NumOrders = 9;
}

//============================================================================
message MarketDepthSnapshotLevel_Int
{
	uint32 SymbolID = 1;
	AtBidOrAskEnum Side = 2;
	int32 Price = 3;
	int32 Quantity = 4;
	uint32  Level = 5;

	uint32 IsFirstMessageInBatch = 6;
	uint32 IsLastMessageInBatch = 7;
	double DateTime = 8;

	uint32 NumOrders = 9;
}

//============================================================================
message MarketDepthUpdateLevel
{
	uint32 SymbolID = 1;
	AtBidOrAskEnum Side = 2;
	double Price = 3;
	double Quantity = 4;

	MarketDepthUpdateTypeEnum UpdateType = 5;

	double DateTime = 6;

	uint32 NumOrders = 7;
}

//============================================================================
message MarketDepthUpdateLevel_Int
{
	uint32 SymbolID = 1;
	AtBidOrAskEnum Side = 2;
	int32 Price = 3;
	int32 Quantity = 4;

	MarketDepthUpdateTypeEnum UpdateType = 5;

	double DateTime = 6;

	uint32 NumOrders = 7;
}

//============================================================================
message MarketDepthUpdateLevelCompact
{
	uint32 SymbolID = 1;
	AtBidOrAskEnum Side = 2;
	float Price = 3;
	float Quantity = 4;

	MarketDepthUpdateTypeEnum UpdateType = 5;

	uint32 DateTime = 6;

	uint32 NumOrders = 7;
}

//============================================================================
message MarketDataUpdateSessionSettlement
{
	uint32 SymbolID = 1;
	double Price = 2;
	uint32 DateTime = 3;
}

//============================================================================
message MarketDataUpdateSessionSettlement_Int
{
	uint32 SymbolID = 1;
	int32 Price = 2;
	int32 DateTime = 3;
}

//============================================================================
message MarketDataUpdateSessionOpen
{
	uint32 SymbolID = 1;
	double Price = 2;
	uint32 TradingSessionDate = 3;
}

//============================================================================
message MarketDataUpdateSessionOpen_Int
{
	uint32 SymbolID = 1;
	int32 Price = 2;
	uint32 TradingSessionDate = 3;
}

//============================================================================
message MarketDataUpdateSessionNumTrades
{
	uint32 SymbolID = 1;
	int32 NumTrades = 2;

	uint32 TradingSessionDate = 3;
}

//============================================================================
message MarketDataUpdateTradingSessionDate
{
	uint32 SymbolID = 1;
	uint32 Date = 2;
}

//============================================================================
message MarketDepthReject
{
	uint32 SymbolID = 1;
	string RejectText = 2;
}

//============================================================================
message MarketDataUpdateTrade
{
	uint32 SymbolID = 1;

	AtBidOrAskEnum AtBidOrAsk = 2;

	double Price = 3;
	double Volume = 4;
	double DateTime = 5;
}

//============================================================================
message MarketDataUpdateTrade_Int
{
	uint32 SymbolID = 1;

	AtBidOrAskEnum AtBidOrAsk = 2;

	int32 Price = 3;
	int32 Volume = 4;
	double DateTime = 5;
}

//============================================================================
message MarketDataUpdateTradeWithUnbundledIndicator
{
	uint32 SymbolID = 1;

	AtBidOrAskEnum8 AtBidOrAsk = 2;
	UnbundledTradeIndicatorEnum UnbundledTradeIndicator = 3;

	double Price = 4;
	uint32 Volume = 5;
	double DateTime = 6;
}

//============================================================================
message MarketDataUpdateBidAsk
{
	uint32 SymbolID = 1;

	double BidPrice = 2;
	float BidQuantity = 3;
	double AskPrice = 4;
	float AskQuantity = 5;
	sfixed32 DateTime = 6;
}

//============================================================================
message MarketDataUpdateBidAsk_Int
{
	uint32 SymbolID = 1;

	int32 BidPrice = 2;
	int32 BidQuantity = 3;
	int32 AskPrice = 4;
	int32 AskQuantity = 5;
	sfixed32 DateTime = 6;
}

//============================================================================
message MarketDataUpdateBidAskCompact
{
	float BidPrice = 1;
	float BidQuantity = 2;
	float AskPrice = 3;
	float AskQuantity = 4;

	sfixed32 DateTime = 5;

	uint32 SymbolID = 6;
}

//============================================================================
message MarketDataUpdateTradeCompact
{
	float Price = 1;
	float Volume = 2;
	sfixed32 DateTime = 3;
	uint32 SymbolID = 4;
	AtBidOrAskEnum AtBidOrAsk = 5;
}

//============================================================================
message MarketDataUpdateSessionVolume
{
	uint32 SymbolID = 1;
	double Volume = 2;
	uint32 TradingSessionDate = 3;
}

//============================================================================
message MarketDataUpdateOpenInterest
{
	uint32 SymbolID = 1;
	uint32 OpenInterest = 2;

	uint32 TradingSessionDate = 3;
}

//============================================================================
message MarketDataUpdateSessionHigh
{
	uint32 SymbolID = 1;
	double Price = 2;
	uint32 TradingSessionDate = 3;
}

//============================================================================
message MarketDataUpdateSessionHigh_Int
{
	uint32 SymbolID = 1;
	int32 Price = 2;
	uint32 TradingSessionDate = 3;
}

//============================================================================
message MarketDataUpdateSessionLow
{
	uint32 SymbolID = 1;
	double Price = 2;
	uint32 TradingSessionDate = 3;
}

//============================================================================
message MarketDataUpdateSessionLow_Int
{
	uint32 SymbolID = 1;
	int32 Price = 2;
	uint32 TradingSessionDate = 3;
}

//============================================================================
message MarketDataUpdateLastTradeSnapshot
{
	uint32 SymbolID = 1;
	double LastTradePrice = 2;
	double LastTradeVolume = 3;
	double LastTradeDateTime = 4;
}

//============================================================================
message SubmitNewSingleOrder
{
	string Symbol = 1;
	string Exchange = 2;

	string TradeAccount = 3;
	string ClientOrderID = 4;

	OrderTypeEnum OrderType = 5;

	BuySellEnum BuySell = 6;

	double Price1 = 7;
	double Price2 = 8;

	double Quantity = 9;

	TimeInForceEnum TimeInForce = 10;

	sfixed64 GoodTillDateTime = 11;

	uint32 IsAutomatedOrder = 12;

	uint32 IsParentOrder = 13;

	string FreeFormText = 14;

	OpenCloseTradeEnum OpenOrClose = 15;
}

//============================================================================
message SubmitNewSingleOrderInt
{
	string Symbol = 1;
	string Exchange = 2;

	string TradeAccount = 3;
	string ClientOrderID = 4;

	OrderTypeEnum OrderType = 5;
	BuySellEnum BuySell = 6;

	int64 Price1 = 7;
	int64 Price2 = 8;
	float Divisor = 9;
	int64 Quantity = 10;

	TimeInForceEnum TimeInForce = 11;
	sfixed64 GoodTillDateTime = 12;

	uint32 IsAutomatedOrder = 13;
	uint32 IsParentOrder = 14;

	string FreeFormText = 15;

	OpenCloseTradeEnum OpenOrClose = 16;
}

//============================================================================
message CancelReplaceOrder
{
	string ServerOrderID = 1;
	string ClientOrderID = 2;

	double Price1 = 3;
	double Price2 = 4;
	double Quantity = 5;
	uint32 Price1IsSet = 6;
	uint32 Price2IsSet = 7;
	TimeInForceEnum TimeInForce = 9;
	uint64 GoodTillDateTime = 10;
	uint32 UpdatePrice1OffsetToParent = 11;
}

//============================================================================
message CancelReplaceOrderInt
{
	string ServerOrderID = 1;
	string ClientOrderID = 2;

	int64 Price1 = 3;
	int64 Price2 = 4;
	float Divisor = 5;
	int64 Quantity = 6;
	uint32 Price1IsSet = 7;
	uint32 Price2IsSet = 8;
	TimeInForceEnum TimeInForce = 10;
	uint64 GoodTillDateTime = 11;
	uint32 UpdatePrice1OffsetToParent = 12;
}

//============================================================================
message CancelOrder
{
	string ServerOrderID = 1;
	string ClientOrderID = 2;
}

//============================================================================
message SubmitNewOCOOrder
{
	string Symbol = 1;
	string Exchange = 2;

	string ClientOrderID_1 = 3;
	OrderTypeEnum OrderType_1 = 4;
	BuySellEnum BuySell_1 = 5;
	double Price1_1 = 6;
	double Price2_1 = 7;
	double Quantity_1 = 8;

	string ClientOrderID_2 = 9;
	OrderTypeEnum OrderType_2 = 10;
	BuySellEnum BuySell_2 = 11;
	double Price1_2 = 12;
	double Price2_2 = 13;
	double Quantity_2 = 14;

	TimeInForceEnum TimeInForce = 15;
	sfixed64 GoodTillDateTime = 16;

	string TradeAccount = 17;

	uint32 IsAutomatedOrder = 18;

	string ParentTriggerClientOrderID = 19;

	string FreeFormText = 20;

	OpenCloseTradeEnum OpenOrClose = 21;

	PartialFillHandlingEnum PartialFillHandling = 22;
}

//============================================================================
message SubmitNewOCOOrderInt
{
	string Symbol = 1;
	string Exchange = 2;

	string ClientOrderID_1 = 3;
	OrderTypeEnum OrderType_1 = 4;
	BuySellEnum BuySell_1 = 5;
	int64 Price1_1 = 6;
	int64 Price2_1 = 7;
	int64 Quantity_1 = 8;

	string ClientOrderID_2 = 9;
	OrderTypeEnum OrderType_2 = 10;
	BuySellEnum BuySell_2 = 11;
	int64 Price1_2 = 12;
	int64 Price2_2 = 13;
	int64 Quantity_2 = 14;

	TimeInForceEnum TimeInForce = 15;
	sfixed64 GoodTillDateTime = 16;

	string TradeAccount = 17;

	uint32 IsAutomatedOrder = 18;

	string ParentTriggerClientOrderID = 19;

	string FreeFormText = 20;

	float Divisor = 21;

	OpenCloseTradeEnum OpenOrClose = 22;

	PartialFillHandlingEnum PartialFillHandling = 23;
}

//============================================================================
message OpenOrdersRequest
{
	int32 RequestID = 1;

	int32 RequestAllOrders = 2;

	string ServerOrderID = 3;

	string TradeAccount = 4;
}

//============================================================================
message HistoricalOrderFillsRequest
{
	int32 RequestID = 1;

	string ServerOrderID = 2;

	int32 NumberOfDays = 3;

	string TradeAccount = 4;
}

//============================================================================
message HistoricalOrderFillsReject
{
	int32 RequestID = 1;
	string RejectText = 2;
}	

//============================================================================
message CurrentPositionsRequest
{
	int32 RequestID = 1;
	string  TradeAccount = 2;
}

//============================================================================
message CurrentPositionsReject
{
	int32 RequestID = 1;
	string RejectText = 2;
}

//============================================================================
message OrderUpdate
{
	int32 RequestID = 1;

	int32 TotalNumMessages = 2;
	int32 MessageNumber = 3;

	string Symbol = 4;
	string Exchange = 5;

	string PreviousServerOrderID = 6;

	string ServerOrderID = 7;

	string ClientOrderID = 8;

	string ExchangeOrderID = 9;

	OrderStatusEnum OrderStatus = 10;

	OrderUpdateReasonEnum OrderUpdateReason = 11;

	OrderTypeEnum OrderType = 12;

	BuySellEnum BuySell = 13;

	double Price1 = 14;

	double Price2 = 15;

	TimeInForceEnum TimeInForce = 16;
	sfixed64 GoodTillDateTime = 17;
	double OrderQuantity = 18;
	double FilledQuantity = 19;
	double RemainingQuantity = 20;
	double AverageFillPrice = 21;

	double LastFillPrice = 22;
	sfixed64 LastFillDateTime = 23;
	double LastFillQuantity = 24;
	string LastFillExecutionID = 25;

	string TradeAccount = 26;
	string InfoText = 27;

	uint32 NoOrders = 28;
	string ParentServerOrderID = 29;
	string OCOLinkedOrderServerOrderID = 30;

	OpenCloseTradeEnum OpenOrClose = 31;

	string PreviousClientOrderID = 32;

	string FreeFormText = 33;

	sfixed64 OrderReceivedDateTime = 34;
}

//============================================================================
message OpenOrdersReject
{
	int32 RequestID = 1;
	string RejectText = 2;
}

//============================================================================
message HistoricalOrderFillResponse
{
	int32 RequestID = 1;

	int32 TotalNumberMessages = 2;

	int32 MessageNumber = 3;

	string Symbol = 4;
	string Exchange = 5;
	string ServerOrderID = 6;
	BuySellEnum BuySell = 7;
	double Price = 8;
	sfixed64 DateTime = 9;
	double Quantity = 10;
	string UniqueExecutionID = 11;
	string TradeAccount = 12;

	OpenCloseTradeEnum OpenClose = 13;

	uint32 NoOrderFills = 14;
}

//============================================================================
message PositionUpdate
{
	int32 RequestID = 1;

	int32 TotalNumberMessages = 2;

	int32 MessageNumber = 3;

	string Symbol = 4;
	string Exchange = 5;

	double Quantity = 6;
	double AveragePrice = 7;

	string PositionIdentifier  = 8;

	string TradeAccount = 9;
	uint32 NoPositions = 10;

	uint32 Unsolicited = 11;
}

//============================================================================
message TradeAccountsRequest
{
	int32 RequestID = 1;
}

//============================================================================
message TradeAccountResponse
{
	int32 TotalNumberMessages = 1;

	int32 MessageNumber = 2;

	string TradeAccount = 3;

	int32 RequestID = 4;
}

//============================================================================
message ExchangeListRequest
{
	int32 RequestID = 1;
}

//============================================================================
message ExchangeListResponse
{
	int32 RequestID = 1;
	string Exchange = 2;
	uint32 IsFinalMessage = 3;
	string Description = 4;
}

//============================================================================
message SymbolsForExchangeRequest
{
	int32 RequestID = 1;
	string Exchange = 2;

	SecurityTypeEnum SecurityType = 3;
	RequestActionEnum RequestAction = 4;

	string Symbol = 5;
}

//============================================================================
message UnderlyingSymbolsForExchangeRequest
{
	int32 RequestID = 1;
	string Exchange = 2;

	SecurityTypeEnum SecurityType = 3;
}

//============================================================================
message SymbolsForUnderlyingRequest
{
	int32 RequestID = 1;

	string UnderlyingSymbol = 2;
	string Exchange = 3;

	SecurityTypeEnum SecurityType = 4;
}

//============================================================================
message SymbolSearchRequest
{
	int32 RequestID = 1;

	string SearchText = 2;
	string Exchange = 3;

	SecurityTypeEnum SecurityType = 4;
	SearchTypeEnum SearchType = 5;
}

//============================================================================
message SecurityDefinitionForSymbolRequest
{
	int32 RequestID = 1;

	string Symbol = 2;
	string Exchange = 3;
}

//============================================================================
message SecurityDefinitionResponse
{
	int32 RequestID = 1;

	string Symbol = 2;
	string Exchange = 3;

	SecurityTypeEnum SecurityType = 4;

	string Description = 5;
	float MinPriceIncrement = 6;
	PriceDisplayFormatEnum PriceDisplayFormat = 7;
	float CurrencyValuePerIncrement = 8;

	uint32 IsFinalMessage = 9;

	float FloatToIntPriceMultiplier = 10;
	float IntToFloatPriceDivisor = 11;

	string UnderlyingSymbol = 12;

	uint32 UpdatesBidAskOnly = 13;

	float StrikePrice = 14;

	PutCallEnum PutOrCall = 15;

	uint32 ShortInterest = 16;

	sfixed32 SecurityExpirationDate = 17;

	float BuyRolloverInterest = 18;
	float SellRolloverInterest = 19;

	float EarningsPerShare = 20;
	uint32 SharesOutstanding = 21;

	float IntToFloatQuantityDivisor = 22;

	uint32 HasMarketDepthData = 23;

	float DisplayPriceMultiplier = 24;

	string ExchangeSymbol = 25;

	float InitialMarginRequirement = 26;
	float MaintenanceMarginRequirement = 27;
}


//============================================================================
message SecurityDefinitionReject
{
	int32 RequestID = 1;
	string RejectText = 2;
}

//============================================================================
message AccountBalanceRequest
{
	int32 RequestID = 1;
	string TradeAccount = 2;
}

//============================================================================
message AccountBalanceReject
{
	int32 RequestID = 1;
	string RejectText = 2;
}

//============================================================================
message AccountBalanceUpdate
{
	int32 RequestID = 1;

	double CashBalance = 2;

	double BalanceAvailableForNewPositions = 3;

	string AccountCurrency = 4;

	string TradeAccount = 5;
	double SecuritiesValue = 6;  // Not including cash
	double MarginRequirement = 7;

	int32 TotalNumberMessages = 8;
	int32 MessageNumber = 9;
	uint32 NoAccountBalances = 10;
	uint32 Unsolicited = 11;
}

//============================================================================
message UserMessage
{
	string UserMessage = 1;

	uint32 IsPopupMessage = 2;
}

//============================================================================
message GeneralLogMessage
{
	string MessageText = 3;
}

//============================================================================
message HistoricalPriceDataRequest
{
	int32 RequestID = 1;
	string Symbol = 2;
	string Exchange = 3;
	HistoricalDataIntervalEnum RecordInterval = 4;
	sfixed64 StartDateTime = 5;
	sfixed64 EndDateTime = 6;
	uint32 MaxDaysToReturn = 7;
	uint32  UseZLibCompression = 8;
	uint32 RequestDividendAdjustedStockData = 9;
	uint32 Flag_1 = 10;
}

//============================================================================
message HistoricalPriceDataResponseHeader
{
	int32 RequestID = 1;
	HistoricalDataIntervalEnum RecordInterval = 2;

	uint32 UseZLibCompression = 3;

	uint32 NoRecordsToReturn = 4;

	float IntToFloatPriceDivisor = 5;
}

//============================================================================
message HistoricalPriceDataReject
{
	int32 RequestID = 1;

	string RejectText = 2;

	HistoricalPriceDataRejectReasonCodeEnum RejectReasonCode = 3;

	uint32 RetryTimeInSeconds = 4;
}

//============================================================================
message HistoricalPriceDataRecordResponse
{
	int32 RequestID = 1;

	sfixed64 StartDateTime = 2;
	double OpenPrice = 3;
	double HighPrice = 4;
	double LowPrice = 5;
	double LastPrice = 6;
	double Volume = 7;
	uint32 NumTrades = 8;
	double BidVolume = 9;
	double AskVolume = 10;

	uint32 IsFinalRecord = 11;
}

//============================================================================
message HistoricalPriceDataTickRecordResponse
{
	int32 RequestID = 1;

	double DateTime = 2;
	AtBidOrAskEnum AtBidOrAsk = 3;

	double Price = 4;
	double Volume = 5;

	uint32 IsFinalRecord = 6;
}

//============================================================================
message HistoricalPriceDataRecordResponse_Int
{
	int32 RequestID = 1;

	sfixed64 StartDateTime = 2;
	int32 OpenPrice = 3;
	int32 HighPrice = 4;
	int32 LowPrice = 5;
	int32 LastPrice = 6;
	int32 Volume = 7;
	uint32 NumTrades = 8;
	int32 BidVolume = 9;
	int32 AskVolume = 10;

	uint32 IsFinalRecord = 11;
}

//============================================================================
message HistoricalPriceDataTickRecordResponse_Int
{
	int32 RequestID = 1;

	double DateTime = 2;

	int32 Price = 3;
	int32 Volume = 4;

	AtBidOrAskEnum AtBidOrAsk = 5;
	uint32 IsFinalRecord = 6;
}

//============================================================================
message HistoricalPriceDataResponseTrailer
{
	int32 RequestID = 1;
	double FinalRecordLastDateTime = 2;
}
