筹码集中度是衡量股票筹码分布集中程度的指标,通常用价格区间内一定比例(如90%)的筹码分布宽度占总价格区间的比例来表示。以下是计算90%筹码集中度的通用公式和源码实现思路(以Python为例),适用于股票量化分析或行情软件指标编写。
---
一、计算公式
90%筹码集中度 = (90%筹码分布的价格区间上限 - 下限) (价格区间上限 + 下限) × 100%
(注:不同软件可能略有差异,但核心逻辑相同)
---
二、计算步骤(以Python为例)
1. 获取筹码分布数据:需依赖行情软件或量化平台的筹码分布函数(如Tulip、TA-Lib或自定义计算)。
2. 确定价格区间:找到90%筹码分布的最高价和最低价。
3. 套用公式计算。
---
三、源码示例(Python伪代码)
python
import numpy as np
假设已有筹码数据:price_list(价格列表), volume_list(对应筹码量列表)
def calculate_concentration(price_list, volume_list, percentage=90):
1. 按价格排序筹码
sorted_data = sorted(zip(price_list, volume_list), key=lambda x: x[0])
sorted_prices, sorted_volumes = zip(sorted_data)
2. 计算总筹码量和目标百分比阈值
total_volume = sum(sorted_volumes)
target_volume = total_volume percentage 100.0
3. 滑动窗口找到90%筹码的区间
left = 0
current_volume = 0
min_range = float('inf')
result_low, result_high = 0, 0
for right in range(len(sorted_volumes)):
current_volume += sorted_volumes[right]
while current_volume = target_volume:
if sorted_prices[right] - sorted_prices[left] min_range:
min_range = sorted_prices[right] - sorted_prices[left]
result_low = sorted_prices[left]
result_high = sorted_prices[right]
current_volume -= sorted_volumes[left]
left += 1
4. 计算集中度
concentration = (result_high - result_low) (result_high + result_low) 100
return concentration
调用示例
prices = [10.0, 10.5, 11.0, ...] 价格列表
volumes = [1000, 1500, 2000, ...] 筹码量列表
conc = calculate_concentration(prices, volumes, 90)
---
四、注意事项
1. 数据来源:实际应用中需通过行情API(如聚宽、Tushare)或本地数据计算筹码分布(需历史成交数据模拟)。
2. 算法优化:上述代码为简化版,真实场景需考虑性能(如动态规划优化)。
3. 软件差异:同花顺、东方财富等软件的筹码集中度计算可能包含加权平均或标准差逻辑,需适配。
---
五、实际应用建议
- 集中度越低(如10%),说明筹码越集中,可能存在主力控盘;
- 集中度越高(如30%),说明筹码分散,波动可能加大。
(需结合股价位置和成交量综合判断)
---
如果需要直接用于某平台(如通达信、同花顺),可提供具体环境以便提供对应公式代码。
发布于2026-2-10 15:19 广州



分享
注册
1分钟入驻>
+微信
秒答
电话咨询
19531816742 

