Merge branch 'dev' of https://github.com/vnpy/vnpy into dev
This commit is contained in:
commit
ef1ef110a9
@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from vncshshlp import CsHsHlp
|
||||
from __future__ import absolute_import
|
||||
from .vncshshlp import CsHsHlp
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
from time import sleep
|
||||
|
||||
@ -14,21 +15,21 @@ branch_no = ''
|
||||
def print_list(l):
|
||||
""""""
|
||||
for d in l:
|
||||
print d
|
||||
print(d)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def print_dict(d):
|
||||
"""按照键值打印一个字典"""
|
||||
for key,value in d.items():
|
||||
print key + ':' + str(value)
|
||||
print(key + ':' + str(value))
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def simple_log(func):
|
||||
"""简单装饰器用于输出函数名"""
|
||||
def wrapper(*args, **kw):
|
||||
print '-' * 20
|
||||
print str(func.__name__)
|
||||
print('-' * 20)
|
||||
print(str(func.__name__))
|
||||
return func(*args, **kw)
|
||||
return wrapper
|
||||
|
||||
@ -59,18 +60,18 @@ class TestHlp(CsHsHlp):
|
||||
@simple_log
|
||||
def onMsg(self, type_, data, reqNo, errorNo, errorInfo):
|
||||
""""""
|
||||
print 'type:', type_
|
||||
print('type:', type_)
|
||||
# print_list(data)
|
||||
print 'reqNo:', reqNo
|
||||
print 'errorNo:', errorNo
|
||||
print 'errorInfo:', errorInfo
|
||||
print('reqNo:', reqNo)
|
||||
print('errorNo:', errorNo)
|
||||
print('errorInfo:', errorInfo)
|
||||
'''
|
||||
for i in data[0].keys():
|
||||
print "key=%s,value=%s"%(i,data[0][i])
|
||||
'''
|
||||
|
||||
for dd in data:
|
||||
print dd
|
||||
print(dd)
|
||||
|
||||
self.data = data
|
||||
|
||||
@ -101,23 +102,23 @@ class TestHlp(CsHsHlp):
|
||||
'''
|
||||
i = self.loadConfig("Hsconfig.ini")
|
||||
if i:
|
||||
print u'加载配置失败:', i
|
||||
print(u'加载配置失败:', i)
|
||||
return i
|
||||
print u'加载配置成功'
|
||||
print(u'加载配置成功')
|
||||
|
||||
# 初始化
|
||||
i = self.init()
|
||||
if i:
|
||||
print u'初始化失败:', i
|
||||
print(u'初始化失败:', i)
|
||||
return i
|
||||
print u'初始化成功'
|
||||
print(u'初始化成功')
|
||||
|
||||
# 连接服务器
|
||||
i = self.connectServer()
|
||||
if i:
|
||||
print u'服务器连接失败:', i
|
||||
print(u'服务器连接失败:', i)
|
||||
return i
|
||||
print u'服务器连接成功'
|
||||
print(u'服务器连接成功')
|
||||
|
||||
return int(0)
|
||||
|
||||
@ -135,10 +136,10 @@ def test():
|
||||
# 初始化端口
|
||||
i = api.init_api()
|
||||
if i:
|
||||
print u'初始化端口失败,请检查clog文件', i
|
||||
print(u'初始化端口失败,请检查clog文件', i)
|
||||
return
|
||||
# 登录
|
||||
print u'尝试登录'
|
||||
print(u'尝试登录')
|
||||
i = api.beginParam()
|
||||
api.setValue("identity_type", "2")
|
||||
api.setValue("password_type", "2")
|
||||
@ -150,7 +151,7 @@ def test():
|
||||
api.setValue('option_fund_account', account['id'])
|
||||
api.setValue('op_station', '<yangxs><vnpy><test>')
|
||||
i = api.bizCallAndCommit(331100)
|
||||
print u'尝试登录返回', i
|
||||
print(u'尝试登录返回', i)
|
||||
sleep(3)
|
||||
#---------------------------------------------------------
|
||||
# 配置self的变量
|
||||
@ -170,34 +171,34 @@ def test():
|
||||
api.request_num = '500'
|
||||
api.op_station = '<yangxs><vnpy><test>'
|
||||
else:
|
||||
print 'error in set the value'
|
||||
print('error in set the value')
|
||||
|
||||
|
||||
#------------------------------------------
|
||||
# 订阅 620001 成交回报 33011
|
||||
# 订阅 620001 委托回写 33012
|
||||
# api.setNessaryParam()
|
||||
print u'订阅 33011'
|
||||
print(u'订阅 33011')
|
||||
api.beginParam()
|
||||
acc_info = '~' .join([api.branch_no, api.fund_account])
|
||||
api.setValue('issue_type', "33011")
|
||||
api.setValue('acc_info', acc_info)
|
||||
i = api.subscribeData(620001)
|
||||
print i
|
||||
print(i)
|
||||
sleep(1)
|
||||
|
||||
|
||||
print u'订阅 33012'
|
||||
print(u'订阅 33012')
|
||||
api.beginParam()
|
||||
acc_info = '~' .join([api.branch_no, api.fund_account])
|
||||
api.setValue('issue_type', "33012")
|
||||
api.setValue('acc_info', acc_info)
|
||||
i = api.subscribeData(620001)
|
||||
print i
|
||||
print(i)
|
||||
sleep(1)
|
||||
|
||||
|
||||
print u'配置参数,进行下单'
|
||||
print(u'配置参数,进行下单')
|
||||
# 配置
|
||||
api.setNessaryParam()
|
||||
# 下单参数 338011
|
||||
@ -211,22 +212,22 @@ def test():
|
||||
api.setValue('entrust_prop', '0')
|
||||
api.setValue('covered_flag', '')
|
||||
i = api.bizCallAndCommit(338011)
|
||||
print u'尝试下单返回', i
|
||||
print(u'尝试下单返回', i)
|
||||
sleep(3)
|
||||
|
||||
|
||||
print u'查询持仓'
|
||||
print(u'查询持仓')
|
||||
# 查询持仓
|
||||
# api.beginParam()
|
||||
api.setNessaryParam()
|
||||
i = api.bizCallAndCommit(338023)
|
||||
sleep(3)
|
||||
print u'查询持仓返回',i
|
||||
print(u'查询持仓返回',i)
|
||||
if(len(api.data)):
|
||||
for dd in api.data:
|
||||
print "-----------------------"
|
||||
print("-----------------------")
|
||||
for i in dd.keys():
|
||||
print "key=%s,value=%s"%(i,api.data[0][i])
|
||||
print("key=%s,value=%s"%(i,api.data[0][i]))
|
||||
|
||||
# --------------------------------------------------------------------------
|
||||
# 测试撤单 338012,先下单,间隔后撤单
|
||||
@ -241,7 +242,7 @@ def test():
|
||||
api.setValue('entrust_prop', '0')
|
||||
api.setValue('covered_flag', '')
|
||||
i = api.bizCallAndCommit(338011)
|
||||
print u'尝试下单返回', i
|
||||
print(u'尝试下单返回', i)
|
||||
sleep(3)
|
||||
# print api.data
|
||||
|
||||
@ -251,16 +252,16 @@ def test():
|
||||
e_no = tt['entrust_no']
|
||||
api.order[e_no] = tt
|
||||
|
||||
print api.order
|
||||
print(api.order)
|
||||
api.setNessaryParam()
|
||||
api.setValue('exchange_type','1')
|
||||
for kk in api.order.keys():
|
||||
api.setValue('entrust_no', kk)
|
||||
i = api.bizCallAndCommit(338012)
|
||||
print u'尝试撤单', kk
|
||||
print(u'尝试撤单', kk)
|
||||
sleep(1)
|
||||
#pop or del
|
||||
print api.data
|
||||
print(api.data)
|
||||
|
||||
|
||||
#-----------------------------------
|
||||
@ -271,15 +272,15 @@ def test():
|
||||
|
||||
api.setValue('locate_entrust_no', kk)
|
||||
i = api.bizCallAndCommit(338020)
|
||||
print u'查询指定订单', kk
|
||||
print(u'查询指定订单', kk)
|
||||
sleep(1)
|
||||
print api.data
|
||||
print(api.data)
|
||||
|
||||
api.setNessaryParam()
|
||||
api.setValue('query_kind', '1')
|
||||
i = api.bizCallAndCommit(338020)
|
||||
sleep(1)
|
||||
print api.data
|
||||
print(api.data)
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from vnctpmd import MdApi
|
||||
from vnctptd import TdApi
|
||||
from ctp_data_type import defineDict
|
||||
from __future__ import absolute_import
|
||||
from .vnctpmd import MdApi
|
||||
from .vnctptd import TdApi
|
||||
from .ctp_data_type import defineDict
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
__author__ = 'CHENXY'
|
||||
|
||||
# C++和python类型的映射字典
|
||||
@ -92,9 +93,9 @@ def main():
|
||||
fcpp.close()
|
||||
fpy.close()
|
||||
|
||||
print u'data_type.py生成过程完成'
|
||||
print(u'data_type.py生成过程完成')
|
||||
except:
|
||||
print u'data_type.py生成过程出错'
|
||||
print(u'data_type.py生成过程出错')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
__author__ = 'CHENXY'
|
||||
|
||||
from ctp_struct import structDict
|
||||
@ -257,7 +258,7 @@ def createFunction(fcName, fcArgsTypeList, fcArgsValueList):
|
||||
ffunction.write(line)
|
||||
|
||||
if type_ == 'CThostFtdcInputOrderField':
|
||||
print(key, value)
|
||||
print((key, value))
|
||||
print(line)
|
||||
|
||||
ffunction.write('\tint i = this->api->' + fcName + '(&myreq, nRequestID);\n')
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
__author__ = 'CHENXY'
|
||||
|
||||
# C++和python类型的映射字典
|
||||
@ -92,9 +93,9 @@ def main():
|
||||
fcpp.close()
|
||||
fpy.close()
|
||||
|
||||
print u'data_type.py生成过程完成'
|
||||
print(u'data_type.py生成过程完成')
|
||||
except:
|
||||
print u'data_type.py生成过程出错'
|
||||
print(u'data_type.py生成过程出错')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
__author__ = 'CHENXY'
|
||||
|
||||
from string import join
|
||||
@ -250,8 +251,8 @@ def createFunction(fcName, fcArgsTypeList, fcArgsValueList):
|
||||
ffunction.write(line)
|
||||
|
||||
if type_ == 'CThostFtdcInputOrderField':
|
||||
print key, value
|
||||
print line
|
||||
print(key, value)
|
||||
print(line)
|
||||
|
||||
ffunction.write('\tint i = this->api->' + fcName + '(&myreq, nRequestID);\n')
|
||||
ffunction.write('\treturn i;\n')
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
from time import sleep
|
||||
|
||||
@ -12,15 +13,15 @@ from vnctpmd import *
|
||||
def print_dict(d):
|
||||
"""按照键值打印一个字典"""
|
||||
for key,value in d.items():
|
||||
print key + ':' + str(value)
|
||||
print(key + ':' + str(value))
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def simple_log(func):
|
||||
"""简单装饰器用于输出函数名"""
|
||||
def wrapper(*args, **kw):
|
||||
print ""
|
||||
print str(func.__name__)
|
||||
print("")
|
||||
print(str(func.__name__))
|
||||
return func(*args, **kw)
|
||||
return wrapper
|
||||
|
||||
@ -44,13 +45,13 @@ class TestMdApi(MdApi):
|
||||
@simple_log
|
||||
def onFrontDisconnected(self, n):
|
||||
"""服务器断开"""
|
||||
print n
|
||||
print(n)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
def onHeartBeatWarning(self, n):
|
||||
"""心跳报警"""
|
||||
print n
|
||||
print(n)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
from time import sleep
|
||||
|
||||
@ -11,15 +12,15 @@ from vnctptd import *
|
||||
def print_dict(d):
|
||||
"""按照键值打印一个字典"""
|
||||
for key,value in d.items():
|
||||
print key + ':' + str(value)
|
||||
print(key + ':' + str(value))
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def simple_log(func):
|
||||
"""简单装饰器用于输出函数名"""
|
||||
def wrapper(*args, **kw):
|
||||
print ""
|
||||
print str(func.__name__)
|
||||
print("")
|
||||
print(str(func.__name__))
|
||||
return func(*args, **kw)
|
||||
return wrapper
|
||||
|
||||
@ -43,13 +44,13 @@ class TestTdApi(TdApi):
|
||||
@simple_log
|
||||
def onFrontDisconnected(self, n):
|
||||
"""服务器断开"""
|
||||
print n
|
||||
print(n)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
def onHeartBeatWarning(self, n):
|
||||
"""心跳报警"""
|
||||
print n
|
||||
print(n)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
@ -95,8 +96,8 @@ class TestTdApi(TdApi):
|
||||
"""查询合约回报"""
|
||||
print_dict(data)
|
||||
print_dict(error)
|
||||
print n
|
||||
print last
|
||||
print(n)
|
||||
print(last)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from vnfemasmd import MdApi
|
||||
from vnfemastd import TdApi
|
||||
from femas_data_type import defineDict
|
||||
from __future__ import absolute_import
|
||||
from .vnfemasmd import MdApi
|
||||
from .vnfemastd import TdApi
|
||||
from .femas_data_type import defineDict
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
__author__ = 'CHENXY'
|
||||
|
||||
# C++和python类型的映射字典
|
||||
@ -88,9 +89,9 @@ def main():
|
||||
fcpp.close()
|
||||
fpy.close()
|
||||
|
||||
print u'data_type.py生成过程完成'
|
||||
print(u'data_type.py生成过程完成')
|
||||
except:
|
||||
print u'data_type.py生成过程出错'
|
||||
print(u'data_type.py生成过程出错')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
from time import sleep
|
||||
|
||||
@ -12,15 +13,15 @@ from vnfemasmd import *
|
||||
def print_dict(d):
|
||||
"""按照键值打印一个字典"""
|
||||
for key,value in d.items():
|
||||
print key + ':' + str(value)
|
||||
print(key + ':' + str(value))
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def simple_log(func):
|
||||
"""简单装饰器用于输出函数名"""
|
||||
def wrapper(*args, **kw):
|
||||
print ""
|
||||
print str(func.__name__)
|
||||
print("")
|
||||
print(str(func.__name__))
|
||||
return func(*args, **kw)
|
||||
return wrapper
|
||||
|
||||
@ -44,13 +45,13 @@ class TestMdApi(MdApi):
|
||||
@simple_log
|
||||
def onFrontDisconnected(self, n):
|
||||
"""服务器断开"""
|
||||
print n
|
||||
print(n)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
def onHeartBeatWarning(self, n):
|
||||
"""心跳报警"""
|
||||
print n
|
||||
print(n)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
from time import sleep
|
||||
|
||||
@ -11,15 +12,15 @@ from vnfemastd import *
|
||||
def print_dict(d):
|
||||
"""按照键值打印一个字典"""
|
||||
for key,value in d.items():
|
||||
print key + ':' + str(value)
|
||||
print(key + ':' + str(value))
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def simple_log(func):
|
||||
"""简单装饰器用于输出函数名"""
|
||||
def wrapper(*args, **kw):
|
||||
print ""
|
||||
print str(func.__name__)
|
||||
print("")
|
||||
print(str(func.__name__))
|
||||
return func(*args, **kw)
|
||||
return wrapper
|
||||
|
||||
@ -43,13 +44,13 @@ class TestTdApi(TdApi):
|
||||
@simple_log
|
||||
def onFrontDisconnected(self, n):
|
||||
"""服务器断开"""
|
||||
print n
|
||||
print(n)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
def onHeartBeatWarning(self, n):
|
||||
"""心跳报警"""
|
||||
print n
|
||||
print(n)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
@ -95,8 +96,8 @@ class TestTdApi(TdApi):
|
||||
"""查询合约回报"""
|
||||
print_dict(data)
|
||||
print_dict(error)
|
||||
print n
|
||||
print last
|
||||
print(n)
|
||||
print(last)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from vnfxcm import FxcmApi
|
||||
from __future__ import absolute_import
|
||||
from .vnfxcm import FxcmApi
|
@ -1,8 +1,10 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
from time import sleep
|
||||
|
||||
from vnfxcm import FxcmApi
|
||||
from .vnfxcm import FxcmApi
|
||||
|
||||
url = 'https://api-demo.fxcm.com:443'
|
||||
port = 443
|
||||
@ -10,10 +12,10 @@ token = '48055b5d9afac0a300143ac067ce04cd2430a434'
|
||||
proxy = 'https://localhost:1080'
|
||||
|
||||
api = FxcmApi()
|
||||
print 'api created'
|
||||
print('api created')
|
||||
|
||||
api.connect(url, port, token, proxy)
|
||||
print api.bearer
|
||||
print(api.bearer)
|
||||
|
||||
sleep(20)
|
||||
#api.getInstruments()
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
import json
|
||||
import requests
|
||||
from socketIO_client import SocketIO
|
||||
@ -334,32 +335,32 @@ class FxcmApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onConnect(self):
|
||||
"""连接回调"""
|
||||
print 'onConnect'
|
||||
print('onConnect')
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onDisconnect(self):
|
||||
"""断开回调"""
|
||||
print 'onClose'
|
||||
print('onClose')
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onError(self, error, reqid):
|
||||
"""错误回调"""
|
||||
print 'onError', error
|
||||
print('onError', error)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onGetInstruments(self, data, reqid):
|
||||
"""查询合约代码回调"""
|
||||
print data, reqid
|
||||
print(data, reqid)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onGetModel(self, data, reqid):
|
||||
"""查询表回调"""
|
||||
print '*' * 30
|
||||
print data
|
||||
print('*' * 30)
|
||||
print(data)
|
||||
for d in data['offers']:
|
||||
#if str(d['currency']) == 'EUR/USD':
|
||||
# print d
|
||||
print d['currency']#, d['visible']
|
||||
print(d['currency'])#, d['visible']
|
||||
#print len(data['summary'])
|
||||
#print data
|
||||
|
||||
@ -367,47 +368,47 @@ class FxcmApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onSubscribe(self, data, reqid):
|
||||
"""订阅行情回调"""
|
||||
print data, reqid
|
||||
print(data, reqid)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onUnsubscribe(self, data, reqid):
|
||||
"""退订行情回调"""
|
||||
print data, reqid
|
||||
print(data, reqid)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onSubscribeModel(self, data, reqid):
|
||||
"""订阅表回调"""
|
||||
print data, reqid
|
||||
print(data, reqid)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onUnsubscribeModel(self, data, reqid):
|
||||
"""退订表回调"""
|
||||
print data, reqid
|
||||
print(data, reqid)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onUpdateSubscriptions(self, data, reqid):
|
||||
"""订阅报价表回调"""
|
||||
print data, reqid
|
||||
print(data, reqid)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onOpenTrade(self, data, reqid):
|
||||
"""开仓回调"""
|
||||
print data, reqid
|
||||
print(data, reqid)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onCloseTrade(self, data, reqid):
|
||||
"""平仓回调"""
|
||||
print data, reqid
|
||||
print(data, reqid)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onChangeOrder(self, data, reqid):
|
||||
"""改单回调"""
|
||||
print data, reqid
|
||||
print(data, reqid)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onDeleteOrder(self, data, reqid):
|
||||
"""撤单回调"""
|
||||
print data, reqid
|
||||
print(data, reqid)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def processPriceUpdate(self, msg):
|
||||
@ -418,19 +419,19 @@ class FxcmApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def processModelUpdate(self, msg):
|
||||
"""表推送"""
|
||||
print msg
|
||||
print(msg)
|
||||
data = json.loads(msg)
|
||||
self.onModelUpdate(data)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onPriceUpdate(self, data):
|
||||
"""行情推送"""
|
||||
print data
|
||||
print(data)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onModelUpdate(self, data):
|
||||
"""表推送"""
|
||||
print data
|
||||
print(data)
|
||||
#print '*' * 30
|
||||
#fsubscribeModel
|
||||
#print len(data), data.get('isTotal', None), data
|
||||
|
@ -1,4 +1,5 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from vnksgoldtd import TdApi
|
||||
from ksgold_data_type import defineDict
|
||||
from __future__ import absolute_import
|
||||
from .vnksgoldtd import TdApi
|
||||
from .ksgold_data_type import defineDict
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
__author__ = 'CHENXY'
|
||||
|
||||
# C++和python类型的映射字典
|
||||
@ -48,7 +49,7 @@ def process_typedef(line):
|
||||
else:
|
||||
keyword = content[-1]
|
||||
keyword = keyword.replace(';\n', '')
|
||||
print content, keyword
|
||||
print(content, keyword)
|
||||
|
||||
if '[' in keyword:
|
||||
i = keyword.index('[')
|
||||
@ -91,15 +92,15 @@ def main():
|
||||
py_line = process_line(line)
|
||||
if py_line:
|
||||
fpy.write(py_line.decode('gbk').encode('utf-8'))
|
||||
print n
|
||||
print(n)
|
||||
|
||||
fcpp.close()
|
||||
fpy.close()
|
||||
|
||||
print u'data_type.py生成过程完成'
|
||||
except Exception, e:
|
||||
print u'data_type.py生成过程出错'
|
||||
print e
|
||||
print(u'data_type.py生成过程完成')
|
||||
except Exception as e:
|
||||
print(u'data_type.py生成过程出错')
|
||||
print(e)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
__author__ = 'CHENXY'
|
||||
|
||||
from ksgold_data_type import *
|
||||
@ -47,7 +48,7 @@ def main():
|
||||
n = line.index('//')
|
||||
line = line[:n]
|
||||
|
||||
print no, ':', line
|
||||
print(no, ':', line)
|
||||
|
||||
content = line.split('\t')
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from vnksotpmd import MdApi
|
||||
from vnksotptd import TdApi
|
||||
from ksotp_data_type import defineDict
|
||||
from __future__ import absolute_import
|
||||
from .vnksotpmd import MdApi
|
||||
from .vnksotptd import TdApi
|
||||
from .ksotp_data_type import defineDict
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
__author__ = 'CHENXY'
|
||||
|
||||
# C++和python类型的映射字典
|
||||
@ -88,9 +89,9 @@ def main():
|
||||
fcpp.close()
|
||||
fpy.close()
|
||||
|
||||
print u'data_type.py生成过程完成'
|
||||
print(u'data_type.py生成过程完成')
|
||||
except:
|
||||
print u'data_type.py生成过程出错'
|
||||
print(u'data_type.py生成过程出错')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
__author__ = 'CHENXY'
|
||||
|
||||
from ksotp_data_type import *
|
||||
@ -15,7 +16,7 @@ def main():
|
||||
fpy.write('\n')
|
||||
|
||||
for n, line in enumerate(fcpp):
|
||||
print n
|
||||
print(n)
|
||||
# 结构体申明注释
|
||||
if '///' in line and '\t' not in line:
|
||||
py_line = '#' + line[3:]
|
||||
@ -38,8 +39,8 @@ def main():
|
||||
try:
|
||||
type_ = typedefDict[typedef]
|
||||
except KeyError:
|
||||
print content
|
||||
print typedef
|
||||
print(content)
|
||||
print(typedef)
|
||||
|
||||
variable = content[2].replace(';\n', "")
|
||||
py_line = '%s["%s"] = "%s"\n' % (name, variable, type_)
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
from time import sleep
|
||||
|
||||
@ -12,15 +13,15 @@ from vnksotpmd import *
|
||||
def print_dict(d):
|
||||
"""按照键值打印一个字典"""
|
||||
for key,value in d.items():
|
||||
print key + ':' + str(value)
|
||||
print(key + ':' + str(value))
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def simple_log(func):
|
||||
"""简单装饰器用于输出函数名"""
|
||||
def wrapper(*args, **kw):
|
||||
print ""
|
||||
print str(func.__name__)
|
||||
print("")
|
||||
print(str(func.__name__))
|
||||
return func(*args, **kw)
|
||||
return wrapper
|
||||
|
||||
@ -44,7 +45,7 @@ class TestMdApi(MdApi):
|
||||
@simple_log
|
||||
def onFrontDisconnected(self, n):
|
||||
"""服务器断开"""
|
||||
print n
|
||||
print(n)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
from time import sleep
|
||||
|
||||
@ -11,15 +12,15 @@ from vnksotptd import *
|
||||
def print_dict(d):
|
||||
"""按照键值打印一个字典"""
|
||||
for key,value in d.items():
|
||||
print key + ':' + str(value)
|
||||
print(key + ':' + str(value))
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def simple_log(func):
|
||||
"""简单装饰器用于输出函数名"""
|
||||
def wrapper(*args, **kw):
|
||||
print ""
|
||||
print str(func.__name__)
|
||||
print("")
|
||||
print(str(func.__name__))
|
||||
return func(*args, **kw)
|
||||
return wrapper
|
||||
|
||||
@ -43,7 +44,7 @@ class TestTdApi(TdApi):
|
||||
@simple_log
|
||||
def onFrontDisconnected(self, n):
|
||||
"""服务器断开"""
|
||||
print n
|
||||
print(n)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
@ -89,8 +90,8 @@ class TestTdApi(TdApi):
|
||||
"""查询合约回报"""
|
||||
print_dict(data)
|
||||
print_dict(error)
|
||||
print n
|
||||
print last
|
||||
print(n)
|
||||
print(last)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from vnlbank import LbankApi
|
||||
from __future__ import absolute_import
|
||||
from .vnlbank import LbankApi
|
@ -1,8 +1,11 @@
|
||||
# encoding: utf-8
|
||||
|
||||
from __future__ import absolute_import
|
||||
from time import time, sleep
|
||||
|
||||
from vnlbank import LbankApi
|
||||
from six.moves import input
|
||||
|
||||
from .vnlbank import LbankApi
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
@ -44,4 +47,4 @@ if __name__ == '__main__':
|
||||
#api.getOrdersInfoHistory('btc_cny', '0', '1', '100')
|
||||
|
||||
# 阻塞
|
||||
raw_input()
|
||||
input()
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: utf-8
|
||||
|
||||
from __future__ import print_function
|
||||
import urllib
|
||||
import hashlib
|
||||
|
||||
@ -120,7 +121,7 @@ class LbankApi(object):
|
||||
# 请求成功
|
||||
else:
|
||||
if self.DEBUG:
|
||||
print callback.__name__
|
||||
print(callback.__name__)
|
||||
callback(data, req, reqID)
|
||||
|
||||
# 流控等待
|
||||
@ -149,7 +150,7 @@ class LbankApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onError(self, error, req, reqID):
|
||||
"""错误推送"""
|
||||
print error, req, reqID
|
||||
print(error, req, reqID)
|
||||
|
||||
###############################################
|
||||
# 行情接口
|
||||
@ -203,22 +204,22 @@ class LbankApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetTicker(self, data, req, reqID):
|
||||
"""查询行情回调"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def onGetDepth(self, data, req, reqID):
|
||||
"""查询深度回调"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def onGetTrades(self, data, req, reqID):
|
||||
"""查询历史成交"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def onGetKline(self, data, req, reqID):
|
||||
"""查询K线回报"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
###############################################
|
||||
# 交易接口
|
||||
@ -283,25 +284,25 @@ class LbankApi(object):
|
||||
# ----------------------------------------------------------------------
|
||||
def onGetUserInfo(self, data, req, reqID):
|
||||
"""查询账户信息"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def onCreateOrder(self, data, req, reqID):
|
||||
"""委托回报"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def onCancelOrder(self, data, req, reqID):
|
||||
"""撤单回报"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def onGetOrdersInfo(self, data, req, reqID):
|
||||
"""查询委托回报"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def onGetOrdersInfoHistory(self, data, req, reqID):
|
||||
"""撤单回报"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from vnltsmd import MdApi
|
||||
from vnltstd import TdApi
|
||||
from vnltsqry import QryApi
|
||||
from lts_data_type import defineDict
|
||||
from __future__ import absolute_import
|
||||
from .vnltsmd import MdApi
|
||||
from .vnltstd import TdApi
|
||||
from .vnltsqry import QryApi
|
||||
from .lts_data_type import defineDict
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
__author__ = 'CHENXY'
|
||||
|
||||
# C++和python类型的映射字典
|
||||
@ -88,9 +89,9 @@ def main():
|
||||
fcpp.close()
|
||||
fpy.close()
|
||||
|
||||
print u'data_type.py生成过程完成'
|
||||
print(u'data_type.py生成过程完成')
|
||||
except:
|
||||
print u'data_type.py生成过程出错'
|
||||
print(u'data_type.py生成过程出错')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
__author__ = 'CHENXY'
|
||||
|
||||
# C++和python类型的映射字典
|
||||
@ -88,9 +89,9 @@ def main():
|
||||
fcpp.close()
|
||||
fpy.close()
|
||||
|
||||
print u'data_type.py生成过程完成'
|
||||
print(u'data_type.py生成过程完成')
|
||||
except:
|
||||
print u'data_type.py生成过程出错'
|
||||
print(u'data_type.py生成过程出错')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -1,6 +1,7 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
# 内置模块
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
from time import sleep
|
||||
|
||||
@ -11,15 +12,15 @@ from vnltsmd import *
|
||||
def print_dict(d):
|
||||
"""按照键值打印一个字典"""
|
||||
for key,value in d.items():
|
||||
print key + ':' + str(value)
|
||||
print(key + ':' + str(value))
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def simple_log(func):
|
||||
"""简单装饰器用于输出函数名"""
|
||||
def wrapper(*args, **kw):
|
||||
print ""
|
||||
print str(func.__name__)
|
||||
print("")
|
||||
print(str(func.__name__))
|
||||
return func(*args, **kw)
|
||||
return wrapper
|
||||
|
||||
@ -43,13 +44,13 @@ class TestMdApi(MdApi):
|
||||
@simple_log
|
||||
def onFrontDisconnected(self, n):
|
||||
"""服务器断开"""
|
||||
print n
|
||||
print(n)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
def onHeartBeatWarning(self, n):
|
||||
"""心跳报警"""
|
||||
print n
|
||||
print(n)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
@ -124,7 +125,7 @@ def main():
|
||||
|
||||
#获取交易日,测试通过
|
||||
day = api.getTradingDay()
|
||||
print 'Trading Day is:' + str(day)
|
||||
print('Trading Day is:' + str(day))
|
||||
sleep(0.5)
|
||||
|
||||
# 订阅合约,测试通过
|
||||
|
@ -1,6 +1,7 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
# 内置模块
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
from time import sleep
|
||||
|
||||
@ -12,15 +13,15 @@ from lts_data_type import defineDict
|
||||
def print_dict(d):
|
||||
"""按照键值打印一个字典"""
|
||||
for key,value in d.items():
|
||||
print key + ':' + str(value)
|
||||
print(key + ':' + str(value))
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def simple_log(func):
|
||||
"""简单装饰器用于输出函数名"""
|
||||
def wrapper(*args, **kw):
|
||||
print ""
|
||||
print str(func.__name__)
|
||||
print("")
|
||||
print(str(func.__name__))
|
||||
return func(*args, **kw)
|
||||
return wrapper
|
||||
|
||||
@ -44,13 +45,13 @@ class TestQryApi(QryApi):
|
||||
@simple_log
|
||||
def onFrontDisconnected(self, n):
|
||||
"""服务器断开"""
|
||||
print n
|
||||
print(n)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
def onHeartBeatWarning(self, n):
|
||||
"""心跳报警"""
|
||||
print n
|
||||
print(n)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
|
@ -1,6 +1,7 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
# 内置模块
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
from time import sleep
|
||||
|
||||
@ -12,15 +13,15 @@ from lts_data_type import defineDict
|
||||
def print_dict(d):
|
||||
"""按照键值打印一个字典"""
|
||||
for key,value in d.items():
|
||||
print key + ':' + str(value)
|
||||
print(key + ':' + str(value))
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def simple_log(func):
|
||||
"""简单装饰器用于输出函数名"""
|
||||
def wrapper(*args, **kw):
|
||||
print ""
|
||||
print str(func.__name__)
|
||||
print("")
|
||||
print(str(func.__name__))
|
||||
return func(*args, **kw)
|
||||
return wrapper
|
||||
|
||||
@ -44,13 +45,13 @@ class TestTdApi(TdApi):
|
||||
@simple_log
|
||||
def onFrontDisconnected(self, n):
|
||||
"""服务器断开"""
|
||||
print n
|
||||
print(n)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
def onHeartBeatWarning(self, n):
|
||||
"""心跳报警"""
|
||||
print n
|
||||
print(n)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@simple_log
|
||||
|
@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from vnoanda import OandaApi
|
||||
from __future__ import absolute_import
|
||||
from .vnoanda import OandaApi
|
@ -1,6 +1,7 @@
|
||||
# encoding: utf-8
|
||||
|
||||
from vnoanda import OandaApi
|
||||
from __future__ import absolute_import
|
||||
from .vnoanda import OandaApi
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: utf-8
|
||||
|
||||
from __future__ import print_function
|
||||
import json
|
||||
import requests
|
||||
from Queue import Queue, Empty
|
||||
@ -208,7 +209,7 @@ class OandaApi(object):
|
||||
|
||||
try:
|
||||
r = self.session.send(pre, stream=stream)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
error = e
|
||||
|
||||
return r, error
|
||||
@ -228,9 +229,9 @@ class OandaApi(object):
|
||||
try:
|
||||
data = r.json()
|
||||
if self.DEBUG:
|
||||
print callback.__name__
|
||||
print(callback.__name__)
|
||||
callback(data, reqID)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.onError(str(e), reqID)
|
||||
else:
|
||||
self.onError(error, reqID)
|
||||
@ -260,7 +261,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onError(self, error, reqID):
|
||||
"""错误信息回调"""
|
||||
print error, reqID
|
||||
print(error, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getInstruments(self, params):
|
||||
@ -270,7 +271,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetInstruments(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getPrices(self, params):
|
||||
@ -280,7 +281,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetPrices(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getPriceHisory(self, params):
|
||||
@ -290,7 +291,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetPriceHistory(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getAccounts(self):
|
||||
@ -300,7 +301,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetAccounts(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getAccountInfo(self):
|
||||
@ -310,7 +311,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetAccountInfo(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getOrders(self, params):
|
||||
@ -320,7 +321,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetOrders(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def sendOrder(self, params):
|
||||
@ -330,7 +331,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onSendOrder(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getOrderInfo(self, optional):
|
||||
@ -340,7 +341,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetOrderInfo(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def modifyOrder(self, params, optional):
|
||||
@ -350,7 +351,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onModifyOrder(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def cancelOrder(self, optional):
|
||||
@ -360,7 +361,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onCancelOrder(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTrades(self, params):
|
||||
@ -370,7 +371,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetTrades(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTradeInfo(self, optional):
|
||||
@ -380,7 +381,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetTradeInfo(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def modifyTrade(self, params, optional):
|
||||
@ -390,7 +391,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onModifyTrade(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def closeTrade(self, optional):
|
||||
@ -400,7 +401,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onCloseTrade(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getPositions(self):
|
||||
@ -410,7 +411,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetPositions(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getPositionInfo(self, optional):
|
||||
@ -420,7 +421,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetPositionInfo(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def closePosition(self, optional):
|
||||
@ -430,7 +431,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onClosePosition(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
@ -441,7 +442,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetTransactions(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getTransactionInfo(self, optional):
|
||||
@ -451,7 +452,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetTransactionInfo(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getAccountHistory(self):
|
||||
@ -461,7 +462,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetAccountHistory(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getCalendar(self, params):
|
||||
@ -471,7 +472,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetCalendar(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getPositionRatios(self, params):
|
||||
@ -481,7 +482,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetPositionRatios(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getSpreads(self, params):
|
||||
@ -491,7 +492,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetSpreads(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getCommitments(self, params):
|
||||
@ -501,7 +502,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetCommitments(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getOrderbook(self, params):
|
||||
@ -511,7 +512,7 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetOrderbook(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def getAutochartist(self, params):
|
||||
@ -521,17 +522,17 @@ class OandaApi(object):
|
||||
#----------------------------------------------------------------------
|
||||
def onGetAutochartist(self, data, reqID):
|
||||
"""回调函数"""
|
||||
print data, reqID
|
||||
print(data, reqID)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onPrice(self, data):
|
||||
"""行情推送"""
|
||||
print data
|
||||
print(data)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def onEvent(self, data):
|
||||
"""事件推送(成交等)"""
|
||||
print data
|
||||
print(data)
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def processStreamPrices(self):
|
||||
@ -546,7 +547,7 @@ class OandaApi(object):
|
||||
try:
|
||||
data = r.json()
|
||||
symbols = [d['instrument'] for d in data['instruments']]
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.onError(e, -1)
|
||||
return
|
||||
else:
|
||||
@ -570,10 +571,10 @@ class OandaApi(object):
|
||||
msg = json.loads(line)
|
||||
|
||||
if self.DEBUG:
|
||||
print self.onPrice.__name__
|
||||
print(self.onPrice.__name__)
|
||||
|
||||
self.onPrice(msg)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.onError(e, -1)
|
||||
|
||||
if not self.active:
|
||||
@ -597,10 +598,10 @@ class OandaApi(object):
|
||||
msg = json.loads(line)
|
||||
|
||||
if self.DEBUG:
|
||||
print self.onEvent.__name__
|
||||
print(self.onEvent.__name__)
|
||||
|
||||
self.onEvent(msg)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.onError(e, -1)
|
||||
|
||||
if not self.active:
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from vnqdpmd import MdApi
|
||||
from vnqdptd import TdApi
|
||||
from qdp_data_type import defineDict
|
||||
from __future__ import absolute_import
|
||||
from .vnqdpmd import MdApi
|
||||
from .vnqdptd import TdApi
|
||||
from .qdp_data_type import defineDict
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
__author__ = 'CHENXY'
|
||||
|
||||
# C++和python类型的映射字典
|
||||
@ -92,9 +93,9 @@ def main():
|
||||
fcpp.close()
|
||||
fpy.close()
|
||||
|
||||
print u'data_type.py生成过程完成'
|
||||
print(u'data_type.py生成过程完成')
|
||||
except:
|
||||
print u'data_type.py生成过程出错'
|
||||
print(u'data_type.py生成过程出错')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -1,5 +1,6 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
from __future__ import print_function
|
||||
__author__ = 'CHENXY'
|
||||
|
||||
from string import join
|
||||
@ -250,8 +251,8 @@ def createFunction(fcName, fcArgsTypeList, fcArgsValueList):
|
||||
ffunction.write(line)
|
||||
|
||||
if type_ == 'CQdpFtdcInputOrderField':
|
||||
print key, value
|
||||
print line
|
||||
print(key, value)
|
||||
print(line)
|
||||
|
||||
ffunction.write('\tint i = this->api->' + fcName + '(&myreq, nRequestID);\n')
|
||||
ffunction.write('\treturn i;\n')
|
||||
|
Loading…
Reference in New Issue
Block a user