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

from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
from . import mt5_term_api_trade_functions_pb2 as mt5__term__api__trade__functions__pb2


class TradeFunctionsStub(object):
    """Missing associated documentation comment in .proto file."""

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

        Args:
            channel: A grpc.Channel.
        """
        self.OrderCalcMargin = channel.unary_unary(
                '/mt5_term_api.TradeFunctions/OrderCalcMargin',
                request_serializer=mt5__term__api__trade__functions__pb2.OrderCalcMarginRequest.SerializeToString,
                response_deserializer=mt5__term__api__trade__functions__pb2.OrderCalcMarginReply.FromString,
                )
        self.OrderCalcProfit = channel.unary_unary(
                '/mt5_term_api.TradeFunctions/OrderCalcProfit',
                request_serializer=mt5__term__api__trade__functions__pb2.OrderCalcProfitRequest.SerializeToString,
                response_deserializer=mt5__term__api__trade__functions__pb2.OrderCalcProfitReply.FromString,
                )
        self.OrderCheck = channel.unary_unary(
                '/mt5_term_api.TradeFunctions/OrderCheck',
                request_serializer=mt5__term__api__trade__functions__pb2.OrderCheckRequest.SerializeToString,
                response_deserializer=mt5__term__api__trade__functions__pb2.OrderCheckReply.FromString,
                )
        self.PositionsTotal = channel.unary_unary(
                '/mt5_term_api.TradeFunctions/PositionsTotal',
                request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
                response_deserializer=mt5__term__api__trade__functions__pb2.PositionsTotalReply.FromString,
                )


class TradeFunctionsServicer(object):
    """Missing associated documentation comment in .proto file."""

    def OrderCalcMargin(self, request, context):
        """The function calculates the margin required for the specified order type, on the current account, in the current market environment not taking into account current pending orders and open positions. It allows the evaluation of margin for the trade operation planned. The value is returned in the account currency +
        https://www.mql5.com/en/docs/trading/ordercalcmargin
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def OrderCalcProfit(self, request, context):
        """The function calculates the profit for the current account, in the current market conditions, based on the parameters passed. The function is used for pre-evaluation of the result of a trade operation. The value is returned in the account currency. + 
        https://www.mql5.com/en/docs/trading/ordercalcprofit
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def OrderCheck(self, request, context):
        """Checks if there are enough money to execute a required Trade Operation Type +
        https://www.mql5.com/en/docs/trading/ordercheck
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def PositionsTotal(self, request, context):
        """Returns the number of open positions +
        https://www.mql5.com/en/docs/trading/positionstotal
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_TradeFunctionsServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'OrderCalcMargin': grpc.unary_unary_rpc_method_handler(
                    servicer.OrderCalcMargin,
                    request_deserializer=mt5__term__api__trade__functions__pb2.OrderCalcMarginRequest.FromString,
                    response_serializer=mt5__term__api__trade__functions__pb2.OrderCalcMarginReply.SerializeToString,
            ),
            'OrderCalcProfit': grpc.unary_unary_rpc_method_handler(
                    servicer.OrderCalcProfit,
                    request_deserializer=mt5__term__api__trade__functions__pb2.OrderCalcProfitRequest.FromString,
                    response_serializer=mt5__term__api__trade__functions__pb2.OrderCalcProfitReply.SerializeToString,
            ),
            'OrderCheck': grpc.unary_unary_rpc_method_handler(
                    servicer.OrderCheck,
                    request_deserializer=mt5__term__api__trade__functions__pb2.OrderCheckRequest.FromString,
                    response_serializer=mt5__term__api__trade__functions__pb2.OrderCheckReply.SerializeToString,
            ),
            'PositionsTotal': grpc.unary_unary_rpc_method_handler(
                    servicer.PositionsTotal,
                    request_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
                    response_serializer=mt5__term__api__trade__functions__pb2.PositionsTotalReply.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'mt5_term_api.TradeFunctions', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class TradeFunctions(object):
    """Missing associated documentation comment in .proto file."""

    @staticmethod
    def OrderCalcMargin(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, '/mt5_term_api.TradeFunctions/OrderCalcMargin',
            mt5__term__api__trade__functions__pb2.OrderCalcMarginRequest.SerializeToString,
            mt5__term__api__trade__functions__pb2.OrderCalcMarginReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def OrderCalcProfit(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, '/mt5_term_api.TradeFunctions/OrderCalcProfit',
            mt5__term__api__trade__functions__pb2.OrderCalcProfitRequest.SerializeToString,
            mt5__term__api__trade__functions__pb2.OrderCalcProfitReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def OrderCheck(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, '/mt5_term_api.TradeFunctions/OrderCheck',
            mt5__term__api__trade__functions__pb2.OrderCheckRequest.SerializeToString,
            mt5__term__api__trade__functions__pb2.OrderCheckReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def PositionsTotal(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, '/mt5_term_api.TradeFunctions/PositionsTotal',
            google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
            mt5__term__api__trade__functions__pb2.PositionsTotalReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
