vnpy/vn.rpc/testClient.py
chenxy123 f538e6aa12 增加vn.rpc模块功能:
1. 提供RpcObject用于兼容不同的序列化工具
2. 提供广播数据时的主题筛选功能,实现数据筛选的工作由python层下放到zmq c++底层,提高效率
2016-10-03 12:15:33 +08:00

33 lines
848 B
Python

# encoding: UTF-8
from time import sleep
from vnrpc import RpcClient
########################################################################
class TestClient(RpcClient):
""""""
#----------------------------------------------------------------------
def __init__(self, reqAddress, subAddress):
"""Constructor"""
super(TestClient, self).__init__(reqAddress, subAddress)
#----------------------------------------------------------------------
def callback(self, data):
"""回调函数实现"""
print 'client received:', data
if __name__ == '__main__':
reqAddress = 'tcp://localhost:2014'
subAddress = 'tcp://localhost:0602'
tc = TestClient(reqAddress, subAddress)
tc.subscribe('')
tc.start()
while 1:
print tc.add(1, 3)
sleep(2)