QMT Python API

委差, 委比

委差, 委比

qmt://docs/python
Python
1# coding:gbk
2'''
3内置python, 委差,委比
4'''
5 
6def 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 - askVol
13 ratio = round((diff / (bidVol + askVol)) * 100, 2)
14 print(f'{stock}的委比是{diff}, 委差是{ratio}%')
15 return
16
17def handlebar(C):
18 return

智能助手

咨询式 AI · 带入当前文档

智能助手加载中...