组合 Greeks 聚合 Delta
Greeks Portfolio Aggregate Delta
题目详情
某组合包含以下持仓:200 份看涨期权(delta = 0.6)、150 份看跌期权(delta = -0.4)、50 份标的股票空头。
任务:计算组合总 delta = 200×0.6 + 150×(-0.4) + (-50)×1.0 = 120 - 60 - 50 = 10。组合 delta 为 10,意味着标的价格每变动 1 美元,组合价值变动约 10 美元。分析 delta 对冲需要做空 10 份标的股票。
英文原题
A portfolio contains the following positions:
- 200 call options with a delta of 0.6
- 150 put options with a delta of -0.4
- A short position of 50 shares of the underlying asset.
What is the portfolio's aggregate delta?
解析
问题分析
A portfolio contains the following positions:
- 200 call options with a delta of 0.6
- 150 put options with a delta of -0.4
- A short position of 50 shares of the underlying asset.
What is the portfolio's aggregate delta?
解法
根据题目要求实现相应功能。核心逻辑需要:
// 核心数据结构和方法——根据题目 API 约定实现
// 1. 确定状态表示——选择支持所需操作的数据结构
// 2. 实现核心算法——确保 O(·) 时间复杂度和正确性
// 3. 处理边界条件——空输入、极值参数、并发访问验证
用具体输入验证:构造已知输入的测试用例,确认输出匹配预期结果。
复杂度与边界
- 时间复杂度:取决于选用的算法
- 空间复杂度:取决于数据规模
- 关键边界条件:空输入、极值参数、并发场景下的正确性保证
英文解析
Analysis
A portfolio contains: 200 call options with delta 0.6, 150 put options with delta -0.4, and a short position of 50 shares of the underlying asset. The portfolio's aggregate delta is the sum of all position deltas multiplied by their quantities: delta_portfolio = sum(delta_i * quantity_i). Each share has delta = 1, so short 50 shares contributes -50 to aggregate delta.
Solution
struct Position { int quantity; double delta; bool is_share; };
double aggregateDelta(const std::vector<Position>& positions) {
double total = 0;
for (const auto& p : positions) {
double position_delta = p.delta * p.quantity;
if (p.is_share && p.quantity < 0) position_delta = p.quantity; // Shares have delta=1
total += position_delta;
}
return total; // = 200*0.6 + 150*(-0.4) + (-50)*1 = 120 - 60 - 50 = 10
}Complexity & Edge Cases
- Time complexity: O(N) where N = number of positions
- Space complexity: O(1)
- Edge cases: (1) Short shares contribute negative delta (delta = -1 per share) (2) Delta can exceed +/-1 for options near expiration (3) Portfolio delta of 0 is delta-neutral (market-neutral)
Verification
Compute: 2000.6 + 150(-0.4) + (-50)*1 = 120 - 60 - 50 = 10. Verify positive aggregate delta means portfolio gains when underlying rises. Test delta-neutral scenario (aggregate delta = 0).
Key Considerations
Aggregate delta measures the portfolio's directional exposure to the underlying. Delta = 10 means the portfolio behaves like holding 10 shares long - it gains approximately 1 increase in the underlying. Delta hedging involves trading shares oror options to bring aggregate delta to zero, eliminating directional risk while preserving volatility exposure.