# coding: utf-8

"""
    Hydrogen Proton API

    Financial engineering module of Hydrogen Atom  # noqa: E501

    OpenAPI spec version: 1.8.0
    Contact: info@hydrogenplatform.com
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from proton_api.api_client import ApiClient


class SimulationsApi(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

    def backtest(self, backtest_request, **kwargs):  # noqa: E501
        """Backtest  # noqa: E501

        Run a historical analysis for a group of investments  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.backtest(backtest_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param BacktestRequest backtest_request: Request payload for Backtest (required)
        :return: dict(str, object)
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.backtest_with_http_info(backtest_request, **kwargs)  # noqa: E501
        else:
            (data) = self.backtest_with_http_info(backtest_request, **kwargs)  # noqa: E501
            return data

    def backtest_with_http_info(self, backtest_request, **kwargs):  # noqa: E501
        """Backtest  # noqa: E501

        Run a historical analysis for a group of investments  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.backtest_with_http_info(backtest_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param BacktestRequest backtest_request: Request payload for Backtest (required)
        :return: dict(str, object)
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['backtest_request']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method backtest" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'backtest_request' is set
        if ('backtest_request' not in params or
                params['backtest_request'] is None):
            raise ValueError("Missing the required parameter `backtest_request` when calling `backtest`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'backtest_request' in params:
            body_params = params['backtest_request']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501

        return self.api_client.call_api(
            '/backtest', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='dict(str, object)',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def event_study(self, event_study_request, **kwargs):  # noqa: E501
        """Event Study  # noqa: E501

        Analyze a group of investments against key historical events  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.event_study(event_study_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param EventStudyRequest event_study_request: Request payload for Event Study (required)
        :return: dict(str, object)
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.event_study_with_http_info(event_study_request, **kwargs)  # noqa: E501
        else:
            (data) = self.event_study_with_http_info(event_study_request, **kwargs)  # noqa: E501
            return data

    def event_study_with_http_info(self, event_study_request, **kwargs):  # noqa: E501
        """Event Study  # noqa: E501

        Analyze a group of investments against key historical events  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.event_study_with_http_info(event_study_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param EventStudyRequest event_study_request: Request payload for Event Study (required)
        :return: dict(str, object)
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['event_study_request']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method event_study" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'event_study_request' is set
        if ('event_study_request' not in params or
                params['event_study_request'] is None):
            raise ValueError("Missing the required parameter `event_study_request` when calling `event_study`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'event_study_request' in params:
            body_params = params['event_study_request']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501

        return self.api_client.call_api(
            '/event_study', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='dict(str, object)',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def monte_carlo(self, monte_carlo_request, **kwargs):  # noqa: E501
        """Monte Carlo  # noqa: E501

        Simulate the future growth of a group of investments  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.monte_carlo(monte_carlo_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param MonteCarloRequest monte_carlo_request: Request payload for Monte Carlo (required)
        :return: dict(str, object)
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.monte_carlo_with_http_info(monte_carlo_request, **kwargs)  # noqa: E501
        else:
            (data) = self.monte_carlo_with_http_info(monte_carlo_request, **kwargs)  # noqa: E501
            return data

    def monte_carlo_with_http_info(self, monte_carlo_request, **kwargs):  # noqa: E501
        """Monte Carlo  # noqa: E501

        Simulate the future growth of a group of investments  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.monte_carlo_with_http_info(monte_carlo_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param MonteCarloRequest monte_carlo_request: Request payload for Monte Carlo (required)
        :return: dict(str, object)
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['monte_carlo_request']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method monte_carlo" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'monte_carlo_request' is set
        if ('monte_carlo_request' not in params or
                params['monte_carlo_request'] is None):
            raise ValueError("Missing the required parameter `monte_carlo_request` when calling `monte_carlo`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'monte_carlo_request' in params:
            body_params = params['monte_carlo_request']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501

        return self.api_client.call_api(
            '/monte_carlo', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='dict(str, object)',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def portfolio_what_if(self, portfolio_what_if_request, **kwargs):  # noqa: E501
        """Porfolio What-If  # noqa: E501

        Simulate the impact of adding, removing, reducing, or increasing various positions in a group of investments  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.portfolio_what_if(portfolio_what_if_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param PortfolioWhatIfRequest portfolio_what_if_request: Request payload for Portfolio What-If (required)
        :return: dict(str, object)
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.portfolio_what_if_with_http_info(portfolio_what_if_request, **kwargs)  # noqa: E501
        else:
            (data) = self.portfolio_what_if_with_http_info(portfolio_what_if_request, **kwargs)  # noqa: E501
            return data

    def portfolio_what_if_with_http_info(self, portfolio_what_if_request, **kwargs):  # noqa: E501
        """Porfolio What-If  # noqa: E501

        Simulate the impact of adding, removing, reducing, or increasing various positions in a group of investments  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.portfolio_what_if_with_http_info(portfolio_what_if_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param PortfolioWhatIfRequest portfolio_what_if_request: Request payload for Portfolio What-If (required)
        :return: dict(str, object)
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['portfolio_what_if_request']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method portfolio_what_if" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'portfolio_what_if_request' is set
        if ('portfolio_what_if_request' not in params or
                params['portfolio_what_if_request'] is None):
            raise ValueError("Missing the required parameter `portfolio_what_if_request` when calling `portfolio_what_if`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'portfolio_what_if_request' in params:
            body_params = params['portfolio_what_if_request']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501

        return self.api_client.call_api(
            '/portfolio_what_if', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='dict(str, object)',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def savings_calculator(self, savings_calculator_request, **kwargs):  # noqa: E501
        """Savings Calculator  # noqa: E501

        Simulate the future growth of a simple savings account  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.savings_calculator(savings_calculator_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param SavingsCalculatorRequest savings_calculator_request: Request payload for Savings Calculator (required)
        :return: dict(str, object)
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.savings_calculator_with_http_info(savings_calculator_request, **kwargs)  # noqa: E501
        else:
            (data) = self.savings_calculator_with_http_info(savings_calculator_request, **kwargs)  # noqa: E501
            return data

    def savings_calculator_with_http_info(self, savings_calculator_request, **kwargs):  # noqa: E501
        """Savings Calculator  # noqa: E501

        Simulate the future growth of a simple savings account  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.savings_calculator_with_http_info(savings_calculator_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param SavingsCalculatorRequest savings_calculator_request: Request payload for Savings Calculator (required)
        :return: dict(str, object)
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['savings_calculator_request']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method savings_calculator" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'savings_calculator_request' is set
        if ('savings_calculator_request' not in params or
                params['savings_calculator_request'] is None):
            raise ValueError("Missing the required parameter `savings_calculator_request` when calling `savings_calculator`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'savings_calculator_request' in params:
            body_params = params['savings_calculator_request']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501

        return self.api_client.call_api(
            '/savings_calculator', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='dict(str, object)',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def scenario_analysis(self, scneario_analysis_request, **kwargs):  # noqa: E501
        """Scenario Analysis  # noqa: E501

        Analyze a group of investments against a series of external economic factors  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.scenario_analysis(scneario_analysis_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ScenarioAnalysisRequest scneario_analysis_request: Request payload for Scenario Analysis (required)
        :return: dict(str, object)
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.scenario_analysis_with_http_info(scneario_analysis_request, **kwargs)  # noqa: E501
        else:
            (data) = self.scenario_analysis_with_http_info(scneario_analysis_request, **kwargs)  # noqa: E501
            return data

    def scenario_analysis_with_http_info(self, scneario_analysis_request, **kwargs):  # noqa: E501
        """Scenario Analysis  # noqa: E501

        Analyze a group of investments against a series of external economic factors  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.scenario_analysis_with_http_info(scneario_analysis_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ScenarioAnalysisRequest scneario_analysis_request: Request payload for Scenario Analysis (required)
        :return: dict(str, object)
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scneario_analysis_request']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method scenario_analysis" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scneario_analysis_request' is set
        if ('scneario_analysis_request' not in params or
                params['scneario_analysis_request'] is None):
            raise ValueError("Missing the required parameter `scneario_analysis_request` when calling `scenario_analysis`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'scneario_analysis_request' in params:
            body_params = params['scneario_analysis_request']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501

        return self.api_client.call_api(
            '/scenario_analysis', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='dict(str, object)',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def sensitivity_analysis(self, sensitivity_analysis_request, **kwargs):  # noqa: E501
        """Sensitivity Analysis  # noqa: E501

        Analyze a group of investments against an external economic factor  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.sensitivity_analysis(sensitivity_analysis_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param SensitivityAnalysisRequest sensitivity_analysis_request: Request payload for Sensitivity Analysis (required)
        :return: dict(str, object)
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.sensitivity_analysis_with_http_info(sensitivity_analysis_request, **kwargs)  # noqa: E501
        else:
            (data) = self.sensitivity_analysis_with_http_info(sensitivity_analysis_request, **kwargs)  # noqa: E501
            return data

    def sensitivity_analysis_with_http_info(self, sensitivity_analysis_request, **kwargs):  # noqa: E501
        """Sensitivity Analysis  # noqa: E501

        Analyze a group of investments against an external economic factor  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.sensitivity_analysis_with_http_info(sensitivity_analysis_request, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param SensitivityAnalysisRequest sensitivity_analysis_request: Request payload for Sensitivity Analysis (required)
        :return: dict(str, object)
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['sensitivity_analysis_request']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method sensitivity_analysis" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'sensitivity_analysis_request' is set
        if ('sensitivity_analysis_request' not in params or
                params['sensitivity_analysis_request'] is None):
            raise ValueError("Missing the required parameter `sensitivity_analysis_request` when calling `sensitivity_analysis`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'sensitivity_analysis_request' in params:
            body_params = params['sensitivity_analysis_request']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501

        return self.api_client.call_api(
            '/sensitivity_analysis', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='dict(str, object)',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)
