返回题库

POV 执行算法

Pov Execution Algo

专题
Systems & Architecture / 系统与架构
难度
L2
来源
MyntBit

题目详情

Percentage-of-Volume(POV)是一种流行的算法执行策略,按指定目标参与率参与市场。通过根据观察到的市场成交量动态调整子订单大小,该算法在最小化市场冲击的同时保持与流动性同步。

任务:实现 POVAlgo 类,在收到市场成交量更新后计算下一个子订单大小。目标参与率由参数指定,子订单量 = 目标参与率 × 已观察成交量 - 已执行量。

英文原题

Percentage-of-Volume (POV) is a popular algorithmic execution strategy designed to participate in the market at a specified target rate. By dynamically adjusting the size of child orders based on the observed market volume, the algorithm aims to minimize market impact while keeping pace with liquidity.
Task
Implement a POVAlgo class that calculates the size of child orders to execute after receiving market trade updates.
You will implement the following methods:

  • POVAlgo(bool is_buy, double to
解析

问题分析

POV(成交量百分比)算法以市场实时成交量的一定比例执行订单,使参与率保持恒定。当市场活跃时执行更多,市场清淡时执行更少,从而隐藏交易意图。

实现

class POVAlgo {
    double target_pct_; int total_qty_, executed_{0};
    int market_volume_{0}, interval_volume_{0};
public:
    POVAlgo(int qty, double pct) : total_qty_(qty), target_pct_(pct) {}
    int onMarketVolume(int vol) {
        market_volume_ += vol; interval_volume_ += vol;
        if (executed_ >= total_qty_) return 0;
        int slice = std::min(total_qty_ - executed_,
                   (int)(interval_volume_ * target_pct_ / (1.0 - target_pct_)));
        if (slice > 0) { executed_ += slice; interval_volume_ = 0; }
        return slice;
    }
};

复杂度与边界

  • 时间复杂度:onMarketVolume O(1)
  • 空间复杂度:O(1)
  • 边界条件:(1) 成交量极低时长时间不执行 (2) 剩余量较小时一次执行 (3) 市场关闭时取消剩余

英文解析

Analysis

POV (Percentage of Volume) executes orders at a constant participation rate relative to real-time market volume. More is executed when the market is active, less when quiet, concealing trading intent.

Solution

class POVAlgo {
    double target_pct_; int total_qty_, executed_{0};
    int market_volume_{0}, interval_volume_{0};
public:
    POVAlgo(int qty, double pct) : total_qty_(qty), target_pct_(pct) {}
    int onMarketVolume(int vol) {
        market_volume_ += vol; interval_volume_ += vol;
        if (executed_ >= total_qty_) return 0;
        int slice = std::min(total_qty_ - executed_,
                   (int)(interval_volume_ * target_pct_ / (1.0 - target_pct_)));
        if (slice > 0) { executed_ += slice; interval_volume_ = 0; }
        return slice;
    }
};

Complexity & Edge Cases

  • Time complexity: onMarketVolume O(1)
  • Space complexity: O(1)
  • Edge cases: (1) Very low volume: long periods without execution (2) Small remaining quantity executed in one shot (3) Market closed: cancel remaining

Key Considerations

  1. Real-time volume tracking: POV requires real-time market volume data to compute target participation; data feed latency directly impacts execution accuracy
  2. Adaptive rate: When market volume exceeds forecast, POV must increase order rate proportionally; when volume is below forecast, reduce rate to avoid over-participation
  3. Completion guarantee: POV may not complete full quantity if market volume is insufficient; need fallback logic (e.g., switch to TWAP for residual)
  4. Volume forecast error: Pre-trade volume forecasts have 15-30% error; POV should cap participation rate to prevent excessive ordering when volume underperforms forecast