diff --git a/vn.trader/ibGateway/ibGateway.py b/vn.trader/ibGateway/ibGateway.py index b03701e7..6e243b74 100644 --- a/vn.trader/ibGateway/ibGateway.py +++ b/vn.trader/ibGateway/ibGateway.py @@ -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 diff --git a/vn.trader/riskManager/rmEngine.py b/vn.trader/riskManager/rmEngine.py index 21e3965e..6f5fafc1 100644 --- a/vn.trader/riskManager/rmEngine.py +++ b/vn.trader/riskManager/rmEngine.py @@ -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'风险管理功能停止') \ No newline at end of file + self.writeRiskLog(u'风险管理功能停止') diff --git a/vn.trader/uiBasicWidget.py b/vn.trader/uiBasicWidget.py index 3e9e94bf..d1fc75b6 100644 --- a/vn.trader/uiBasicWidget.py +++ b/vn.trader/uiBasicWidget.py @@ -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() - \ No newline at end of file +