Data Layering

2025-07-13

Logical sources and derivation paths of trading data

Logical Sources and Derivation Paths of Trading Data

Trading data is a digital reflection of market activity, and every data point has a specific logical origin. Starting from the most basic trading behaviors, the following traces the logical paths that derive each category of trading data:

1. Raw trading behaviors and base data

Order submission

  • Raw behavior: a trader submits a buy or sell order to the exchange
  • Direct data:
    • Order type (market/limit)
    • Order side (buy/sell)
    • Order price (limit orders)
    • Order quantity
    • Order timestamp
    • Trader identifier

Order matching

  • Raw process: the exchange's matching engine pairs buy and sell orders according to its rules
  • Direct data:
    • Trade price
    • Trade quantity
    • Trade timestamp
    • Identifiers of both parties
    • Trade sequence number

Order management

  • Raw behavior: the trader modifies or cancels unfilled orders
  • Direct data:
    • Order modification records
    • Order cancellation records
    • Order lifecycle timestamps

2. First-order derived data (direct aggregation)

Logical source of price data

  • Open price = the price of the first trade in the period
  • High price = max(all trade prices)
  • Low price = min(all trade prices)
  • Close price = the price of the last trade in the period
  • VWAP = ∑(trade price × volume) ÷ ∑(volume)

Logical source of volume data

  • Volume = ∑(all traded quantities)
  • Trade count = count(trade records)
  • Turnover = ∑(trade price × volume)
  • Average trade size = total volume ÷ trade count

Logical source of order book data

  • Bid X / Ask X price = the price of the Xth unfilled buy/sell order level, sorted by price
  • Bid X / Ask X size = the cumulative order quantity at that price level
  • Bid-ask spread = best ask price - best bid price
  • Buy/sell volume ratio = ∑(bid size) ÷ ∑(ask size)

3. Second-order derived data (computation and analysis)

Logical source of change indicators

  • Price change = current price - previous close
  • Percentage change = (current price - previous close) ÷ previous close
  • Amplitude = (high - low) ÷ previous close
  • Turnover rate = volume ÷ shares outstanding

Logical source of trade-direction indicators

  • Aggressive buy volume = ∑(volume of orders initiated and filled by buyers)
    • Identification rule: when the trade price ≥ best ask, the buyer is the aggressor
  • Aggressive sell volume = ∑(volume of orders initiated and filled by sellers)
    • Identification rule: when the trade price ≤ best bid, the seller is the aggressor
  • Buy/sell pressure ratio = aggressive buy volume ÷ aggressive sell volume

Logical source of volatility indicators

  • Realized volatility = standard deviation of log price returns × √(number of trading sessions)
  • Price range ratio = (high - low) ÷ average price
  • Micro volatility = standard deviation of high-frequency price changes ÷ average price

4. Advanced derived data (complex computation)

Deriving liquidity indicators

  • Effective spread = 2 × |trade price - mid price|
    • mid price = (best bid + best ask) ÷ 2
  • Market depth = ∑(bid/ask order volume within ±X% of the mid price)
  • Market impact cost = (post-trade price - pre-trade price) ÷ pre-trade price
  • Resilience = 1 ÷ (time for the price to return to equilibrium)

Deriving trader behavior indicators

  • Order aggressiveness = market order count ÷ total order count
  • Rally-chasing index = buy volume during price rises ÷ buy volume in normal periods
  • Panic-selling index = sell volume during price drops ÷ sell volume in normal periods
  • Trading persistence = consecutive trading sessions ÷ total trading sessions

Deriving market quality indicators

  • Price discovery efficiency = 1 ÷ (time for new information to be reflected in prices)
  • Market resilience = 1 ÷ (time for prices to recover after large orders execute)
  • Information asymmetry indicator = estimate from a probability-of-informed-trading model
    • computed from the bid-ask spread and order flow imbalance

5. Worked examples: from raw orders to complex indicators

Example 1: Deriving the MACD technical indicator

  1. Raw data: the price and time of every trade
  2. First-level aggregation: compute the close for each period
  3. Second-level computation: compute exponential moving averages (EMA) over different periods
    • 12-period EMA = current close × (2÷(12+1)) + previous EMA × (1-(2÷(12+1)))
    • 26-period EMA = current close × (2÷(26+1)) + previous EMA × (1-(2÷(26+1)))
  4. Third-level computation: MACD line = 12-period EMA - 26-period EMA
  5. Fourth-level computation: signal line = 9-period EMA of the MACD line
  6. Final indicator: MACD histogram = MACD line - signal line

Example 2: Deriving market microstructure indicators

  1. Raw data: order submissions, modifications, cancellations, and fills
  2. First-level processing: reconstruct the complete order book state at every moment
  3. Second-level computation: compute order book shape features
    • Order book skew = skewness of the bid-side volume distribution - skewness of the ask-side volume distribution
  4. Third-level computation: order flow imbalance indicator
    • Order flow imbalance = (buy order volume - sell order volume) ÷ total order volume
  5. Fourth-level computation: price pressure indicators
    • Buy-side price pressure = ∑(bid size_i × percentage distance from mid price_i)
    • Sell-side price pressure = ∑(ask size_i × percentage distance from mid price_i)
  6. Final indicator: net price pressure = buy-side pressure - sell-side pressure

Example 3: Deriving trader sentiment indicators

  1. Raw data: every fill record and order detail
  2. First-level identification: distinguish buyer-initiated from seller-initiated fills
  3. Second-level computation: compute buy/sell ratios and aggressiveness indicators
    • Buy/sell ratio = aggressive buy volume ÷ aggressive sell volume
    • Aggressiveness indicator = share of market orders
  4. Third-level computation: correlation analysis against price changes
    • Sentiment momentum = rate of change of the buy/sell ratio × rate of price change
  5. Fourth-level computation: sentiment volatility
    • Sentiment volatility = standard deviation of the buy/sell ratio ÷ its mean
  6. Final indicator: composite market sentiment index = f(buy/sell ratio, aggressiveness, sentiment momentum, volatility)

6. Data completeness and derivation limits

Deriving values when data is missing

  • Missing volume: can be estimated indirectly from the frequency of high-frequency quote changes
  • Missing order book depth: the full book can be extrapolated from the visible levels
  • Missing trade direction: can be inferred from the relationship between price and the bid-ask spread

Derivation limitations

  • Information loss: aggregation inevitably discards micro-level detail
  • Noise interference: noise in raw data is amplified through the derivation process
  • Systematic bias: changes in market structure can invalidate derivation relationships
  • Dark trading: opaque mechanisms such as dark pools leave the data incomplete

Improving derivation accuracy

  • Multi-source data fusion: combine exchange data, broker data, and market surveys
  • Statistical correction: use historical patterns to correct data bias
  • Machine learning enhancement: use AI techniques to fill data gaps and identify patterns

7. The hierarchy of trading data

Logically, trading data forms a pyramid structure:


第5层: 预测性指标与决策支持
       (交易机会评分、风险预警系统)
          ↑
第4层: 综合市场质量与行为指标
       (市场效率、信息不对称、交易者情绪)
          ↑
第3层: 复杂衍生指标
       (技术指标、波动性、流动性指标)
          ↑
第2层: 基本衍生数据
       (价格变动、成交统计、订单簿特征)
          ↑
第1层: 原始交易数据
       (成交记录、订单记录、订单簿快照)
          ↑
第0层: 交易行为
       (订单提交、修改、取消、成交)

Each layer is an abstraction and refinement of the one below it. Through this layered structure we can derive complex market indicators from the most basic trading behaviors, ultimately supporting trading decisions. Understanding these logical derivation paths helps us interpret trading data more accurately, recognize the intrinsic connections between data points, and develop more effective trading strategies.