# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import warnings

from ziplime.data.data_sources.grpc.grpc_stubs.grpc.tradeapi.v1.marketdata import marketdata_service_pb2 as grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2

GRPC_GENERATED_VERSION = '1.74.0'
GRPC_VERSION = grpc.__version__
_version_not_supported = False

try:
    from grpc._utilities import first_version_is_lower
    _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
    _version_not_supported = True

if _version_not_supported:
    raise RuntimeError(
        f'The grpc package installed is at version {GRPC_VERSION},'
        + f' but the generated code in grpc/tradeapi/v1/marketdata/marketdata_service_pb2_grpc.py depends on'
        + f' grpcio>={GRPC_GENERATED_VERSION}.'
        + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
        + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
    )


class MarketDataServiceStub(object):
    def __init__(self, channel):
        self.Bars = channel.unary_unary(
                '/grpc.tradeapi.v1.marketdata.MarketDataService/Bars',
                request_serializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.BarsRequest.SerializeToString,
                response_deserializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.BarsResponse.FromString,
                _registered_method=True)
        self.LastQuote = channel.unary_unary(
                '/grpc.tradeapi.v1.marketdata.MarketDataService/LastQuote',
                request_serializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.QuoteRequest.SerializeToString,
                response_deserializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.QuoteResponse.FromString,
                _registered_method=True)
        self.OrderBook = channel.unary_unary(
                '/grpc.tradeapi.v1.marketdata.MarketDataService/OrderBook',
                request_serializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.OrderBookRequest.SerializeToString,
                response_deserializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.OrderBookResponse.FromString,
                _registered_method=True)
        self.LatestTrades = channel.unary_unary(
                '/grpc.tradeapi.v1.marketdata.MarketDataService/LatestTrades',
                request_serializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.LatestTradesRequest.SerializeToString,
                response_deserializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.LatestTradesResponse.FromString,
                _registered_method=True)
        self.SubscribeQuote = channel.unary_stream(
                '/grpc.tradeapi.v1.marketdata.MarketDataService/SubscribeQuote',
                request_serializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeQuoteRequest.SerializeToString,
                response_deserializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeQuoteResponse.FromString,
                _registered_method=True)
        self.SubscribeOrderBook = channel.unary_stream(
                '/grpc.tradeapi.v1.marketdata.MarketDataService/SubscribeOrderBook',
                request_serializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeOrderBookRequest.SerializeToString,
                response_deserializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeOrderBookResponse.FromString,
                _registered_method=True)
        self.SubscribeLatestTrades = channel.unary_stream(
                '/grpc.tradeapi.v1.marketdata.MarketDataService/SubscribeLatestTrades',
                request_serializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeLatestTradesRequest.SerializeToString,
                response_deserializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeLatestTradesResponse.FromString,
                _registered_method=True)
        self.SubscribeBars = channel.unary_stream(
                '/grpc.tradeapi.v1.marketdata.MarketDataService/SubscribeBars',
                request_serializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeBarsRequest.SerializeToString,
                response_deserializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeBarsResponse.FromString,
                _registered_method=True)


class MarketDataServiceServicer(object):
    def Bars(self, request, context):
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def LastQuote(self, request, context):
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def OrderBook(self, request, context):
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def LatestTrades(self, request, context):
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SubscribeQuote(self, request, context):
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SubscribeOrderBook(self, request, context):
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SubscribeLatestTrades(self, request, context):
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SubscribeBars(self, request, context):
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_MarketDataServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Bars': grpc.unary_unary_rpc_method_handler(
                    servicer.Bars,
                    request_deserializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.BarsRequest.FromString,
                    response_serializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.BarsResponse.SerializeToString,
            ),
            'LastQuote': grpc.unary_unary_rpc_method_handler(
                    servicer.LastQuote,
                    request_deserializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.QuoteRequest.FromString,
                    response_serializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.QuoteResponse.SerializeToString,
            ),
            'OrderBook': grpc.unary_unary_rpc_method_handler(
                    servicer.OrderBook,
                    request_deserializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.OrderBookRequest.FromString,
                    response_serializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.OrderBookResponse.SerializeToString,
            ),
            'LatestTrades': grpc.unary_unary_rpc_method_handler(
                    servicer.LatestTrades,
                    request_deserializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.LatestTradesRequest.FromString,
                    response_serializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.LatestTradesResponse.SerializeToString,
            ),
            'SubscribeQuote': grpc.unary_stream_rpc_method_handler(
                    servicer.SubscribeQuote,
                    request_deserializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeQuoteRequest.FromString,
                    response_serializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeQuoteResponse.SerializeToString,
            ),
            'SubscribeOrderBook': grpc.unary_stream_rpc_method_handler(
                    servicer.SubscribeOrderBook,
                    request_deserializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeOrderBookRequest.FromString,
                    response_serializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeOrderBookResponse.SerializeToString,
            ),
            'SubscribeLatestTrades': grpc.unary_stream_rpc_method_handler(
                    servicer.SubscribeLatestTrades,
                    request_deserializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeLatestTradesRequest.FromString,
                    response_serializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeLatestTradesResponse.SerializeToString,
            ),
            'SubscribeBars': grpc.unary_stream_rpc_method_handler(
                    servicer.SubscribeBars,
                    request_deserializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeBarsRequest.FromString,
                    response_serializer=grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeBarsResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'grpc.tradeapi.v1.marketdata.MarketDataService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('grpc.tradeapi.v1.marketdata.MarketDataService', rpc_method_handlers)


class MarketDataService(object):
    @staticmethod
    def Bars(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,
            '/grpc.tradeapi.v1.marketdata.MarketDataService/Bars',
            grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.BarsRequest.SerializeToString,
            grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.BarsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def LastQuote(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,
            '/grpc.tradeapi.v1.marketdata.MarketDataService/LastQuote',
            grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.QuoteRequest.SerializeToString,
            grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.QuoteResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def OrderBook(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,
            '/grpc.tradeapi.v1.marketdata.MarketDataService/OrderBook',
            grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.OrderBookRequest.SerializeToString,
            grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.OrderBookResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def LatestTrades(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,
            '/grpc.tradeapi.v1.marketdata.MarketDataService/LatestTrades',
            grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.LatestTradesRequest.SerializeToString,
            grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.LatestTradesResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def SubscribeQuote(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,
            '/grpc.tradeapi.v1.marketdata.MarketDataService/SubscribeQuote',
            grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeQuoteRequest.SerializeToString,
            grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeQuoteResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def SubscribeOrderBook(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,
            '/grpc.tradeapi.v1.marketdata.MarketDataService/SubscribeOrderBook',
            grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeOrderBookRequest.SerializeToString,
            grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeOrderBookResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def SubscribeLatestTrades(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,
            '/grpc.tradeapi.v1.marketdata.MarketDataService/SubscribeLatestTrades',
            grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeLatestTradesRequest.SerializeToString,
            grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeLatestTradesResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def SubscribeBars(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,
            '/grpc.tradeapi.v1.marketdata.MarketDataService/SubscribeBars',
            grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeBarsRequest.SerializeToString,
            grpc_dot_tradeapi_dot_v1_dot_marketdata_dot_marketdata__service__pb2.SubscribeBarsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
