diff --git a/examples/VnTrader/CTP_connect.json b/examples/VnTrader/CTP_connect.json index e4bfa6b8..11beaff8 100644 --- a/examples/VnTrader/CTP_connect.json +++ b/examples/VnTrader/CTP_connect.json @@ -1,7 +1,7 @@ { "brokerID": "9999", - "mdAddress": "tcp://180.168.146.187:10011", - "tdAddress": "tcp://180.168.146.187:10001", - "userID": "simnow申请", - "password": "simnow申请" + "mdAddress": "tcp://180.168.146.187:10031", + "tdAddress": "tcp://180.168.146.187:10030", + "userID": "000300", + "password": "19890624" } \ No newline at end of file diff --git a/examples/WebTrader/CTP_connect.json b/examples/WebTrader/CTP_connect.json new file mode 100644 index 00000000..1b4d5a42 --- /dev/null +++ b/examples/WebTrader/CTP_connect.json @@ -0,0 +1,7 @@ +{ + "brokerID": "9999", + "mdAddress": "tcp://180.168.146.187:10011", + "tdAddress": "tcp://180.168.146.187:10001", + "userID": "000300", + "password": "19890624" +} \ No newline at end of file diff --git a/vnpy/api/qdp/vnqdpmd/test/mdtest.py b/vnpy/api/qdp/vnqdpmd/test/mdtest.py deleted file mode 100644 index e81ab31d..00000000 --- a/vnpy/api/qdp/vnqdpmd/test/mdtest.py +++ /dev/null @@ -1,172 +0,0 @@ -# encoding: UTF-8 - -import sys -from time import sleep - -from PyQt4 import QtGui - -from vnqdpmd import * - - -#---------------------------------------------------------------------- -def print_dict(d): - """按照键值打印一个字典""" - for key,value in d.items(): - print key + ':' + str(value) - - -#---------------------------------------------------------------------- -def simple_log(func): - """简单装饰器用于输出函数名""" - def wrapper(*args, **kw): - print "" - print str(func.__name__) - return func(*args, **kw) - return wrapper - - -######################################################################## -class TestMdApi(MdApi): - """测试用实例""" - - #---------------------------------------------------------------------- - def __init__(self): - """Constructor""" - super(TestMdApi, self).__init__() - - #---------------------------------------------------------------------- - @simple_log - def onFrontConnected(self): - """服务器连接""" - print(u'服务器连接') - pass - - #---------------------------------------------------------------------- - @simple_log - def onFrontDisconnected(self, n): - """服务器断开""" - print n - - #---------------------------------------------------------------------- - @simple_log - def onHeartBeatWarning(self, n): - """心跳报警""" - print n - - #---------------------------------------------------------------------- - @simple_log - def onRspError(self, error, n, last): - """错误""" - print_dict(error) - - @simple_log - #---------------------------------------------------------------------- - def onRspUserLogin(self, data, error, n, last): - """登陆回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRspUserLogout(self, data, error, n, last): - """登出回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRspSubMarketData(self, data, error, n, last): - """订阅合约回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRspUnSubMarketData(self, data, error, n, last): - """退订合约回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRtnDepthMarketData(self, data): - """行情推送""" - print_dict(data) - - #---------------------------------------------------------------------- - @simple_log - def onRspSubForQuoteRsp(self, data, error, n, last): - """订阅合约回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRspUnSubForQuoteRsp(self, data, error, n, last): - """退订合约回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRtnForQuoteRsp(self, data): - """行情推送""" - print_dict(data) - - -#---------------------------------------------------------------------- -def main(): - """主测试函数,出现堵塞时可以考虑使用sleep""" - reqid = 0 - - # 创建Qt应用对象,用于事件循环 - app = QtGui.QApplication(sys.argv) - - # 创建API对象 - api = TestMdApi() - - # 在C++环境中创建MdApi对象,传入参数是希望用来保存.con文件的地址 - api.createFtdcMdApi('') - - # 注册前置机地址 - api.registerFront("tcp://211:147.74.221:30007") - - # 初始化api,连接前置机 - api.init() - sleep(0.5) - - # 登陆 - loginReq = {} # 创建一个空字典 - loginReq['UserID'] = 't040' # 参数作为字典键值的方式传入 - loginReq['Password'] = '111111' # 键名和C++中的结构体成员名对应 - loginReq['BrokerID'] = 'guofu' - reqid = reqid + 1 # 请求数必须保持唯一性 - i = api.reqUserLogin(loginReq, 1) - sleep(0.5) - - ## 登出,测试出错(无此功能) - #reqid = reqid + 1 - #i = api.reqUserLogout({}, 1) - #sleep(0.5) - - ## 安全退出,测试通过 - #i = api.exit() - - ## 获取交易日,目前输出为空 - #day = api.getTradingDay() - #print 'Trading Day is:' + str(day) - #sleep(0.5) - - ## 订阅合约,测试通过 - i = api.subscribeMarketData('rb1710') - - ## 退订合约,测试通过 - #i = api.unSubscribeMarketData('IF1505') - - # 连续运行,用于输出行情 - app.exec_() - - - -if __name__ == '__main__': - main() diff --git a/vnpy/api/qdp/vnqdpmd/test/mdtest.py~ b/vnpy/api/qdp/vnqdpmd/test/mdtest.py~ deleted file mode 100644 index e81ab31d..00000000 --- a/vnpy/api/qdp/vnqdpmd/test/mdtest.py~ +++ /dev/null @@ -1,172 +0,0 @@ -# encoding: UTF-8 - -import sys -from time import sleep - -from PyQt4 import QtGui - -from vnqdpmd import * - - -#---------------------------------------------------------------------- -def print_dict(d): - """按照键值打印一个字典""" - for key,value in d.items(): - print key + ':' + str(value) - - -#---------------------------------------------------------------------- -def simple_log(func): - """简单装饰器用于输出函数名""" - def wrapper(*args, **kw): - print "" - print str(func.__name__) - return func(*args, **kw) - return wrapper - - -######################################################################## -class TestMdApi(MdApi): - """测试用实例""" - - #---------------------------------------------------------------------- - def __init__(self): - """Constructor""" - super(TestMdApi, self).__init__() - - #---------------------------------------------------------------------- - @simple_log - def onFrontConnected(self): - """服务器连接""" - print(u'服务器连接') - pass - - #---------------------------------------------------------------------- - @simple_log - def onFrontDisconnected(self, n): - """服务器断开""" - print n - - #---------------------------------------------------------------------- - @simple_log - def onHeartBeatWarning(self, n): - """心跳报警""" - print n - - #---------------------------------------------------------------------- - @simple_log - def onRspError(self, error, n, last): - """错误""" - print_dict(error) - - @simple_log - #---------------------------------------------------------------------- - def onRspUserLogin(self, data, error, n, last): - """登陆回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRspUserLogout(self, data, error, n, last): - """登出回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRspSubMarketData(self, data, error, n, last): - """订阅合约回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRspUnSubMarketData(self, data, error, n, last): - """退订合约回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRtnDepthMarketData(self, data): - """行情推送""" - print_dict(data) - - #---------------------------------------------------------------------- - @simple_log - def onRspSubForQuoteRsp(self, data, error, n, last): - """订阅合约回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRspUnSubForQuoteRsp(self, data, error, n, last): - """退订合约回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRtnForQuoteRsp(self, data): - """行情推送""" - print_dict(data) - - -#---------------------------------------------------------------------- -def main(): - """主测试函数,出现堵塞时可以考虑使用sleep""" - reqid = 0 - - # 创建Qt应用对象,用于事件循环 - app = QtGui.QApplication(sys.argv) - - # 创建API对象 - api = TestMdApi() - - # 在C++环境中创建MdApi对象,传入参数是希望用来保存.con文件的地址 - api.createFtdcMdApi('') - - # 注册前置机地址 - api.registerFront("tcp://211:147.74.221:30007") - - # 初始化api,连接前置机 - api.init() - sleep(0.5) - - # 登陆 - loginReq = {} # 创建一个空字典 - loginReq['UserID'] = 't040' # 参数作为字典键值的方式传入 - loginReq['Password'] = '111111' # 键名和C++中的结构体成员名对应 - loginReq['BrokerID'] = 'guofu' - reqid = reqid + 1 # 请求数必须保持唯一性 - i = api.reqUserLogin(loginReq, 1) - sleep(0.5) - - ## 登出,测试出错(无此功能) - #reqid = reqid + 1 - #i = api.reqUserLogout({}, 1) - #sleep(0.5) - - ## 安全退出,测试通过 - #i = api.exit() - - ## 获取交易日,目前输出为空 - #day = api.getTradingDay() - #print 'Trading Day is:' + str(day) - #sleep(0.5) - - ## 订阅合约,测试通过 - i = api.subscribeMarketData('rb1710') - - ## 退订合约,测试通过 - #i = api.unSubscribeMarketData('IF1505') - - # 连续运行,用于输出行情 - app.exec_() - - - -if __name__ == '__main__': - main() diff --git a/vnpy/api/qdp/vnqdpmd/test/qdpmdapi.dll b/vnpy/api/qdp/vnqdpmd/test/qdpmdapi.dll deleted file mode 100644 index 1ff67357..00000000 Binary files a/vnpy/api/qdp/vnqdpmd/test/qdpmdapi.dll and /dev/null differ diff --git a/vnpy/api/qdp/vnqdpmd/test/qdptraderapi.dll b/vnpy/api/qdp/vnqdpmd/test/qdptraderapi.dll deleted file mode 100644 index 71358c56..00000000 Binary files a/vnpy/api/qdp/vnqdpmd/test/qdptraderapi.dll and /dev/null differ diff --git a/vnpy/api/qdp/vnqdpmd/test/vnqdpmd.pyd b/vnpy/api/qdp/vnqdpmd/test/vnqdpmd.pyd deleted file mode 100644 index 80c9435c..00000000 Binary files a/vnpy/api/qdp/vnqdpmd/test/vnqdpmd.pyd and /dev/null differ diff --git a/vnpy/api/qdp/vnqdpmd/test/vnqdptd.pyd b/vnpy/api/qdp/vnqdpmd/test/vnqdptd.pyd deleted file mode 100644 index 6f72ad7f..00000000 Binary files a/vnpy/api/qdp/vnqdpmd/test/vnqdptd.pyd and /dev/null differ diff --git a/vnpy/api/qdp/vnqdptd/test/.tdtest.py.swp b/vnpy/api/qdp/vnqdptd/test/.tdtest.py.swp deleted file mode 100644 index 1c6e31a9..00000000 Binary files a/vnpy/api/qdp/vnqdptd/test/.tdtest.py.swp and /dev/null differ diff --git a/vnpy/api/qdp/vnqdptd/test/msvcp120.dll b/vnpy/api/qdp/vnqdptd/test/msvcp120.dll deleted file mode 100644 index a237d2d7..00000000 Binary files a/vnpy/api/qdp/vnqdptd/test/msvcp120.dll and /dev/null differ diff --git a/vnpy/api/qdp/vnqdptd/test/msvcp90.dll b/vnpy/api/qdp/vnqdptd/test/msvcp90.dll deleted file mode 100644 index 05c5545c..00000000 Binary files a/vnpy/api/qdp/vnqdptd/test/msvcp90.dll and /dev/null differ diff --git a/vnpy/api/qdp/vnqdptd/test/msvcr120.dll b/vnpy/api/qdp/vnqdptd/test/msvcr120.dll deleted file mode 100644 index 8c36149a..00000000 Binary files a/vnpy/api/qdp/vnqdptd/test/msvcr120.dll and /dev/null differ diff --git a/vnpy/api/qdp/vnqdptd/test/msvcr90.dll b/vnpy/api/qdp/vnqdptd/test/msvcr90.dll deleted file mode 100644 index 4fb9fae0..00000000 Binary files a/vnpy/api/qdp/vnqdptd/test/msvcr90.dll and /dev/null differ diff --git a/vnpy/api/qdp/vnqdptd/test/tdtest.py b/vnpy/api/qdp/vnqdptd/test/tdtest.py deleted file mode 100644 index d7fadfff..00000000 --- a/vnpy/api/qdp/vnqdptd/test/tdtest.py +++ /dev/null @@ -1,165 +0,0 @@ -# encoding: UTF-8 - -import sys -sys.path.append('./') - -from time import sleep - -from PyQt4 import QtGui - -from vnctptd import * - -#---------------------------------------------------------------------- -def print_dict(d): - """按照键值打印一个字典""" - for key,value in d.items(): - print key + ':' + str(value) - - -#---------------------------------------------------------------------- -def simple_log(func): - """简单装饰器用于输出函数名""" - def wrapper(*args, **kw): - print "" - print str(func.__name__) - return func(*args, **kw) - return wrapper - - -######################################################################## -class TestTdApi(TdApi): - """测试用实例""" - - #---------------------------------------------------------------------- - def __init__(self): - """Constructor""" - super(TestTdApi, self).__init__() - - #---------------------------------------------------------------------- - @simple_log - def onFrontConnected(self): - """服务器连接""" - pass - - #---------------------------------------------------------------------- - @simple_log - def onFrontDisconnected(self, n): - """服务器断开""" - print n - - #---------------------------------------------------------------------- - @simple_log - def onHeartBeatWarning(self, n): - """心跳报警""" - print n - - #---------------------------------------------------------------------- - @simple_log - def onRspError(self, error, n, last): - """错误""" - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRspUserLogin(self, data, error, n, last): - """登陆回报""" - print_dict(data) - print_dict(error) - self.brokerID = data['BrokerID'] - self.userID = data['UserID'] - self.frontID = data['FrontID'] - self.sessionID = data['SessionID'] - - #---------------------------------------------------------------------- - @simple_log - def onRspUserLogout(self, data, error, n, last): - """登出回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRspQrySettlementInfo(self, data, error, n, last): - """查询结算信息回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRspSettlementInfoConfirm(self, data, error, n, last): - """确认结算信息回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRspQryInstrument(self, data, error, n, last): - """查询合约回报""" - print_dict(data) - print_dict(error) - print n - print last - - -#---------------------------------------------------------------------- -def main(): - """主测试函数,出现堵塞时可以考虑使用sleep""" - reqid = 0 - - # 创建Qt应用对象,用于事件循环 - app = QtGui.QApplication(sys.argv) - - # 创建API对象,测试通过 - api = TestTdApi() - - # 在C++环境中创建MdApi对象,传入参数是希望用来保存.con文件的地址,测试通过 - api.createFtdcTraderApi('') - - # 设置数据流重传方式,测试通过 - api.subscribePrivateTopic(1) - api.subscribePublicTopic(1) - - # 注册前置机地址,测试通过 - api.registerFront("tcp://180.168.146.187:10031") - - # 初始化api,连接前置机,测试通过 - api.init() - sleep(0.5) - - # 登陆,测试通过 - loginReq = {} # 创建一个空字典 - loginReq['UserID'] = '053430' # 参数作为字典键值的方式传入 - loginReq['Password'] = 'js19891206' # 键名和C++中的结构体成员名对应 - loginReq['BrokerID'] = '9999' - reqid = reqid + 1 # 请求数必须保持唯一性 - i = api.reqUserLogin(loginReq, reqid) - sleep(0.5) - - ## 查询合约, 测试通过 - #reqid = reqid + 1 - #i = api.reqQryInstrument({}, reqid) - - ## 查询结算, 测试通过 - #req = {} - #req['BrokerID'] = api.brokerID - #req['InvestorID'] = api.userID - #reqid = reqid + 1 - #i = api.reqQrySettlementInfo(req, reqid) - #sleep(0.5) - - ## 确认结算, 测试通过 - #req = {} - #req['BrokerID'] = api.brokerID - #req['InvestorID'] = api.userID - #reqid = reqid + 1 - #i = api.reqSettlementInfoConfirm(req, reqid) - #sleep(0.5) - - - # 连续运行 - app.exec_() - - - -if __name__ == '__main__': - main() diff --git a/vnpy/api/qdp/vnqdptd/test/tdtest.py~ b/vnpy/api/qdp/vnqdptd/test/tdtest.py~ deleted file mode 100644 index 05b53657..00000000 --- a/vnpy/api/qdp/vnqdptd/test/tdtest.py~ +++ /dev/null @@ -1,165 +0,0 @@ -# encoding: UTF-8 - -import sys -sys.path.append('./') - -from time import sleep - -from PyQt4 import QtGui - -from vnctptd import * - -#---------------------------------------------------------------------- -def print_dict(d): - """按照键值打印一个字典""" - for key,value in d.items(): - print key + ':' + str(value) - - -#---------------------------------------------------------------------- -def simple_log(func): - """简单装饰器用于输出函数名""" - def wrapper(*args, **kw): - print "" - print str(func.__name__) - return func(*args, **kw) - return wrapper - - -######################################################################## -class TestTdApi(TdApi): - """测试用实例""" - - #---------------------------------------------------------------------- - def __init__(self): - """Constructor""" - super(TestTdApi, self).__init__() - - #---------------------------------------------------------------------- - @simple_log - def onFrontConnected(self): - """服务器连接""" - pass - - #---------------------------------------------------------------------- - @simple_log - def onFrontDisconnected(self, n): - """服务器断开""" - print n - - #---------------------------------------------------------------------- - @simple_log - def onHeartBeatWarning(self, n): - """心跳报警""" - print n - - #---------------------------------------------------------------------- - @simple_log - def onRspError(self, error, n, last): - """错误""" - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRspUserLogin(self, data, error, n, last): - """登陆回报""" - print_dict(data) - print_dict(error) - self.brokerID = data['BrokerID'] - self.userID = data['UserID'] - self.frontID = data['FrontID'] - self.sessionID = data['SessionID'] - - #---------------------------------------------------------------------- - @simple_log - def onRspUserLogout(self, data, error, n, last): - """登出回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRspQrySettlementInfo(self, data, error, n, last): - """查询结算信息回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRspSettlementInfoConfirm(self, data, error, n, last): - """确认结算信息回报""" - print_dict(data) - print_dict(error) - - #---------------------------------------------------------------------- - @simple_log - def onRspQryInstrument(self, data, error, n, last): - """查询合约回报""" - print_dict(data) - print_dict(error) - print n - print last - - -#---------------------------------------------------------------------- -def main(): - """主测试函数,出现堵塞时可以考虑使用sleep""" - reqid = 0 - - # 创建Qt应用对象,用于事件循环 - app = QtGui.QApplication(sys.argv) - - # 创建API对象,测试通过 - api = TestTdApi() - - # 在C++环境中创建MdApi对象,传入参数是希望用来保存.con文件的地址,测试通过 - api.createFtdcTraderApi('') - - # 设置数据流重传方式,测试通过 - api.subscribePrivateTopic(1) - api.subscribePublicTopic(1) - - # 注册前置机地址,测试通过 - api.registerFront("tcp://180.168.146.187:10031") - - # 初始化api,连接前置机,测试通过 - api.init() - sleep(0.5) - - # 登陆,测试通过 - loginReq = {} # 创建一个空字典 - loginReq['UserID'] = 'moonnejs' # 参数作为字典键值的方式传入 - loginReq['Password'] = 'js19891206' # 键名和C++中的结构体成员名对应 - loginReq['BrokerID'] = '9999' - reqid = reqid + 1 # 请求数必须保持唯一性 - i = api.reqUserLogin(loginReq, reqid) - sleep(0.5) - - ## 查询合约, 测试通过 - #reqid = reqid + 1 - #i = api.reqQryInstrument({}, reqid) - - ## 查询结算, 测试通过 - #req = {} - #req['BrokerID'] = api.brokerID - #req['InvestorID'] = api.userID - #reqid = reqid + 1 - #i = api.reqQrySettlementInfo(req, reqid) - #sleep(0.5) - - ## 确认结算, 测试通过 - #req = {} - #req['BrokerID'] = api.brokerID - #req['InvestorID'] = api.userID - #reqid = reqid + 1 - #i = api.reqSettlementInfoConfirm(req, reqid) - #sleep(0.5) - - - # 连续运行 - app.exec_() - - - -if __name__ == '__main__': - main() diff --git a/vnpy/api/qdp/vnqdptd/test/thosttraderapi.dll b/vnpy/api/qdp/vnqdptd/test/thosttraderapi.dll deleted file mode 100644 index 162cc143..00000000 Binary files a/vnpy/api/qdp/vnqdptd/test/thosttraderapi.dll and /dev/null differ diff --git a/vnpy/api/qdp/vnqdptd/test/vnctptd.pyd b/vnpy/api/qdp/vnqdptd/test/vnctptd.pyd deleted file mode 100644 index 7c6b86d9..00000000 Binary files a/vnpy/api/qdp/vnqdptd/test/vnctptd.pyd and /dev/null differ