QMT Python API
委差, 委比
委差, 委比
1
# coding:gbk2
'''3
内置python, 委差,委比4
'''5
6
def init(C): 7
stock = "${stock_code}.${market}" # 股票代码8
ticks = C.get_full_tick([stock])9
tick = ticks[stock]10
bidVol = sum(tick['bidVol'])11
askVol = sum(tick['askVol'])12
diff = bidVol - askVol13
ratio = round((diff / (bidVol + askVol)) * 100, 2) 14
print(f'{stock}的委比是{diff}, 委差是{ratio}%')15
return16
17
def handlebar(C):18
return