# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc

import api.tradeApi_pb2 as tradeApi__pb2


class TradeStub(object):
    """The greeting service definition.
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.sayHello = channel.unary_unary(
                '/Trade.Trade/sayHello',
                request_serializer=tradeApi__pb2.JSONRequest.SerializeToString,
                response_deserializer=tradeApi__pb2.JSONResponse.FromString,
                )
        self.getPos = channel.unary_unary(
                '/Trade.Trade/getPos',
                request_serializer=tradeApi__pb2.JSONRequest.SerializeToString,
                response_deserializer=tradeApi__pb2.RspPosition.FromString,
                )
        self.getOrders = channel.unary_unary(
                '/Trade.Trade/getOrders',
                request_serializer=tradeApi__pb2.ReqQuery.SerializeToString,
                response_deserializer=tradeApi__pb2.RspOrders.FromString,
                )
        self.getTrans = channel.unary_unary(
                '/Trade.Trade/getTrans',
                request_serializer=tradeApi__pb2.ReqQuery.SerializeToString,
                response_deserializer=tradeApi__pb2.RspTrans.FromString,
                )
        self.getOrder_stream = channel.unary_stream(
                '/Trade.Trade/getOrder_stream',
                request_serializer=tradeApi__pb2.JSONRequest.SerializeToString,
                response_deserializer=tradeApi__pb2.RspOrders.FromString,
                )
        self.getTrans_stream = channel.unary_stream(
                '/Trade.Trade/getTrans_stream',
                request_serializer=tradeApi__pb2.JSONRequest.SerializeToString,
                response_deserializer=tradeApi__pb2.RspTrans.FromString,
                )
        self.cancelOrder = channel.unary_unary(
                '/Trade.Trade/cancelOrder',
                request_serializer=tradeApi__pb2.ReqCancelOrder.SerializeToString,
                response_deserializer=tradeApi__pb2.RspCancelOrder.FromString,
                )
        self.sendOrder = channel.unary_unary(
                '/Trade.Trade/sendOrder',
                request_serializer=tradeApi__pb2.ReqSentOrder.SerializeToString,
                response_deserializer=tradeApi__pb2.RspSentOrder.FromString,
                )


class TradeServicer(object):
    """The greeting service definition.
    """

    def sayHello(self, request, context):
        """Sends a greeting
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def getPos(self, request, context):
        """获取仓位情况 - proto
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def getOrders(self, request, context):
        """获取报单情况 - proto
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def getTrans(self, request, context):
        """获取成交情况 - proto
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def getOrder_stream(self, request, context):
        """服务端推送报单数据 - stream
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def getTrans_stream(self, request, context):
        """服务端推送交易数据 - stream
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def cancelOrder(self, request, context):
        """撤单请求
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def sendOrder(self, request, context):
        """报单请求
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_TradeServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'sayHello': grpc.unary_unary_rpc_method_handler(
                    servicer.sayHello,
                    request_deserializer=tradeApi__pb2.JSONRequest.FromString,
                    response_serializer=tradeApi__pb2.JSONResponse.SerializeToString,
            ),
            'getPos': grpc.unary_unary_rpc_method_handler(
                    servicer.getPos,
                    request_deserializer=tradeApi__pb2.JSONRequest.FromString,
                    response_serializer=tradeApi__pb2.RspPosition.SerializeToString,
            ),
            'getOrders': grpc.unary_unary_rpc_method_handler(
                    servicer.getOrders,
                    request_deserializer=tradeApi__pb2.ReqQuery.FromString,
                    response_serializer=tradeApi__pb2.RspOrders.SerializeToString,
            ),
            'getTrans': grpc.unary_unary_rpc_method_handler(
                    servicer.getTrans,
                    request_deserializer=tradeApi__pb2.ReqQuery.FromString,
                    response_serializer=tradeApi__pb2.RspTrans.SerializeToString,
            ),
            'getOrder_stream': grpc.unary_stream_rpc_method_handler(
                    servicer.getOrder_stream,
                    request_deserializer=tradeApi__pb2.JSONRequest.FromString,
                    response_serializer=tradeApi__pb2.RspOrders.SerializeToString,
            ),
            'getTrans_stream': grpc.unary_stream_rpc_method_handler(
                    servicer.getTrans_stream,
                    request_deserializer=tradeApi__pb2.JSONRequest.FromString,
                    response_serializer=tradeApi__pb2.RspTrans.SerializeToString,
            ),
            'cancelOrder': grpc.unary_unary_rpc_method_handler(
                    servicer.cancelOrder,
                    request_deserializer=tradeApi__pb2.ReqCancelOrder.FromString,
                    response_serializer=tradeApi__pb2.RspCancelOrder.SerializeToString,
            ),
            'sendOrder': grpc.unary_unary_rpc_method_handler(
                    servicer.sendOrder,
                    request_deserializer=tradeApi__pb2.ReqSentOrder.FromString,
                    response_serializer=tradeApi__pb2.RspSentOrder.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'Trade.Trade', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class Trade(object):
    """The greeting service definition.
    """

    @staticmethod
    def sayHello(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/Trade.Trade/sayHello',
            tradeApi__pb2.JSONRequest.SerializeToString,
            tradeApi__pb2.JSONResponse.FromString,
            options, channel_credentials,
            call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def getPos(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/Trade.Trade/getPos',
            tradeApi__pb2.JSONRequest.SerializeToString,
            tradeApi__pb2.RspPosition.FromString,
            options, channel_credentials,
            call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def getOrders(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/Trade.Trade/getOrders',
            tradeApi__pb2.ReqQuery.SerializeToString,
            tradeApi__pb2.RspOrders.FromString,
            options, channel_credentials,
            call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def getTrans(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/Trade.Trade/getTrans',
            tradeApi__pb2.ReqQuery.SerializeToString,
            tradeApi__pb2.RspTrans.FromString,
            options, channel_credentials,
            call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def getOrder_stream(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_stream(request, target, '/Trade.Trade/getOrder_stream',
            tradeApi__pb2.JSONRequest.SerializeToString,
            tradeApi__pb2.RspOrders.FromString,
            options, channel_credentials,
            call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def getTrans_stream(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_stream(request, target, '/Trade.Trade/getTrans_stream',
            tradeApi__pb2.JSONRequest.SerializeToString,
            tradeApi__pb2.RspTrans.FromString,
            options, channel_credentials,
            call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def cancelOrder(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/Trade.Trade/cancelOrder',
            tradeApi__pb2.ReqCancelOrder.SerializeToString,
            tradeApi__pb2.RspCancelOrder.FromString,
            options, channel_credentials,
            call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def sendOrder(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(request, target, '/Trade.Trade/sendOrder',
            tradeApi__pb2.ReqSentOrder.SerializeToString,
            tradeApi__pb2.RspSentOrder.FromString,
            options, channel_credentials,
            call_credentials, compression, wait_for_ready, timeout, metadata)
