说明 / 示例
用法: ContextInfo.get_weight_in_index(indexcode, stockcode)
释义: 获取某只股票在某指数中的绝对权重
参数:
indexcode:string,指数代码,形式如 ‘stockcode.market’,如 ‘000300.SH’
stockcode:string,股票代码,形式如 ‘stockcode.market’,如 ‘600004.SH’
返回: number:返回的数值单位是 %,如 1.6134 表示权重是 1.6134%
示例:
```py
def handlebar(ContextInfo):
print(ContextInfo.get_weight_in_index('000300.SH', '000002.SZ'))
```