| name | vwap-execution |
| description | VWAP执行算法,根据历史成交量分布模式将大订单拆分为小单执行。适用于量化金融教学与成交量分布概念演示;基于简化成交量预测模型,不适用于实盘交易执行。 |
| version | 1.0.0 |
| author | wangyi |
vwap-execution
VWAP(Volume Weighted Average Price)算法交易:根据历史成交量分布模式,将大订单拆分为小单执行,以贴近VWAP均价。
📌 说明:本工具基于简化模型实现,仅使用 Python 标准库。结果仅供学习参考,不构成投资建议或交易依据。
脚本API
calc_vwap(prices, volumes)
计算 VWAP(成交量加权平均价)。
必填: prices, volumes
calc_volume_curve(volumes)
计算成交量分布(Volume Curve)。
必填: volumes
calc_average_volume_curve(historical_volumes)
计算多日历史成交量的平均分布。
必填: historical_volumes
generate_execution_schedule(total_shares, volume_curve, expected_volumes, participation_rate=0.1)
生成VWAP执行计划。
必填: total_shares, volume_curve, expected_volumes
calc_expected_vwap(schedule, expected_prices)
计算预期执行VWAP和跟踪误差。
必填: schedule, expected_prices
run_vwap_execution(total_shares, historical_volumes, historical_prices, expected_prices, participation_rate=0.1)
运行完整VWAP执行算法。
必填: total_shares, historical_volumes, historical_prices, expected_prices
调用示例
python scripts/main.py \
--total-shares <total_shares> \
--historical-volumes <historical_volumes> \
--historical-prices <historical_prices> \
--expected-prices <expected_prices> \
--participation-rate <participation_rate>