暗池中点价执行
Micro Dark Pool Midpoint Execution
题目详情
你正在交易某股票,观察到 NBBO(全国最优买卖报价)为 100.00 bid / 100.04 ask。你向暗池发送买入订单,暗池保证在成交时以 NBBO 中点价执行。
任务:计算中点价 = (100.00 + 100.04)/2 = 100.02。与在明市以 ask 价 100.04 买入相比,每股节省 0.02 美元。分析暗池中点价执行对高频交易的成本优势。
英文原题
You are trading a stock and observe the National Best Bid and Offer (NBBO) as 100.00 bid / 100.04 ask.
You send a buy order to a dark pool that guarantees execution at the midpoint of the NBBO at the time of the fill. Assuming your order fills at the midpoint, at what price do you execute, and how much do you save per share compared to immediately crossing the lit market spread (i.e., buying at the ask)?
解析
问题分析
You are trading a stock and observe the National Best Bid and Offer (NBBO) as 100.00 bid / 100.04 ask.
You send a buy order to a dark pool that guarantees execution at the midpoint of the NBBO at the time of the fill. Assuming your order fills at the midpoint, at what price do you execute, and how m
解法
根据题目要求实现相应功能。核心逻辑需要:
// 核心数据结构和方法——根据题目 API 约定实现
// 1. 确定状态表示——选择支持所需操作的数据结构
// 2. 实现核心算法——确保 O(·) 时间复杂度和正确性
// 3. 处理边界条件——空输入、极值参数、并发访问验证
用具体输入验证:构造已知输入的测试用例,确认输出匹配预期结果。
复杂度与边界
- 时间复杂度:取决于选用的算法
- 空间复杂度:取决于数据规模
- 关键边界条件:空输入、极值参数、并发场景下的正确性保证
英文解析
Analysis
You are trading a stock and observe the National Best Bid and Offer (NBBO) as 100.00 bid / 100.04 ask. You send a buy order to a dark pool that guarantees execution at the midpoint of the NBBO at the time of the fill. Assuming your order fills at the midpoint, you execute at 100.02 (the midpoint of 100.00 and 100.04). The savings compared to lit exchange execution at the ask price (100.04) is 2 cents per share, the hidden liquidity advantage of dark pool execution.
Solution
class DarkPoolMidpoint {
double computeMidpoint(double bid, double ask) { return (bid + ask) / 2.0; }
double computeSavings(double bid, double ask, int qty) {
double midpoint = computeMidpoint(bid, ask);
double lit_cost = (ask - midpoint) * qty; // Savings per share vs lit execution
return lit_cost * qty; // Total savings
}
};
// Example: midpoint = (100.00 + 100.04) / 2 = 100.02
// Savings per share = 100.04 - 100.02 = 0.02
// For 1000 shares: total savings = 0.02 * 1000 = $20Complexity & Edge Cases
- Time complexity: O(1)
- Space complexity: O(1)
- Edge cases: (1) NBBO may change between order submission and fill (2) Dark pool may not fill if no contra-side available (3) Some dark pools add commission or reversion fees
Verification
Compute midpoint and savings for known NBBO. Verify 2 cent per share savings at 100.00/100.04. Test that wider spreads produce larger savings. Confirm that dark pool execution reduces market impact.
Key Considerations
Dark pool midpoint execution provides hidden liquidity savings compared to lit exchange execution. The 2-cent-per-share saving on a $100 stock with 4-cent spread is significant for large orders. However, NBBO can change between submission and fill, and dark pools may not execute during volatile periods. The savings must be weighed against execution certainty - dark pool fills are probabilistic, not guaranteed.