python: update grpc code

This commit is contained in:
なるみ 2022-04-13 23:22:13 +08:00
parent a4bf6daee6
commit 9b8eb0642d
2 changed files with 106 additions and 92 deletions

File diff suppressed because one or more lines are too long

View File

@ -17,7 +17,7 @@ class MarketDataServiceStub(object):
self.Subscribe = channel.unary_stream( self.Subscribe = channel.unary_stream(
'/bbgo.MarketDataService/Subscribe', '/bbgo.MarketDataService/Subscribe',
request_serializer=bbgo__pb2.SubscribeRequest.SerializeToString, request_serializer=bbgo__pb2.SubscribeRequest.SerializeToString,
response_deserializer=bbgo__pb2.SubscribeResponse.FromString, response_deserializer=bbgo__pb2.MarketData.FromString,
) )
self.QueryKLines = channel.unary_unary( self.QueryKLines = channel.unary_unary(
'/bbgo.MarketDataService/QueryKLines', '/bbgo.MarketDataService/QueryKLines',
@ -47,7 +47,7 @@ def add_MarketDataServiceServicer_to_server(servicer, server):
'Subscribe': grpc.unary_stream_rpc_method_handler( 'Subscribe': grpc.unary_stream_rpc_method_handler(
servicer.Subscribe, servicer.Subscribe,
request_deserializer=bbgo__pb2.SubscribeRequest.FromString, request_deserializer=bbgo__pb2.SubscribeRequest.FromString,
response_serializer=bbgo__pb2.SubscribeResponse.SerializeToString, response_serializer=bbgo__pb2.MarketData.SerializeToString,
), ),
'QueryKLines': grpc.unary_unary_rpc_method_handler( 'QueryKLines': grpc.unary_unary_rpc_method_handler(
servicer.QueryKLines, servicer.QueryKLines,
@ -77,7 +77,7 @@ class MarketDataService(object):
metadata=None): metadata=None):
return grpc.experimental.unary_stream(request, target, '/bbgo.MarketDataService/Subscribe', return grpc.experimental.unary_stream(request, target, '/bbgo.MarketDataService/Subscribe',
bbgo__pb2.SubscribeRequest.SerializeToString, bbgo__pb2.SubscribeRequest.SerializeToString,
bbgo__pb2.SubscribeResponse.FromString, bbgo__pb2.MarketData.FromString,
options, channel_credentials, options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata) insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@ -108,19 +108,18 @@ class UserDataServiceStub(object):
Args: Args:
channel: A grpc.Channel. channel: A grpc.Channel.
""" """
self.SubscribeUserData = channel.unary_stream( self.Subscribe = channel.unary_stream(
'/bbgo.UserDataService/SubscribeUserData', '/bbgo.UserDataService/Subscribe',
request_serializer=bbgo__pb2.Empty.SerializeToString, request_serializer=bbgo__pb2.UserDataRequest.SerializeToString,
response_deserializer=bbgo__pb2.SubscribeResponse.FromString, response_deserializer=bbgo__pb2.UserData.FromString,
) )
class UserDataServiceServicer(object): class UserDataServiceServicer(object):
"""Missing associated documentation comment in .proto file.""" """Missing associated documentation comment in .proto file."""
def SubscribeUserData(self, request, context): def Subscribe(self, request, context):
"""should support streaming """Missing associated documentation comment in .proto file."""
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!') context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!') raise NotImplementedError('Method not implemented!')
@ -128,10 +127,10 @@ class UserDataServiceServicer(object):
def add_UserDataServiceServicer_to_server(servicer, server): def add_UserDataServiceServicer_to_server(servicer, server):
rpc_method_handlers = { rpc_method_handlers = {
'SubscribeUserData': grpc.unary_stream_rpc_method_handler( 'Subscribe': grpc.unary_stream_rpc_method_handler(
servicer.SubscribeUserData, servicer.Subscribe,
request_deserializer=bbgo__pb2.Empty.FromString, request_deserializer=bbgo__pb2.UserDataRequest.FromString,
response_serializer=bbgo__pb2.SubscribeResponse.SerializeToString, response_serializer=bbgo__pb2.UserData.SerializeToString,
), ),
} }
generic_handler = grpc.method_handlers_generic_handler( generic_handler = grpc.method_handlers_generic_handler(
@ -144,7 +143,7 @@ class UserDataService(object):
"""Missing associated documentation comment in .proto file.""" """Missing associated documentation comment in .proto file."""
@staticmethod @staticmethod
def SubscribeUserData(request, def Subscribe(request,
target, target,
options=(), options=(),
channel_credentials=None, channel_credentials=None,
@ -154,9 +153,9 @@ class UserDataService(object):
wait_for_ready=None, wait_for_ready=None,
timeout=None, timeout=None,
metadata=None): metadata=None):
return grpc.experimental.unary_stream(request, target, '/bbgo.UserDataService/SubscribeUserData', return grpc.experimental.unary_stream(request, target, '/bbgo.UserDataService/Subscribe',
bbgo__pb2.Empty.SerializeToString, bbgo__pb2.UserDataRequest.SerializeToString,
bbgo__pb2.SubscribeResponse.FromString, bbgo__pb2.UserData.FromString,
options, channel_credentials, options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata) insecure, call_credentials, compression, wait_for_ready, timeout, metadata)