From c91c27c60ea50a858d4ca61a736178650a3df016 Mon Sep 17 00:00:00 2001 From: Bian Jiang Date: Tue, 3 May 2016 21:48:48 +0800 Subject: [PATCH] =?UTF-8?q?1.=20Fix=20mac=20=E8=BF=90=E8=A1=8C=E5=87=BA?= =?UTF-8?q?=E9=94=99,=20=E5=8F=AA=E5=9C=A8windows=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E5=A3=B0=E9=9F=B3.=202.=20IB=E4=BB=B7=E6=A0=BC=E5=8F=98?= =?UTF-8?q?=E5=8C=96=E7=9A=84=E6=97=B6=E5=80=99=E6=9B=B4=E6=96=B0=E8=A1=8C?= =?UTF-8?q?=E6=83=85=E4=BA=8B=E4=BB=B6=203.=20UI=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=98=A8=E5=A4=A9=E6=94=B6=E7=9B=98=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vn.trader/ibGateway/ibGateway.py | 3 +++ vn.trader/riskManager/rmEngine.py | 9 ++++++--- vn.trader/uiBasicWidget.py | 6 ++++-- 3 files changed, 13 insertions(+), 5 deletions(-) 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 +