1. 补充ubuntu下boost版本相关信息

2. 修复ctpGateway的持仓查询的数据推送问题
This commit is contained in:
chenxy123 2016-10-31 23:09:25 +08:00
parent 871190f953
commit 002b35ab98
2 changed files with 15 additions and 6 deletions

View File

@ -46,7 +46,7 @@ CTP
* 参考[这里](http://www.continuum.io/downloads)的教程下载并安装Anaconda的Linux 64位版本 * 参考[这里](http://www.continuum.io/downloads)的教程下载并安装Anaconda的Linux 64位版本
* 使用apt-get安装编译相关的工具 * 使用apt-get安装编译相关的工具注意某些老的Ubuntu必须指定使用boost 1.58.0版本
- apt-get install build-essential - apt-get install build-essential

View File

@ -87,8 +87,7 @@ class CtpGateway(VtGateway):
"""连接""" """连接"""
# 载入json文件 # 载入json文件
fileName = self.gatewayName + '_connect.json' fileName = self.gatewayName + '_connect.json'
path = os.path.abspath(os.path.dirname(__file__)) fileName = os.getcwd() + '/ctpGateway/' + fileName
fileName = os.path.join(path, fileName)
try: try:
f = file(fileName) f = file(fileName)
@ -659,9 +658,14 @@ class CtpTdApi(TdApi):
exchange = self.symbolExchangeDict.get(data['InstrumentID'], EXCHANGE_UNKNOWN) exchange = self.symbolExchangeDict.get(data['InstrumentID'], EXCHANGE_UNKNOWN)
size = self.symbolSizeDict.get(data['InstrumentID'], 1) size = self.symbolSizeDict.get(data['InstrumentID'], 1)
if exchange == EXCHANGE_SHFE: if exchange == EXCHANGE_SHFE:
pos = posBuffer.updateShfeBuffer(data, size) posBuffer.updateShfeBuffer(data, size)
else: else:
pos = posBuffer.updateBuffer(data, size) posBuffer.updateBuffer(data, size)
# 所有持仓数据都更新后,再将缓存中的持仓情况发送到事件引擎中
if last:
for buf in self.posBufferDict.values():
pos = buf.getPos()
self.gateway.onPosition(pos) self.gateway.onPosition(pos)
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@ -1442,6 +1446,11 @@ class PositionBuffer(object):
return copy(self.pos) return copy(self.pos)
#----------------------------------------------------------------------
def getPos(self):
"""获取当前的持仓数据"""
return copy(self.pos)
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def test(): def test():