Add python generated code

This commit is contained in:
なるみ 2022-03-07 11:59:02 +08:00
parent 6dcb6c2a0a
commit ddfe379c76
3 changed files with 2130 additions and 0 deletions

View File

@ -175,3 +175,6 @@ static: frontend/out/index.html pkg/server/assets.go
protobuf: protobuf:
protoc -I=$(PWD)/pkg/pb --go_out=$(PWD)/pkg/pb $(PWD)/pkg/pb/bbgo.proto protoc -I=$(PWD)/pkg/pb --go_out=$(PWD)/pkg/pb $(PWD)/pkg/pb/bbgo.proto
protobuf-py:
python -m grpc_tools.protoc -I$(PWD)/pkg/pb --python_out=$(PWD)/python/pybbgo --grpc_python_out=$(PWD)/python/pybbgo $(PWD)/pkg/pb/bbgo.proto

1828
python/pybbgo/bbgo_pb2.py Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,299 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import bbgo_pb2 as bbgo__pb2
class BBGOStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.Subcribe = channel.unary_stream(
'/pb.BBGO/Subcribe',
request_serializer=bbgo__pb2.SubscribeRequest.SerializeToString,
response_deserializer=bbgo__pb2.SubscribeResponse.FromString,
)
self.SubcribeUserData = channel.unary_stream(
'/pb.BBGO/SubcribeUserData',
request_serializer=bbgo__pb2.Empty.SerializeToString,
response_deserializer=bbgo__pb2.SubscribeResponse.FromString,
)
self.SubmitOrder = channel.unary_unary(
'/pb.BBGO/SubmitOrder',
request_serializer=bbgo__pb2.SubmitOrderRequest.SerializeToString,
response_deserializer=bbgo__pb2.SubmitOrderResponse.FromString,
)
self.CancelOrder = channel.unary_unary(
'/pb.BBGO/CancelOrder',
request_serializer=bbgo__pb2.CancelOrderRequest.SerializeToString,
response_deserializer=bbgo__pb2.CancelOrderResponse.FromString,
)
self.QueryOrder = channel.unary_unary(
'/pb.BBGO/QueryOrder',
request_serializer=bbgo__pb2.QueryOrderRequest.SerializeToString,
response_deserializer=bbgo__pb2.QueryOrderResponse.FromString,
)
self.QueryOrders = channel.unary_unary(
'/pb.BBGO/QueryOrders',
request_serializer=bbgo__pb2.QueryOrdersRequest.SerializeToString,
response_deserializer=bbgo__pb2.QueryOrdersResponse.FromString,
)
self.QueryTrades = channel.unary_unary(
'/pb.BBGO/QueryTrades',
request_serializer=bbgo__pb2.QueryTradesRequest.SerializeToString,
response_deserializer=bbgo__pb2.QueryTradesResponse.FromString,
)
self.QueryKLines = channel.unary_unary(
'/pb.BBGO/QueryKLines',
request_serializer=bbgo__pb2.QueryKLinesRequest.SerializeToString,
response_deserializer=bbgo__pb2.QueryKLinesResponse.FromString,
)
class BBGOServicer(object):
"""Missing associated documentation comment in .proto file."""
def Subcribe(self, request, context):
"""should support streaming
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def SubcribeUserData(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def SubmitOrder(self, request, context):
"""request-response
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def CancelOrder(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def QueryOrder(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def QueryOrders(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def QueryTrades(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def QueryKLines(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_BBGOServicer_to_server(servicer, server):
rpc_method_handlers = {
'Subcribe': grpc.unary_stream_rpc_method_handler(
servicer.Subcribe,
request_deserializer=bbgo__pb2.SubscribeRequest.FromString,
response_serializer=bbgo__pb2.SubscribeResponse.SerializeToString,
),
'SubcribeUserData': grpc.unary_stream_rpc_method_handler(
servicer.SubcribeUserData,
request_deserializer=bbgo__pb2.Empty.FromString,
response_serializer=bbgo__pb2.SubscribeResponse.SerializeToString,
),
'SubmitOrder': grpc.unary_unary_rpc_method_handler(
servicer.SubmitOrder,
request_deserializer=bbgo__pb2.SubmitOrderRequest.FromString,
response_serializer=bbgo__pb2.SubmitOrderResponse.SerializeToString,
),
'CancelOrder': grpc.unary_unary_rpc_method_handler(
servicer.CancelOrder,
request_deserializer=bbgo__pb2.CancelOrderRequest.FromString,
response_serializer=bbgo__pb2.CancelOrderResponse.SerializeToString,
),
'QueryOrder': grpc.unary_unary_rpc_method_handler(
servicer.QueryOrder,
request_deserializer=bbgo__pb2.QueryOrderRequest.FromString,
response_serializer=bbgo__pb2.QueryOrderResponse.SerializeToString,
),
'QueryOrders': grpc.unary_unary_rpc_method_handler(
servicer.QueryOrders,
request_deserializer=bbgo__pb2.QueryOrdersRequest.FromString,
response_serializer=bbgo__pb2.QueryOrdersResponse.SerializeToString,
),
'QueryTrades': grpc.unary_unary_rpc_method_handler(
servicer.QueryTrades,
request_deserializer=bbgo__pb2.QueryTradesRequest.FromString,
response_serializer=bbgo__pb2.QueryTradesResponse.SerializeToString,
),
'QueryKLines': grpc.unary_unary_rpc_method_handler(
servicer.QueryKLines,
request_deserializer=bbgo__pb2.QueryKLinesRequest.FromString,
response_serializer=bbgo__pb2.QueryKLinesResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'pb.BBGO', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class BBGO(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def Subcribe(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_stream(request, target, '/pb.BBGO/Subcribe',
bbgo__pb2.SubscribeRequest.SerializeToString,
bbgo__pb2.SubscribeResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def SubcribeUserData(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_stream(request, target, '/pb.BBGO/SubcribeUserData',
bbgo__pb2.Empty.SerializeToString,
bbgo__pb2.SubscribeResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def SubmitOrder(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/pb.BBGO/SubmitOrder',
bbgo__pb2.SubmitOrderRequest.SerializeToString,
bbgo__pb2.SubmitOrderResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def CancelOrder(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/pb.BBGO/CancelOrder',
bbgo__pb2.CancelOrderRequest.SerializeToString,
bbgo__pb2.CancelOrderResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def QueryOrder(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/pb.BBGO/QueryOrder',
bbgo__pb2.QueryOrderRequest.SerializeToString,
bbgo__pb2.QueryOrderResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def QueryOrders(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/pb.BBGO/QueryOrders',
bbgo__pb2.QueryOrdersRequest.SerializeToString,
bbgo__pb2.QueryOrdersResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def QueryTrades(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/pb.BBGO/QueryTrades',
bbgo__pb2.QueryTradesRequest.SerializeToString,
bbgo__pb2.QueryTradesResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def QueryKLines(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/pb.BBGO/QueryKLines',
bbgo__pb2.QueryKLinesRequest.SerializeToString,
bbgo__pb2.QueryKLinesResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)