syntax = "proto3";
package com.tigerbrokers.stock.openapi.client.socket.data.pb;

option java_package = "com.tigerbrokers.stock.openapi.client.socket.data.pb";
option java_multiple_files = true;

message OrderStatusData {
  sint64 id = 1; // unique order id
  string account = 2; // user account
  string symbol = 3;
  string expiry = 4; // for options, formate:yyyyMMdd
  string strike = 5; // for options
  string right = 6; // for options
  string identifier = 7;
  uint32 multiplier = 8; // multiplier for futures, options, warrants and CBBC
  string action = 9; // BUY or SELL
  string market = 10; // market. US, HK, etc.
  string currency = 11; // currency. USD, HKD, etc.
  string segType = 12; // Securities Category C: (Commodities Futures), S: (Securities Stocks)
  string secType = 13; // STK Stocks, OPT Options, WAR Warrants, IOPT CBBC, CASH FOREX, FUT Futures, FOP Future Options

  string orderType = 14; // order type
  bool isLong = 15;
  sint64 totalQuantity = 16; // total quantity
  sint32 totalQuantityScale = 17; // total quantity scale
  sint64 filledQuantity = 18; // filled quantity
  sint32 filledQuantityScale = 19; // filled quantity scale
  double avgFillPrice = 20; // average price at which the orders got filled
  double limitPrice = 21; // limit price（required when orderType is 'LMT'）
  double stopPrice = 22; // stop price（required when orderType is 'STP'）
  double realizedPnl = 23; // realized profit and loss
  string status = 24; // order status
  string replaceStatus = 25; // order replace status
  string cancelStatus = 26; // order cancel status

  bool outsideRth = 27; // if trade outside regular trading hours (only applicable to U.S. market)
  bool canModify = 28;
  bool canCancel = 29;
  bool liquidation = 30;
  string name = 31; // symbol name
  string source = 32; // order source(from 'OpenApi', or not)
  string errorMsg = 33; // error message
  string attrDesc = 34; // order description
  float commissionAndFee = 35; // commission and fee
  uint64 openTime = 36; // timestamp when the order is placed
  uint64 timestamp = 37;
  string userMark = 38;
  double totalCashAmount = 39;
  double filledCashAmount = 40;
  double gst = 41; // Goods and Services Tax(TBSG only)
  repeated string attrList = 42;
  string timeInForce = 43;
  uint64 updateTime = 44; // timestamp (ms) of order info update
  uint64 latestTime = 45; // timestamp (ms) of order status update
}
