diff --git a/vnpy/rpc/test_client.py b/examples/simple_rpc/test_client.py similarity index 74% rename from vnpy/rpc/test_client.py rename to examples/simple_rpc/test_client.py index 7a693a52..57dd0909 100644 --- a/vnpy/rpc/test_client.py +++ b/examples/simple_rpc/test_client.py @@ -20,15 +20,15 @@ class TestClient(RpcClient): """ Realize callable function """ - print('client received topic:', topic, ', data:', data) + print(f"client received topic:{topic}, data:{data}") -if __name__ == '__main__': - req_address = 'tcp://localhost:2014' - sub_address = 'tcp://localhost:0602' +if __name__ == "__main__": + req_address = "tcp://localhost:2014" + sub_address = "tcp://localhost:0602" tc = TestClient(req_address, sub_address) - tc.subscribeTopic('') + tc.subscribe_topic("") tc.start() while 1: diff --git a/vnpy/rpc/test_server.py b/examples/simple_rpc/test_server.py similarity index 72% rename from vnpy/rpc/test_server.py rename to examples/simple_rpc/test_server.py index 660168fc..3589bead 100644 --- a/vnpy/rpc/test_server.py +++ b/examples/simple_rpc/test_server.py @@ -22,19 +22,19 @@ class TestServer(RpcServer): """ Test function """ - print('receiving: %s, %s' % (a, b)) + print(f"receiving:{a} {b}") return a + b -if __name__ == '__main__': - rep_address = 'tcp://*:2014' - pub_address = 'tcp://*:0602' +if __name__ == "__main__": + rep_address = "tcp://*:2014" + pub_address = "tcp://*:0602" ts = TestServer(rep_address, pub_address) ts.start() while 1: - content = 'current server time is %s' % time() + content = f"current server time is {time()}" print(content) - ts.publish('test', content) + ts.publish("test", content) sleep(2)