QMT Python API

涨跌家数变化

涨跌家数变化

qmt://docs/python
Python
1# coding:gbk
2'''
3内置python, 涨跌家数
4'''
5 
6data = {
7 "非一字涨停" : 0,
8 "涨停" : 0,
9 "跌停" : 0
10}
11 
12def init(C):
13 return
14 
15def 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['涨停'] += 1
26 if Open != UpStop:
27 data['非一字涨停'] += 1
28 elif lastPrice == DownStop:
29 data["跌停"] += 1
30 else:
31 pass
32 
33 print(data)
34 return
35
36def handlebar(C):
37 return

智能助手

咨询式 AI · 带入当前文档

智能助手加载中...