QMT Python API
涨跌家数变化
涨跌家数变化
1
# coding:gbk2
'''3
内置python, 涨跌家数4
'''5
6
data = {7
"非一字涨停" : 0,8
"涨停" : 0,9
"跌停" : 010
}11
12
def init(C): 13
return 14
15
def after_init(C):16
stockLst = C.get_stock_list_in_sector('沪深A股')17
ticks = C.get_full_tick(stockLst)18
19
for code in ticks:20
tick = ticks[code]21
detail = C.get_instrument_detail(code)22
lastPrice, UpStop, DownStop, Open = tick['lastPrice'], detail['UpStopPrice'], detail['DownStopPrice'], tick['open']23
24
if lastPrice == UpStop:25
data['涨停'] += 126
if Open != UpStop:27
data['非一字涨停'] += 128
elif lastPrice == DownStop:29
data["跌停"] += 130
else:31
pass32
33
print(data)34
return35
36
def handlebar(C):37
return