syntax = "proto3";

message Tick {
  // Unique identifier for the trade
  string trade_id = 1;

  // Market identifier (matches Market.market_id)
  string ticker = 2;

  // Timestamp in microseconds since epoch
  uint64 timestamp = 3;

  // Price (must be adjusted by tick_denom from Market metadata)
  int64 price = 4;

  // Base asset amount (must be adjusted by base_denom from Market metadata)
  int64 amount = 5;

  // Quote asset amount (must be adjusted by quote_denom from Market metadata)
  int64 quote_amount = 6;

  // Side: true = taker buy (market buy), false = taker sell (market sell)
  bool taker_buy = 7;

  // Position effect: true = close position, false = open position
  // Only relevant for derivatives/futures markets
  optional bool to_close = 8;

  // Sequence number for ordering (if provided by exchange)
  optional uint64 sequence = 9;

  // Additional flags for special trade types
  optional TradeFlags flags = 10;
}

message TradeFlags {
  // Liquidation trade
  bool is_liquidation = 1;

  // Block trade (large OTC trade)
  bool is_block_trade = 2;

  // Maker side was a post-only order
  bool maker_post_only = 3;

  // Trade occurred during auction
  bool is_auction = 4;
}
