-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbroker_pb2_grpc.py
183 lines (157 loc) · 6.42 KB
/
broker_pb2_grpc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
import broker_pb2 as broker__pb2
import common_pb2 as common__pb2
class BrokerStub(object):
"""////////////////////////////////////////////////////////////////////////////
Services
////////////////////////////////////////////////////////////////////////////
Public API for traders
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.info = channel.unary_unary(
'/Broker/info',
request_serializer=common__pb2.Empty.SerializeToString,
response_deserializer=broker__pb2.BrokerInfo.FromString,
)
self.register = channel.unary_unary(
'/Broker/register',
request_serializer=broker__pb2.RegisterRequest.SerializeToString,
response_deserializer=broker__pb2.TraderResponse.FromString,
)
self.new_order = channel.unary_unary(
'/Broker/new_order',
request_serializer=broker__pb2.TraderRequest.SerializeToString,
response_deserializer=broker__pb2.TraderResponse.FromString,
)
self.cancel_order = channel.unary_unary(
'/Broker/cancel_order',
request_serializer=broker__pb2.TraderRequest.SerializeToString,
response_deserializer=broker__pb2.TraderResponse.FromString,
)
self.get_trader = channel.unary_unary(
'/Broker/get_trader',
request_serializer=broker__pb2.TraderRequest.SerializeToString,
response_deserializer=broker__pb2.TraderResponse.FromString,
)
class BrokerServicer(object):
"""////////////////////////////////////////////////////////////////////////////
Services
////////////////////////////////////////////////////////////////////////////
Public API for traders
"""
def info(self, request, context):
# missing associated documentation comment in .proto file
pass
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def register(self, request, context):
"""A trader must first register at the Broker and acquire a valid trader
ID and PIN.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def new_order(self, request, context):
"""Submits a new order.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def cancel_order(self, request, context):
"""Cancels a previously submitted order.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def get_trader(self, request, context):
"""Requests a full update of the trader data.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_BrokerServicer_to_server(servicer, server):
rpc_method_handlers = {
'info': grpc.unary_unary_rpc_method_handler(
servicer.info,
request_deserializer=common__pb2.Empty.FromString,
response_serializer=broker__pb2.BrokerInfo.SerializeToString,
),
'register': grpc.unary_unary_rpc_method_handler(
servicer.register,
request_deserializer=broker__pb2.RegisterRequest.FromString,
response_serializer=broker__pb2.TraderResponse.SerializeToString,
),
'new_order': grpc.unary_unary_rpc_method_handler(
servicer.new_order,
request_deserializer=broker__pb2.TraderRequest.FromString,
response_serializer=broker__pb2.TraderResponse.SerializeToString,
),
'cancel_order': grpc.unary_unary_rpc_method_handler(
servicer.cancel_order,
request_deserializer=broker__pb2.TraderRequest.FromString,
response_serializer=broker__pb2.TraderResponse.SerializeToString,
),
'get_trader': grpc.unary_unary_rpc_method_handler(
servicer.get_trader,
request_deserializer=broker__pb2.TraderRequest.FromString,
response_serializer=broker__pb2.TraderResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'Broker', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
class MarketDataStub(object):
"""Provides access to real-time market data
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.list_instruments = channel.unary_unary(
'/MarketData/list_instruments',
request_serializer=common__pb2.Empty.SerializeToString,
response_deserializer=common__pb2.InstrumentInfoList.FromString,
)
self.subscribe = channel.unary_stream(
'/MarketData/subscribe',
request_serializer=common__pb2.Empty.SerializeToString,
response_deserializer=broker__pb2.MarketSnapshot.FromString,
)
class MarketDataServicer(object):
"""Provides access to real-time market data
"""
def list_instruments(self, request, context):
"""Returns static properties of the instruments in the Exchange.
"""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def subscribe(self, request, context):
# missing associated documentation comment in .proto file
pass
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')
def add_MarketDataServicer_to_server(servicer, server):
rpc_method_handlers = {
'list_instruments': grpc.unary_unary_rpc_method_handler(
servicer.list_instruments,
request_deserializer=common__pb2.Empty.FromString,
response_serializer=common__pb2.InstrumentInfoList.SerializeToString,
),
'subscribe': grpc.unary_stream_rpc_method_handler(
servicer.subscribe,
request_deserializer=common__pb2.Empty.FromString,
response_serializer=broker__pb2.MarketSnapshot.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'MarketData', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))