说明 / 示例
用法: ContextInfo.get_stock_list_in_sector(sectorname, realtime)
释义: 获取板块成份股,支持客户端左侧板块列表中任意的板块,包括自定义板块
参数:
string:板块名,如’沪深300’,’中证500’、’上证50’、’我的自选’等
realtime:毫秒级时间戳
返回: list:内含成份股代码,代码形式为 ‘stockcode.market’,如 ‘000002.SZ’
示例:
```py
def handlebar(ContextInfo):
index = ContextInfo.barpos
realtime = ContextInfo.get_bar_timetag(index)
print(ContextInfo.get_stock_list_in_sector('沪深300', realtime))
```