Merge pull request #65 from border/master

1. Fix mac 运行出错, 只在windows提示声音. 2. IB价格变化的时候更新行情事件 3. UI增加昨天收盘价
This commit is contained in:
vn.py 2016-05-03 21:56:05 +08:00
commit feefb82ebe
3 changed files with 13 additions and 5 deletions

View File

@ -278,6 +278,9 @@ class IbWrapper(EWrapper):
tick = self.tickDict[tickerId]
key = tickFieldMap[field]
tick.__setattr__(key, price)
# 行情数据更新
newtick = copy(tick)
self.gateway.onTick(newtick)
else:
print field

View File

@ -9,7 +9,7 @@
import json
import os
import winsound
import platform
from eventEngine import *
from vtConstant import *
@ -118,7 +118,10 @@ class RmEngine(object):
def writeRiskLog(self, content):
"""快速发出日志事件"""
# 发出报警提示音
winsound.PlaySound("SystemHand", winsound.SND_ASYNC)
if platform.uname() == 'Windows':
import winsound
winsound.PlaySound("SystemHand", winsound.SND_ASYNC)
# 发出日志事件
log = VtLogData()
@ -210,4 +213,4 @@ class RmEngine(object):
if self.active:
self.writeRiskLog(u'风险管理功能启动')
else:
self.writeRiskLog(u'风险管理功能停止')
self.writeRiskLog(u'风险管理功能停止')

View File

@ -395,6 +395,7 @@ class MarketMonitor(BasicMonitor):
d['symbol'] = {'chinese':u'合约代码', 'cellType':BasicCell}
d['vtSymbol'] = {'chinese':u'名称', 'cellType':NameCell}
d['lastPrice'] = {'chinese':u'最新价', 'cellType':BasicCell}
d['preClosePrice'] = {'chinese':u'昨收盘价', 'cellType':BasicCell}
d['volume'] = {'chinese':u'成交量', 'cellType':BasicCell}
d['openInterest'] = {'chinese':u'持仓量', 'cellType':BasicCell}
d['openPrice'] = {'chinese':u'开盘价', 'cellType':BasicCell}
@ -650,7 +651,8 @@ class TradingWidget(QtGui.QFrame):
productClassList = [PRODUCT_NONE,
PRODUCT_EQUITY,
PRODUCT_FUTURES,
PRODUCT_OPTION]
PRODUCT_OPTION,
PRODUCT_FOREX]
gatewayList = ['']
@ -1120,4 +1122,4 @@ class ContractMonitor(BasicMonitor):
super(ContractMonitor, self).show()
self.refresh()