# coding: utf-8

"""
    LUSID API

    FINBOURNE Technology  # noqa: E501

    The version of the OpenAPI document: 0.11.4425
    Contact: <EMAIL>
    Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from lusid.api_client import ApiClient
from lusid.exceptions import (  # noqa: F401
    ApiTypeError,
    ApiValueError
)


class TransactionFeesApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

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

    def delete_transaction_fee_rule(self, code, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] DeleteTransactionFeeRule: Deletes a fee rule.  # noqa: E501

        <br>              Deletes the rule for all effective time.                <br>              The rule will remain viewable at previous as at times, but it will no longer be considered by              GetApplicableFees.                <br>              This cannot be undone.                # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.delete_transaction_fee_rule(code, async_req=True)
        >>> result = thread.get()

        :param code: The fee rule code. (required)
        :type code: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: DeletedEntityResponse
        """
        kwargs['_return_http_data_only'] = True
        return self.delete_transaction_fee_rule_with_http_info(code, **kwargs)  # noqa: E501

    def delete_transaction_fee_rule_with_http_info(self, code, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] DeleteTransactionFeeRule: Deletes a fee rule.  # noqa: E501

        <br>              Deletes the rule for all effective time.                <br>              The rule will remain viewable at previous as at times, but it will no longer be considered by              GetApplicableFees.                <br>              This cannot be undone.                # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.delete_transaction_fee_rule_with_http_info(code, async_req=True)
        >>> result = thread.get()

        :param code: The fee rule code. (required)
        :type code: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(DeletedEntityResponse, status_code(int), headers(HTTPHeaderDict))
        """

        local_var_params = locals()

        all_params = [
            'code'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method delete_transaction_fee_rule" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'code' is set
        if self.api_client.client_side_validation and ('code' not in local_var_params or  # noqa: E501
                                                        local_var_params['code'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `code` when calling `delete_transaction_fee_rule`")  # noqa: E501

        if self.api_client.client_side_validation and ('code' in local_var_params and  # noqa: E501
                                                        len(local_var_params['code']) > 64):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `code` when calling `delete_transaction_fee_rule`, length must be less than or equal to `64`")  # noqa: E501
        if self.api_client.client_side_validation and ('code' in local_var_params and  # noqa: E501
                                                        len(local_var_params['code']) < 1):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `code` when calling `delete_transaction_fee_rule`, length must be greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and 'code' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `code` when calling `delete_transaction_fee_rule`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'code' in local_var_params:
            path_params['code'] = local_var_params['code']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501
        
        response_types_map = {
            200: "DeletedEntityResponse",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/transactions/fees/rules/{code}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))

    def get_applicable_transaction_fees(self, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] GetApplicableTransactionFees: Get the Fees and Commissions that may be applicable to a transaction.  # noqa: E501

        Additionally, matching can be based on the instrument's properties, its portfolio properties, and any additional property keys present in the data file.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_applicable_transaction_fees(async_req=True)
        >>> result = thread.get()

        :param effective_at: The effective datetime or cut label at which to match rule definitions. Defaults to the current LUSID  system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to match rule definitions. Defaults to returning the latest version if not  specified.
        :type as_at: datetime
        :param instrument_identifier_type: Optional. The unique identifier type to use, eg 'Figi' or 'LusidInstrumentId'.
        :type instrument_identifier_type: str
        :param instrument_identifier: Optional. The Instrument Identifier to get properties for.
        :type instrument_identifier: str
        :param portfolio_scope: Optional. The scope of the portfolio to fetch properties from.
        :type portfolio_scope: str
        :param portfolio_code: Optional. The code of the portfolio to fetch properties from.
        :type portfolio_code: str
        :param request_body: Any other property keys or fields, including the top-level fields of the              fee rule (e.g. \"ExecutionBroker\" and \"SettlementCurrency\" ) and those defined in AdditionalKeys, along with              their corresponding values that should be matched for fees. Eg. \"Instrument/default/Name=exampleValue\" or              \"AdditionalKey2=Value2\".
        :type request_body: dict(str, str)
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: ResourceListOfFeeRule
        """
        kwargs['_return_http_data_only'] = True
        return self.get_applicable_transaction_fees_with_http_info(**kwargs)  # noqa: E501

    def get_applicable_transaction_fees_with_http_info(self, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] GetApplicableTransactionFees: Get the Fees and Commissions that may be applicable to a transaction.  # noqa: E501

        Additionally, matching can be based on the instrument's properties, its portfolio properties, and any additional property keys present in the data file.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_applicable_transaction_fees_with_http_info(async_req=True)
        >>> result = thread.get()

        :param effective_at: The effective datetime or cut label at which to match rule definitions. Defaults to the current LUSID  system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to match rule definitions. Defaults to returning the latest version if not  specified.
        :type as_at: datetime
        :param instrument_identifier_type: Optional. The unique identifier type to use, eg 'Figi' or 'LusidInstrumentId'.
        :type instrument_identifier_type: str
        :param instrument_identifier: Optional. The Instrument Identifier to get properties for.
        :type instrument_identifier: str
        :param portfolio_scope: Optional. The scope of the portfolio to fetch properties from.
        :type portfolio_scope: str
        :param portfolio_code: Optional. The code of the portfolio to fetch properties from.
        :type portfolio_code: str
        :param request_body: Any other property keys or fields, including the top-level fields of the              fee rule (e.g. \"ExecutionBroker\" and \"SettlementCurrency\" ) and those defined in AdditionalKeys, along with              their corresponding values that should be matched for fees. Eg. \"Instrument/default/Name=exampleValue\" or              \"AdditionalKey2=Value2\".
        :type request_body: dict(str, str)
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(ResourceListOfFeeRule, status_code(int), headers(HTTPHeaderDict))
        """

        local_var_params = locals()

        all_params = [
            'effective_at',
            'as_at',
            'instrument_identifier_type',
            'instrument_identifier',
            'portfolio_scope',
            'portfolio_code',
            'request_body'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_applicable_transaction_fees" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        if self.api_client.client_side_validation and ('instrument_identifier_type' in local_var_params and  # noqa: E501
                                                        len(local_var_params['instrument_identifier_type']) > 64):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `instrument_identifier_type` when calling `get_applicable_transaction_fees`, length must be less than or equal to `64`")  # noqa: E501
        if self.api_client.client_side_validation and ('instrument_identifier_type' in local_var_params and  # noqa: E501
                                                        len(local_var_params['instrument_identifier_type']) < 1):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `instrument_identifier_type` when calling `get_applicable_transaction_fees`, length must be greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and ('instrument_identifier' in local_var_params and  # noqa: E501
                                                        len(local_var_params['instrument_identifier']) > 64):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `instrument_identifier` when calling `get_applicable_transaction_fees`, length must be less than or equal to `64`")  # noqa: E501
        if self.api_client.client_side_validation and ('instrument_identifier' in local_var_params and  # noqa: E501
                                                        len(local_var_params['instrument_identifier']) < 1):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `instrument_identifier` when calling `get_applicable_transaction_fees`, length must be greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and ('portfolio_scope' in local_var_params and  # noqa: E501
                                                        len(local_var_params['portfolio_scope']) > 64):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `portfolio_scope` when calling `get_applicable_transaction_fees`, length must be less than or equal to `64`")  # noqa: E501
        if self.api_client.client_side_validation and ('portfolio_scope' in local_var_params and  # noqa: E501
                                                        len(local_var_params['portfolio_scope']) < 1):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `portfolio_scope` when calling `get_applicable_transaction_fees`, length must be greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and 'portfolio_scope' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['portfolio_scope']):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `portfolio_scope` when calling `get_applicable_transaction_fees`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")  # noqa: E501
        if self.api_client.client_side_validation and ('portfolio_code' in local_var_params and  # noqa: E501
                                                        len(local_var_params['portfolio_code']) > 64):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `portfolio_code` when calling `get_applicable_transaction_fees`, length must be less than or equal to `64`")  # noqa: E501
        if self.api_client.client_side_validation and ('portfolio_code' in local_var_params and  # noqa: E501
                                                        len(local_var_params['portfolio_code']) < 1):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `portfolio_code` when calling `get_applicable_transaction_fees`, length must be greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and 'portfolio_code' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['portfolio_code']):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `portfolio_code` when calling `get_applicable_transaction_fees`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")  # noqa: E501
        collection_formats = {}

        path_params = {}

        query_params = []
        if 'effective_at' in local_var_params and local_var_params['effective_at'] is not None:  # noqa: E501
            query_params.append(('effectiveAt', local_var_params['effective_at']))  # noqa: E501
        if 'as_at' in local_var_params and local_var_params['as_at'] is not None:  # noqa: E501
            query_params.append(('asAt', local_var_params['as_at']))  # noqa: E501
        if 'instrument_identifier_type' in local_var_params and local_var_params['instrument_identifier_type'] is not None:  # noqa: E501
            query_params.append(('instrumentIdentifierType', local_var_params['instrument_identifier_type']))  # noqa: E501
        if 'instrument_identifier' in local_var_params and local_var_params['instrument_identifier'] is not None:  # noqa: E501
            query_params.append(('instrumentIdentifier', local_var_params['instrument_identifier']))  # noqa: E501
        if 'portfolio_scope' in local_var_params and local_var_params['portfolio_scope'] is not None:  # noqa: E501
            query_params.append(('portfolioScope', local_var_params['portfolio_scope']))  # noqa: E501
        if 'portfolio_code' in local_var_params and local_var_params['portfolio_code'] is not None:  # noqa: E501
            query_params.append(('portfolioCode', local_var_params['portfolio_code']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'request_body' in local_var_params:
            body_params = local_var_params['request_body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.4425'

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501
        
        response_types_map = {
            200: "ResourceListOfFeeRule",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/transactions/fees/$GetApplicableFees', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))

    def get_transaction_fee_rule(self, code, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] GetTransactionFeeRule: Retrieve the definition of single fee rule.  # noqa: E501

        Retrieves the fee rule definition at the given effective and as at times.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_transaction_fee_rule(code, async_req=True)
        >>> result = thread.get()

        :param code: The fee rule code. (required)
        :type code: str
        :param effective_at: The effective datetime or cut label at which to retrieve the rule definition. Defaults to the current LUSID  system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve the rule definition. Defaults to returning the latest version if not  specified.
        :type as_at: datetime
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: FeeRule
        """
        kwargs['_return_http_data_only'] = True
        return self.get_transaction_fee_rule_with_http_info(code, **kwargs)  # noqa: E501

    def get_transaction_fee_rule_with_http_info(self, code, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] GetTransactionFeeRule: Retrieve the definition of single fee rule.  # noqa: E501

        Retrieves the fee rule definition at the given effective and as at times.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_transaction_fee_rule_with_http_info(code, async_req=True)
        >>> result = thread.get()

        :param code: The fee rule code. (required)
        :type code: str
        :param effective_at: The effective datetime or cut label at which to retrieve the rule definition. Defaults to the current LUSID  system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve the rule definition. Defaults to returning the latest version if not  specified.
        :type as_at: datetime
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(FeeRule, status_code(int), headers(HTTPHeaderDict))
        """

        local_var_params = locals()

        all_params = [
            'code',
            'effective_at',
            'as_at'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_transaction_fee_rule" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'code' is set
        if self.api_client.client_side_validation and ('code' not in local_var_params or  # noqa: E501
                                                        local_var_params['code'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `code` when calling `get_transaction_fee_rule`")  # noqa: E501

        if self.api_client.client_side_validation and ('code' in local_var_params and  # noqa: E501
                                                        len(local_var_params['code']) > 64):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `code` when calling `get_transaction_fee_rule`, length must be less than or equal to `64`")  # noqa: E501
        if self.api_client.client_side_validation and ('code' in local_var_params and  # noqa: E501
                                                        len(local_var_params['code']) < 1):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `code` when calling `get_transaction_fee_rule`, length must be greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and 'code' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `code` when calling `get_transaction_fee_rule`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'code' in local_var_params:
            path_params['code'] = local_var_params['code']  # noqa: E501

        query_params = []
        if 'effective_at' in local_var_params and local_var_params['effective_at'] is not None:  # noqa: E501
            query_params.append(('effectiveAt', local_var_params['effective_at']))  # noqa: E501
        if 'as_at' in local_var_params and local_var_params['as_at'] is not None:  # noqa: E501
            query_params.append(('asAt', local_var_params['as_at']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501
        
        response_types_map = {
            200: "FeeRule",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/transactions/fees/rules/{code}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))

    def list_transaction_fee_rules(self, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] ListTransactionFeeRules: List fee rules, with optional filtering.  # noqa: E501

        For more information about filtering results,  see https://support.lusid.com/knowledgebase/article/KA-01914.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.list_transaction_fee_rules(async_req=True)
        >>> result = thread.get()

        :param effective_at: The effective datetime or cut label at which to retrieve the rule definitions. Defaults to the current LUSID  system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve the rule definitions. Defaults to returning the latest version if not  specified.
        :type as_at: datetime
        :param limit: When paginating, limit the results to this number. Defaults to 100 if not specified.
        :type limit: int
        :param filter: Expression to filter the results.
        :type filter: str
        :param page: The pagination token to use to continue listing entities; this value is returned from the previous call. If  a pagination token is provided, the filter, effectiveAt and asAt fields must not have changed since the  original request.
        :type page: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: ResourceListOfFeeRule
        """
        kwargs['_return_http_data_only'] = True
        return self.list_transaction_fee_rules_with_http_info(**kwargs)  # noqa: E501

    def list_transaction_fee_rules_with_http_info(self, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] ListTransactionFeeRules: List fee rules, with optional filtering.  # noqa: E501

        For more information about filtering results,  see https://support.lusid.com/knowledgebase/article/KA-01914.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.list_transaction_fee_rules_with_http_info(async_req=True)
        >>> result = thread.get()

        :param effective_at: The effective datetime or cut label at which to retrieve the rule definitions. Defaults to the current LUSID  system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve the rule definitions. Defaults to returning the latest version if not  specified.
        :type as_at: datetime
        :param limit: When paginating, limit the results to this number. Defaults to 100 if not specified.
        :type limit: int
        :param filter: Expression to filter the results.
        :type filter: str
        :param page: The pagination token to use to continue listing entities; this value is returned from the previous call. If  a pagination token is provided, the filter, effectiveAt and asAt fields must not have changed since the  original request.
        :type page: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(ResourceListOfFeeRule, status_code(int), headers(HTTPHeaderDict))
        """

        local_var_params = locals()

        all_params = [
            'effective_at',
            'as_at',
            'limit',
            'filter',
            'page'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_transaction_fee_rules" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 5000:  # noqa: E501
            raise ApiValueError("Invalid value for parameter `limit` when calling `list_transaction_fee_rules`, must be a value less than or equal to `5000`")  # noqa: E501
        if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1:  # noqa: E501
            raise ApiValueError("Invalid value for parameter `limit` when calling `list_transaction_fee_rules`, must be a value greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and ('filter' in local_var_params and  # noqa: E501
                                                        len(local_var_params['filter']) > 16384):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `filter` when calling `list_transaction_fee_rules`, length must be less than or equal to `16384`")  # noqa: E501
        if self.api_client.client_side_validation and ('filter' in local_var_params and  # noqa: E501
                                                        len(local_var_params['filter']) < 0):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `filter` when calling `list_transaction_fee_rules`, length must be greater than or equal to `0`")  # noqa: E501
        if self.api_client.client_side_validation and 'filter' in local_var_params and not re.search(r'^[\s\S]*$', local_var_params['filter']):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `filter` when calling `list_transaction_fee_rules`, must conform to the pattern `/^[\s\S]*$/`")  # noqa: E501
        if self.api_client.client_side_validation and ('page' in local_var_params and  # noqa: E501
                                                        len(local_var_params['page']) > 500):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `page` when calling `list_transaction_fee_rules`, length must be less than or equal to `500`")  # noqa: E501
        if self.api_client.client_side_validation and ('page' in local_var_params and  # noqa: E501
                                                        len(local_var_params['page']) < 1):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `page` when calling `list_transaction_fee_rules`, length must be greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and 'page' in local_var_params and not re.search(r'^[a-zA-Z0-9\+\/]*={0,3}$', local_var_params['page']):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `page` when calling `list_transaction_fee_rules`, must conform to the pattern `/^[a-zA-Z0-9\+\/]*={0,3}$/`")  # noqa: E501
        collection_formats = {}

        path_params = {}

        query_params = []
        if 'effective_at' in local_var_params and local_var_params['effective_at'] is not None:  # noqa: E501
            query_params.append(('effectiveAt', local_var_params['effective_at']))  # noqa: E501
        if 'as_at' in local_var_params and local_var_params['as_at'] is not None:  # noqa: E501
            query_params.append(('asAt', local_var_params['as_at']))  # noqa: E501
        if 'limit' in local_var_params and local_var_params['limit'] is not None:  # noqa: E501
            query_params.append(('limit', local_var_params['limit']))  # noqa: E501
        if 'filter' in local_var_params and local_var_params['filter'] is not None:  # noqa: E501
            query_params.append(('filter', local_var_params['filter']))  # noqa: E501
        if 'page' in local_var_params and local_var_params['page'] is not None:  # noqa: E501
            query_params.append(('page', local_var_params['page']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501
        
        response_types_map = {
            200: "ResourceListOfFeeRule",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/transactions/fees/rules', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))

    def upsert_transaction_fee_rules(self, request_body, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] UpsertTransactionFeeRules: Upsert fee rules.  # noqa: E501

        <br>              To upsert a new rule, the code field must be left empty, a code will then be assigned and returned as part              of the response. To update an existing rule, include the fee code. It is possible to both create and update              fee rules in the same request.                <br>              The upsert is transactional - either all create/update operations will succeed or none of them will.                # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.upsert_transaction_fee_rules(request_body, async_req=True)
        >>> result = thread.get()

        :param request_body: A dictionary of upsert request identifiers to rule upsert requests. The request              identifiers are valid for the request only and can be used to link the upserted fee rule to the code of a              created fee rule. (required)
        :type request_body: dict(str, FeeRuleUpsertRequest)
        :param effective_at: The effective datetime or cut label at which the rule will take effect. Defaults to the current LUSID  system datetime if not specified. In the case of an update, the changes will take place from this effective  time until the next effective time that the rule as been upserted at. For example, consider a rule that  already exists, and has previously had an update applied so that the definition will change on the first day  of the coming month. An upsert effective from the current day will only change the definition until the  first day of the coming month. An additional upsert at the same time (first day of the month) is required  if the newly-updated definition is to supersede the future definition.
        :type effective_at: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: FeeRuleUpsertResponse
        """
        kwargs['_return_http_data_only'] = True
        return self.upsert_transaction_fee_rules_with_http_info(request_body, **kwargs)  # noqa: E501

    def upsert_transaction_fee_rules_with_http_info(self, request_body, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] UpsertTransactionFeeRules: Upsert fee rules.  # noqa: E501

        <br>              To upsert a new rule, the code field must be left empty, a code will then be assigned and returned as part              of the response. To update an existing rule, include the fee code. It is possible to both create and update              fee rules in the same request.                <br>              The upsert is transactional - either all create/update operations will succeed or none of them will.                # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.upsert_transaction_fee_rules_with_http_info(request_body, async_req=True)
        >>> result = thread.get()

        :param request_body: A dictionary of upsert request identifiers to rule upsert requests. The request              identifiers are valid for the request only and can be used to link the upserted fee rule to the code of a              created fee rule. (required)
        :type request_body: dict(str, FeeRuleUpsertRequest)
        :param effective_at: The effective datetime or cut label at which the rule will take effect. Defaults to the current LUSID  system datetime if not specified. In the case of an update, the changes will take place from this effective  time until the next effective time that the rule as been upserted at. For example, consider a rule that  already exists, and has previously had an update applied so that the definition will change on the first day  of the coming month. An upsert effective from the current day will only change the definition until the  first day of the coming month. An additional upsert at the same time (first day of the month) is required  if the newly-updated definition is to supersede the future definition.
        :type effective_at: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(FeeRuleUpsertResponse, status_code(int), headers(HTTPHeaderDict))
        """

        local_var_params = locals()

        all_params = [
            'request_body',
            'effective_at'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method upsert_transaction_fee_rules" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'request_body' is set
        if self.api_client.client_side_validation and ('request_body' not in local_var_params or  # noqa: E501
                                                        local_var_params['request_body'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `request_body` when calling `upsert_transaction_fee_rules`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'effective_at' in local_var_params and local_var_params['effective_at'] is not None:  # noqa: E501
            query_params.append(('effectiveAt', local_var_params['effective_at']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'request_body' in local_var_params:
            body_params = local_var_params['request_body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.4425'

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501
        
        response_types_map = {
            200: "FeeRuleUpsertResponse",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/transactions/fees/rules', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))

# coding: utf-8

"""
    LUSID API

    FINBOURNE Technology  # noqa: E501

    The version of the OpenAPI document: 0.11.4425
    Contact: <EMAIL>
    Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from lusid.api_client import ApiClient
from lusid.exceptions import (  # noqa: F401
    ApiTypeError,
    ApiValueError
)


class TransactionFeesApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

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

    def delete_transaction_fee_rule(self, code, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] DeleteTransactionFeeRule: Deletes a fee rule.  # noqa: E501

        <br>              Deletes the rule for all effective time.                <br>              The rule will remain viewable at previous as at times, but it will no longer be considered by              GetApplicableFees.                <br>              This cannot be undone.                # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.delete_transaction_fee_rule(code, async_req=True)
        >>> result = thread.get()

        :param code: The fee rule code. (required)
        :type code: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: DeletedEntityResponse
        """
        kwargs['_return_http_data_only'] = True
        return self.delete_transaction_fee_rule_with_http_info(code, **kwargs)  # noqa: E501

    def delete_transaction_fee_rule_with_http_info(self, code, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] DeleteTransactionFeeRule: Deletes a fee rule.  # noqa: E501

        <br>              Deletes the rule for all effective time.                <br>              The rule will remain viewable at previous as at times, but it will no longer be considered by              GetApplicableFees.                <br>              This cannot be undone.                # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.delete_transaction_fee_rule_with_http_info(code, async_req=True)
        >>> result = thread.get()

        :param code: The fee rule code. (required)
        :type code: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(DeletedEntityResponse, status_code(int), headers(HTTPHeaderDict))
        """

        local_var_params = locals()

        all_params = [
            'code'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method delete_transaction_fee_rule" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'code' is set
        if self.api_client.client_side_validation and ('code' not in local_var_params or  # noqa: E501
                                                        local_var_params['code'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `code` when calling `delete_transaction_fee_rule`")  # noqa: E501

        if self.api_client.client_side_validation and ('code' in local_var_params and  # noqa: E501
                                                        len(local_var_params['code']) > 64):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `code` when calling `delete_transaction_fee_rule`, length must be less than or equal to `64`")  # noqa: E501
        if self.api_client.client_side_validation and ('code' in local_var_params and  # noqa: E501
                                                        len(local_var_params['code']) < 1):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `code` when calling `delete_transaction_fee_rule`, length must be greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and 'code' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `code` when calling `delete_transaction_fee_rule`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'code' in local_var_params:
            path_params['code'] = local_var_params['code']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501
        
        response_types_map = {
            200: "DeletedEntityResponse",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/transactions/fees/rules/{code}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))

    def get_applicable_transaction_fees(self, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] GetApplicableTransactionFees: Get the Fees and Commissions that may be applicable to a transaction.  # noqa: E501

        Additionally, matching can be based on the instrument's properties, its portfolio properties, and any additional property keys present in the data file.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_applicable_transaction_fees(async_req=True)
        >>> result = thread.get()

        :param effective_at: The effective datetime or cut label at which to match rule definitions. Defaults to the current LUSID  system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to match rule definitions. Defaults to returning the latest version if not  specified.
        :type as_at: datetime
        :param instrument_identifier_type: Optional. The unique identifier type to use, eg 'Figi' or 'LusidInstrumentId'.
        :type instrument_identifier_type: str
        :param instrument_identifier: Optional. The Instrument Identifier to get properties for.
        :type instrument_identifier: str
        :param portfolio_scope: Optional. The scope of the portfolio to fetch properties from.
        :type portfolio_scope: str
        :param portfolio_code: Optional. The code of the portfolio to fetch properties from.
        :type portfolio_code: str
        :param request_body: Any other property keys or fields, including the top-level fields of the              fee rule (e.g. \"ExecutionBroker\" and \"SettlementCurrency\" ) and those defined in AdditionalKeys, along with              their corresponding values that should be matched for fees. Eg. \"Instrument/default/Name=exampleValue\" or              \"AdditionalKey2=Value2\".
        :type request_body: dict(str, str)
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: ResourceListOfFeeRule
        """
        kwargs['_return_http_data_only'] = True
        return self.get_applicable_transaction_fees_with_http_info(**kwargs)  # noqa: E501

    def get_applicable_transaction_fees_with_http_info(self, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] GetApplicableTransactionFees: Get the Fees and Commissions that may be applicable to a transaction.  # noqa: E501

        Additionally, matching can be based on the instrument's properties, its portfolio properties, and any additional property keys present in the data file.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_applicable_transaction_fees_with_http_info(async_req=True)
        >>> result = thread.get()

        :param effective_at: The effective datetime or cut label at which to match rule definitions. Defaults to the current LUSID  system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to match rule definitions. Defaults to returning the latest version if not  specified.
        :type as_at: datetime
        :param instrument_identifier_type: Optional. The unique identifier type to use, eg 'Figi' or 'LusidInstrumentId'.
        :type instrument_identifier_type: str
        :param instrument_identifier: Optional. The Instrument Identifier to get properties for.
        :type instrument_identifier: str
        :param portfolio_scope: Optional. The scope of the portfolio to fetch properties from.
        :type portfolio_scope: str
        :param portfolio_code: Optional. The code of the portfolio to fetch properties from.
        :type portfolio_code: str
        :param request_body: Any other property keys or fields, including the top-level fields of the              fee rule (e.g. \"ExecutionBroker\" and \"SettlementCurrency\" ) and those defined in AdditionalKeys, along with              their corresponding values that should be matched for fees. Eg. \"Instrument/default/Name=exampleValue\" or              \"AdditionalKey2=Value2\".
        :type request_body: dict(str, str)
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(ResourceListOfFeeRule, status_code(int), headers(HTTPHeaderDict))
        """

        local_var_params = locals()

        all_params = [
            'effective_at',
            'as_at',
            'instrument_identifier_type',
            'instrument_identifier',
            'portfolio_scope',
            'portfolio_code',
            'request_body'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_applicable_transaction_fees" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        if self.api_client.client_side_validation and ('instrument_identifier_type' in local_var_params and  # noqa: E501
                                                        len(local_var_params['instrument_identifier_type']) > 64):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `instrument_identifier_type` when calling `get_applicable_transaction_fees`, length must be less than or equal to `64`")  # noqa: E501
        if self.api_client.client_side_validation and ('instrument_identifier_type' in local_var_params and  # noqa: E501
                                                        len(local_var_params['instrument_identifier_type']) < 1):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `instrument_identifier_type` when calling `get_applicable_transaction_fees`, length must be greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and ('instrument_identifier' in local_var_params and  # noqa: E501
                                                        len(local_var_params['instrument_identifier']) > 64):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `instrument_identifier` when calling `get_applicable_transaction_fees`, length must be less than or equal to `64`")  # noqa: E501
        if self.api_client.client_side_validation and ('instrument_identifier' in local_var_params and  # noqa: E501
                                                        len(local_var_params['instrument_identifier']) < 1):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `instrument_identifier` when calling `get_applicable_transaction_fees`, length must be greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and ('portfolio_scope' in local_var_params and  # noqa: E501
                                                        len(local_var_params['portfolio_scope']) > 64):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `portfolio_scope` when calling `get_applicable_transaction_fees`, length must be less than or equal to `64`")  # noqa: E501
        if self.api_client.client_side_validation and ('portfolio_scope' in local_var_params and  # noqa: E501
                                                        len(local_var_params['portfolio_scope']) < 1):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `portfolio_scope` when calling `get_applicable_transaction_fees`, length must be greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and 'portfolio_scope' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['portfolio_scope']):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `portfolio_scope` when calling `get_applicable_transaction_fees`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")  # noqa: E501
        if self.api_client.client_side_validation and ('portfolio_code' in local_var_params and  # noqa: E501
                                                        len(local_var_params['portfolio_code']) > 64):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `portfolio_code` when calling `get_applicable_transaction_fees`, length must be less than or equal to `64`")  # noqa: E501
        if self.api_client.client_side_validation and ('portfolio_code' in local_var_params and  # noqa: E501
                                                        len(local_var_params['portfolio_code']) < 1):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `portfolio_code` when calling `get_applicable_transaction_fees`, length must be greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and 'portfolio_code' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['portfolio_code']):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `portfolio_code` when calling `get_applicable_transaction_fees`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")  # noqa: E501
        collection_formats = {}

        path_params = {}

        query_params = []
        if 'effective_at' in local_var_params and local_var_params['effective_at'] is not None:  # noqa: E501
            query_params.append(('effectiveAt', local_var_params['effective_at']))  # noqa: E501
        if 'as_at' in local_var_params and local_var_params['as_at'] is not None:  # noqa: E501
            query_params.append(('asAt', local_var_params['as_at']))  # noqa: E501
        if 'instrument_identifier_type' in local_var_params and local_var_params['instrument_identifier_type'] is not None:  # noqa: E501
            query_params.append(('instrumentIdentifierType', local_var_params['instrument_identifier_type']))  # noqa: E501
        if 'instrument_identifier' in local_var_params and local_var_params['instrument_identifier'] is not None:  # noqa: E501
            query_params.append(('instrumentIdentifier', local_var_params['instrument_identifier']))  # noqa: E501
        if 'portfolio_scope' in local_var_params and local_var_params['portfolio_scope'] is not None:  # noqa: E501
            query_params.append(('portfolioScope', local_var_params['portfolio_scope']))  # noqa: E501
        if 'portfolio_code' in local_var_params and local_var_params['portfolio_code'] is not None:  # noqa: E501
            query_params.append(('portfolioCode', local_var_params['portfolio_code']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'request_body' in local_var_params:
            body_params = local_var_params['request_body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.4425'

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501
        
        response_types_map = {
            200: "ResourceListOfFeeRule",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/transactions/fees/$GetApplicableFees', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))

    def get_transaction_fee_rule(self, code, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] GetTransactionFeeRule: Retrieve the definition of single fee rule.  # noqa: E501

        Retrieves the fee rule definition at the given effective and as at times.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_transaction_fee_rule(code, async_req=True)
        >>> result = thread.get()

        :param code: The fee rule code. (required)
        :type code: str
        :param effective_at: The effective datetime or cut label at which to retrieve the rule definition. Defaults to the current LUSID  system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve the rule definition. Defaults to returning the latest version if not  specified.
        :type as_at: datetime
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: FeeRule
        """
        kwargs['_return_http_data_only'] = True
        return self.get_transaction_fee_rule_with_http_info(code, **kwargs)  # noqa: E501

    def get_transaction_fee_rule_with_http_info(self, code, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] GetTransactionFeeRule: Retrieve the definition of single fee rule.  # noqa: E501

        Retrieves the fee rule definition at the given effective and as at times.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.get_transaction_fee_rule_with_http_info(code, async_req=True)
        >>> result = thread.get()

        :param code: The fee rule code. (required)
        :type code: str
        :param effective_at: The effective datetime or cut label at which to retrieve the rule definition. Defaults to the current LUSID  system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve the rule definition. Defaults to returning the latest version if not  specified.
        :type as_at: datetime
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(FeeRule, status_code(int), headers(HTTPHeaderDict))
        """

        local_var_params = locals()

        all_params = [
            'code',
            'effective_at',
            'as_at'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_transaction_fee_rule" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'code' is set
        if self.api_client.client_side_validation and ('code' not in local_var_params or  # noqa: E501
                                                        local_var_params['code'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `code` when calling `get_transaction_fee_rule`")  # noqa: E501

        if self.api_client.client_side_validation and ('code' in local_var_params and  # noqa: E501
                                                        len(local_var_params['code']) > 64):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `code` when calling `get_transaction_fee_rule`, length must be less than or equal to `64`")  # noqa: E501
        if self.api_client.client_side_validation and ('code' in local_var_params and  # noqa: E501
                                                        len(local_var_params['code']) < 1):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `code` when calling `get_transaction_fee_rule`, length must be greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and 'code' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `code` when calling `get_transaction_fee_rule`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")  # noqa: E501
        collection_formats = {}

        path_params = {}
        if 'code' in local_var_params:
            path_params['code'] = local_var_params['code']  # noqa: E501

        query_params = []
        if 'effective_at' in local_var_params and local_var_params['effective_at'] is not None:  # noqa: E501
            query_params.append(('effectiveAt', local_var_params['effective_at']))  # noqa: E501
        if 'as_at' in local_var_params and local_var_params['as_at'] is not None:  # noqa: E501
            query_params.append(('asAt', local_var_params['as_at']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501
        
        response_types_map = {
            200: "FeeRule",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/transactions/fees/rules/{code}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))

    def list_transaction_fee_rules(self, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] ListTransactionFeeRules: List fee rules, with optional filtering.  # noqa: E501

        For more information about filtering results,  see https://support.lusid.com/knowledgebase/article/KA-01914.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.list_transaction_fee_rules(async_req=True)
        >>> result = thread.get()

        :param effective_at: The effective datetime or cut label at which to retrieve the rule definitions. Defaults to the current LUSID  system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve the rule definitions. Defaults to returning the latest version if not  specified.
        :type as_at: datetime
        :param limit: When paginating, limit the results to this number. Defaults to 100 if not specified.
        :type limit: int
        :param filter: Expression to filter the results.
        :type filter: str
        :param page: The pagination token to use to continue listing entities; this value is returned from the previous call. If  a pagination token is provided, the filter, effectiveAt and asAt fields must not have changed since the  original request.
        :type page: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: ResourceListOfFeeRule
        """
        kwargs['_return_http_data_only'] = True
        return self.list_transaction_fee_rules_with_http_info(**kwargs)  # noqa: E501

    def list_transaction_fee_rules_with_http_info(self, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] ListTransactionFeeRules: List fee rules, with optional filtering.  # noqa: E501

        For more information about filtering results,  see https://support.lusid.com/knowledgebase/article/KA-01914.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.list_transaction_fee_rules_with_http_info(async_req=True)
        >>> result = thread.get()

        :param effective_at: The effective datetime or cut label at which to retrieve the rule definitions. Defaults to the current LUSID  system datetime if not specified.
        :type effective_at: str
        :param as_at: The asAt datetime at which to retrieve the rule definitions. Defaults to returning the latest version if not  specified.
        :type as_at: datetime
        :param limit: When paginating, limit the results to this number. Defaults to 100 if not specified.
        :type limit: int
        :param filter: Expression to filter the results.
        :type filter: str
        :param page: The pagination token to use to continue listing entities; this value is returned from the previous call. If  a pagination token is provided, the filter, effectiveAt and asAt fields must not have changed since the  original request.
        :type page: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(ResourceListOfFeeRule, status_code(int), headers(HTTPHeaderDict))
        """

        local_var_params = locals()

        all_params = [
            'effective_at',
            'as_at',
            'limit',
            'filter',
            'page'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_transaction_fee_rules" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 5000:  # noqa: E501
            raise ApiValueError("Invalid value for parameter `limit` when calling `list_transaction_fee_rules`, must be a value less than or equal to `5000`")  # noqa: E501
        if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1:  # noqa: E501
            raise ApiValueError("Invalid value for parameter `limit` when calling `list_transaction_fee_rules`, must be a value greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and ('filter' in local_var_params and  # noqa: E501
                                                        len(local_var_params['filter']) > 16384):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `filter` when calling `list_transaction_fee_rules`, length must be less than or equal to `16384`")  # noqa: E501
        if self.api_client.client_side_validation and ('filter' in local_var_params and  # noqa: E501
                                                        len(local_var_params['filter']) < 0):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `filter` when calling `list_transaction_fee_rules`, length must be greater than or equal to `0`")  # noqa: E501
        if self.api_client.client_side_validation and 'filter' in local_var_params and not re.search(r'^[\s\S]*$', local_var_params['filter']):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `filter` when calling `list_transaction_fee_rules`, must conform to the pattern `/^[\s\S]*$/`")  # noqa: E501
        if self.api_client.client_side_validation and ('page' in local_var_params and  # noqa: E501
                                                        len(local_var_params['page']) > 500):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `page` when calling `list_transaction_fee_rules`, length must be less than or equal to `500`")  # noqa: E501
        if self.api_client.client_side_validation and ('page' in local_var_params and  # noqa: E501
                                                        len(local_var_params['page']) < 1):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `page` when calling `list_transaction_fee_rules`, length must be greater than or equal to `1`")  # noqa: E501
        if self.api_client.client_side_validation and 'page' in local_var_params and not re.search(r'^[a-zA-Z0-9\+\/]*={0,3}$', local_var_params['page']):  # noqa: E501
            raise ApiValueError("Invalid value for parameter `page` when calling `list_transaction_fee_rules`, must conform to the pattern `/^[a-zA-Z0-9\+\/]*={0,3}$/`")  # noqa: E501
        collection_formats = {}

        path_params = {}

        query_params = []
        if 'effective_at' in local_var_params and local_var_params['effective_at'] is not None:  # noqa: E501
            query_params.append(('effectiveAt', local_var_params['effective_at']))  # noqa: E501
        if 'as_at' in local_var_params and local_var_params['as_at'] is not None:  # noqa: E501
            query_params.append(('asAt', local_var_params['as_at']))  # noqa: E501
        if 'limit' in local_var_params and local_var_params['limit'] is not None:  # noqa: E501
            query_params.append(('limit', local_var_params['limit']))  # noqa: E501
        if 'filter' in local_var_params and local_var_params['filter'] is not None:  # noqa: E501
            query_params.append(('filter', local_var_params['filter']))  # noqa: E501
        if 'page' in local_var_params and local_var_params['page'] is not None:  # noqa: E501
            query_params.append(('page', local_var_params['page']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501
        
        response_types_map = {
            200: "ResourceListOfFeeRule",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/transactions/fees/rules', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))

    def upsert_transaction_fee_rules(self, request_body, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] UpsertTransactionFeeRules: Upsert fee rules.  # noqa: E501

        <br>              To upsert a new rule, the code field must be left empty, a code will then be assigned and returned as part              of the response. To update an existing rule, include the fee code. It is possible to both create and update              fee rules in the same request.                <br>              The upsert is transactional - either all create/update operations will succeed or none of them will.                # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.upsert_transaction_fee_rules(request_body, async_req=True)
        >>> result = thread.get()

        :param request_body: A dictionary of upsert request identifiers to rule upsert requests. The request              identifiers are valid for the request only and can be used to link the upserted fee rule to the code of a              created fee rule. (required)
        :type request_body: dict(str, FeeRuleUpsertRequest)
        :param effective_at: The effective datetime or cut label at which the rule will take effect. Defaults to the current LUSID  system datetime if not specified. In the case of an update, the changes will take place from this effective  time until the next effective time that the rule as been upserted at. For example, consider a rule that  already exists, and has previously had an update applied so that the definition will change on the first day  of the coming month. An upsert effective from the current day will only change the definition until the  first day of the coming month. An additional upsert at the same time (first day of the month) is required  if the newly-updated definition is to supersede the future definition.
        :type effective_at: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: FeeRuleUpsertResponse
        """
        kwargs['_return_http_data_only'] = True
        return self.upsert_transaction_fee_rules_with_http_info(request_body, **kwargs)  # noqa: E501

    def upsert_transaction_fee_rules_with_http_info(self, request_body, **kwargs):  # noqa: E501
        """[EXPERIMENTAL] UpsertTransactionFeeRules: Upsert fee rules.  # noqa: E501

        <br>              To upsert a new rule, the code field must be left empty, a code will then be assigned and returned as part              of the response. To update an existing rule, include the fee code. It is possible to both create and update              fee rules in the same request.                <br>              The upsert is transactional - either all create/update operations will succeed or none of them will.                # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.upsert_transaction_fee_rules_with_http_info(request_body, async_req=True)
        >>> result = thread.get()

        :param request_body: A dictionary of upsert request identifiers to rule upsert requests. The request              identifiers are valid for the request only and can be used to link the upserted fee rule to the code of a              created fee rule. (required)
        :type request_body: dict(str, FeeRuleUpsertRequest)
        :param effective_at: The effective datetime or cut label at which the rule will take effect. Defaults to the current LUSID  system datetime if not specified. In the case of an update, the changes will take place from this effective  time until the next effective time that the rule as been upserted at. For example, consider a rule that  already exists, and has previously had an update applied so that the definition will change on the first day  of the coming month. An upsert effective from the current day will only change the definition until the  first day of the coming month. An additional upsert at the same time (first day of the month) is required  if the newly-updated definition is to supersede the future definition.
        :type effective_at: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _return_http_data_only: response data without head status code
                                       and headers
        :type _return_http_data_only: bool, optional
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :type _preload_content: bool, optional
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(FeeRuleUpsertResponse, status_code(int), headers(HTTPHeaderDict))
        """

        local_var_params = locals()

        all_params = [
            'request_body',
            'effective_at'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method upsert_transaction_fee_rules" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'request_body' is set
        if self.api_client.client_side_validation and ('request_body' not in local_var_params or  # noqa: E501
                                                        local_var_params['request_body'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `request_body` when calling `upsert_transaction_fee_rules`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'effective_at' in local_var_params and local_var_params['effective_at'] is not None:  # noqa: E501
            query_params.append(('effectiveAt', local_var_params['effective_at']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'request_body' in local_var_params:
            body_params = local_var_params['request_body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        header_params['Accept-Encoding'] = "gzip, deflate, br"

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

        # set the LUSID header
        header_params['X-LUSID-SDK-Language'] = 'Python'
        header_params['X-LUSID-SDK-Version'] = '0.11.4425'

        # Authentication setting
        auth_settings = ['oauth2']  # noqa: E501
        
        response_types_map = {
            200: "FeeRuleUpsertResponse",
            400: "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/transactions/fees/rules', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_types_map=response_types_map,
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats,
            _request_auth=local_var_params.get('_request_auth'))

# coding: utf-8 LUSID API      FINBOURNE Technology  # noqa: E501      The version of the OpenAPI document: 0.11.4425     Contact: <EMAIL>     Generated by: https://openapi-generator.tech # noqa: F401 # python 2 and python 3 compatibility library # noqa: F401 NOTE: This class is auto generated by OpenAPI Generator     Ref: https://openapi-generator.tech      Do not edit the class manually. # noqa: E501 [EXPERIMENTAL] DeleteTransactionFeeRule: Deletes a fee rule.  # noqa: E501          <br>              Deletes the rule for all effective time.                <br>              The rule will remain viewable at previous as at times, but it will no longer be considered by              GetApplicableFees.                <br>              This cannot be undone.                # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True          >>> thread = api.delete_transaction_fee_rule(code, async_req=True)         >>> result = thread.get()          :param code: The fee rule code. (required)         :type code: str         :param async_req: Whether to execute the request asynchronously.         :type async_req: bool, optional         :param _preload_content: if False, the urllib3.HTTPResponse object will                                  be returned without reading/decoding response                                  data. Default is True.         :type _preload_content: bool, optional         :param _request_timeout: timeout setting for this request. If one                                  number provided, it will be total request                                  timeout. It can also be a pair (tuple) of                                  (connection, read) timeouts.         :return: Returns the result object.                  If the method is called asynchronously,                  returns the request thread.         :rtype: DeletedEntityResponse # noqa: E501 # noqa: E501 [EXPERIMENTAL] DeleteTransactionFeeRule: Deletes a fee rule.  # noqa: E501          <br>              Deletes the rule for all effective time.                <br>              The rule will remain viewable at previous as at times, but it will no longer be considered by              GetApplicableFees.                <br>              This cannot be undone.                # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True          >>> thread = api.delete_transaction_fee_rule_with_http_info(code, async_req=True)         >>> result = thread.get()          :param code: The fee rule code. (required)         :type code: str         :param async_req: Whether to execute the request asynchronously.         :type async_req: bool, optional         :param _return_http_data_only: response data without head status code                                        and headers         :type _return_http_data_only: bool, optional         :param _preload_content: if False, the urllib3.HTTPResponse object will                                  be returned without reading/decoding response                                  data. Default is True.         :type _preload_content: bool, optional         :param _request_timeout: timeout setting for this request. If one                                  number provided, it will be total request                                  timeout. It can also be a pair (tuple) of                                  (connection, read) timeouts.         :param _request_auth: set to override the auth_settings for an a single                               request; this effectively ignores the authentication                               in the spec for a single request.         :type _request_auth: dict, optional         :return: Returns the result object.                  If the method is called asynchronously,                  returns the request thread.         :rtype: tuple(DeletedEntityResponse, status_code(int), headers(HTTPHeaderDict)) # verify the required parameter 'code' is set # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # HTTP header `Accept` # noqa: E501 # Authentication setting # noqa: E501 # noqa: E501 # noqa: E501 [EXPERIMENTAL] GetApplicableTransactionFees: Get the Fees and Commissions that may be applicable to a transaction.  # noqa: E501          Additionally, matching can be based on the instrument's properties, its portfolio properties, and any additional property keys present in the data file.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True          >>> thread = api.get_applicable_transaction_fees(async_req=True)         >>> result = thread.get()          :param effective_at: The effective datetime or cut label at which to match rule definitions. Defaults to the current LUSID  system datetime if not specified.         :type effective_at: str         :param as_at: The asAt datetime at which to match rule definitions. Defaults to returning the latest version if not  specified.         :type as_at: datetime         :param instrument_identifier_type: Optional. The unique identifier type to use, eg 'Figi' or 'LusidInstrumentId'.         :type instrument_identifier_type: str         :param instrument_identifier: Optional. The Instrument Identifier to get properties for.         :type instrument_identifier: str         :param portfolio_scope: Optional. The scope of the portfolio to fetch properties from.         :type portfolio_scope: str         :param portfolio_code: Optional. The code of the portfolio to fetch properties from.         :type portfolio_code: str         :param request_body: Any other property keys or fields, including the top-level fields of the              fee rule (e.g. \"ExecutionBroker\" and \"SettlementCurrency\" ) and those defined in AdditionalKeys, along with              their corresponding values that should be matched for fees. Eg. \"Instrument/default/Name=exampleValue\" or              \"AdditionalKey2=Value2\".         :type request_body: dict(str, str)         :param async_req: Whether to execute the request asynchronously.         :type async_req: bool, optional         :param _preload_content: if False, the urllib3.HTTPResponse object will                                  be returned without reading/decoding response                                  data. Default is True.         :type _preload_content: bool, optional         :param _request_timeout: timeout setting for this request. If one                                  number provided, it will be total request                                  timeout. It can also be a pair (tuple) of                                  (connection, read) timeouts.         :return: Returns the result object.                  If the method is called asynchronously,                  returns the request thread.         :rtype: ResourceListOfFeeRule # noqa: E501 # noqa: E501 [EXPERIMENTAL] GetApplicableTransactionFees: Get the Fees and Commissions that may be applicable to a transaction.  # noqa: E501          Additionally, matching can be based on the instrument's properties, its portfolio properties, and any additional property keys present in the data file.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True          >>> thread = api.get_applicable_transaction_fees_with_http_info(async_req=True)         >>> result = thread.get()          :param effective_at: The effective datetime or cut label at which to match rule definitions. Defaults to the current LUSID  system datetime if not specified.         :type effective_at: str         :param as_at: The asAt datetime at which to match rule definitions. Defaults to returning the latest version if not  specified.         :type as_at: datetime         :param instrument_identifier_type: Optional. The unique identifier type to use, eg 'Figi' or 'LusidInstrumentId'.         :type instrument_identifier_type: str         :param instrument_identifier: Optional. The Instrument Identifier to get properties for.         :type instrument_identifier: str         :param portfolio_scope: Optional. The scope of the portfolio to fetch properties from.         :type portfolio_scope: str         :param portfolio_code: Optional. The code of the portfolio to fetch properties from.         :type portfolio_code: str         :param request_body: Any other property keys or fields, including the top-level fields of the              fee rule (e.g. \"ExecutionBroker\" and \"SettlementCurrency\" ) and those defined in AdditionalKeys, along with              their corresponding values that should be matched for fees. Eg. \"Instrument/default/Name=exampleValue\" or              \"AdditionalKey2=Value2\".         :type request_body: dict(str, str)         :param async_req: Whether to execute the request asynchronously.         :type async_req: bool, optional         :param _return_http_data_only: response data without head status code                                        and headers         :type _return_http_data_only: bool, optional         :param _preload_content: if False, the urllib3.HTTPResponse object will                                  be returned without reading/decoding response                                  data. Default is True.         :type _preload_content: bool, optional         :param _request_timeout: timeout setting for this request. If one                                  number provided, it will be total request                                  timeout. It can also be a pair (tuple) of                                  (connection, read) timeouts.         :param _request_auth: set to override the auth_settings for an a single                               request; this effectively ignores the authentication                               in the spec for a single request.         :type _request_auth: dict, optional         :return: Returns the result object.                  If the method is called asynchronously,                  returns the request thread.         :rtype: tuple(ResourceListOfFeeRule, status_code(int), headers(HTTPHeaderDict)) # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # HTTP header `Accept` # noqa: E501 # HTTP header `Content-Type` # noqa: E501 # noqa: E501 # set the LUSID header # Authentication setting # noqa: E501 # noqa: E501 # noqa: E501 [EXPERIMENTAL] GetTransactionFeeRule: Retrieve the definition of single fee rule.  # noqa: E501          Retrieves the fee rule definition at the given effective and as at times.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True          >>> thread = api.get_transaction_fee_rule(code, async_req=True)         >>> result = thread.get()          :param code: The fee rule code. (required)         :type code: str         :param effective_at: The effective datetime or cut label at which to retrieve the rule definition. Defaults to the current LUSID  system datetime if not specified.         :type effective_at: str         :param as_at: The asAt datetime at which to retrieve the rule definition. Defaults to returning the latest version if not  specified.         :type as_at: datetime         :param async_req: Whether to execute the request asynchronously.         :type async_req: bool, optional         :param _preload_content: if False, the urllib3.HTTPResponse object will                                  be returned without reading/decoding response                                  data. Default is True.         :type _preload_content: bool, optional         :param _request_timeout: timeout setting for this request. If one                                  number provided, it will be total request                                  timeout. It can also be a pair (tuple) of                                  (connection, read) timeouts.         :return: Returns the result object.                  If the method is called asynchronously,                  returns the request thread.         :rtype: FeeRule # noqa: E501 # noqa: E501 [EXPERIMENTAL] GetTransactionFeeRule: Retrieve the definition of single fee rule.  # noqa: E501          Retrieves the fee rule definition at the given effective and as at times.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True          >>> thread = api.get_transaction_fee_rule_with_http_info(code, async_req=True)         >>> result = thread.get()          :param code: The fee rule code. (required)         :type code: str         :param effective_at: The effective datetime or cut label at which to retrieve the rule definition. Defaults to the current LUSID  system datetime if not specified.         :type effective_at: str         :param as_at: The asAt datetime at which to retrieve the rule definition. Defaults to returning the latest version if not  specified.         :type as_at: datetime         :param async_req: Whether to execute the request asynchronously.         :type async_req: bool, optional         :param _return_http_data_only: response data without head status code                                        and headers         :type _return_http_data_only: bool, optional         :param _preload_content: if False, the urllib3.HTTPResponse object will                                  be returned without reading/decoding response                                  data. Default is True.         :type _preload_content: bool, optional         :param _request_timeout: timeout setting for this request. If one                                  number provided, it will be total request                                  timeout. It can also be a pair (tuple) of                                  (connection, read) timeouts.         :param _request_auth: set to override the auth_settings for an a single                               request; this effectively ignores the authentication                               in the spec for a single request.         :type _request_auth: dict, optional         :return: Returns the result object.                  If the method is called asynchronously,                  returns the request thread.         :rtype: tuple(FeeRule, status_code(int), headers(HTTPHeaderDict)) # verify the required parameter 'code' is set # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # HTTP header `Accept` # noqa: E501 # Authentication setting # noqa: E501 # noqa: E501 # noqa: E501 [EXPERIMENTAL] ListTransactionFeeRules: List fee rules, with optional filtering.  # noqa: E501          For more information about filtering results,  see https://support.lusid.com/knowledgebase/article/KA-01914.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True          >>> thread = api.list_transaction_fee_rules(async_req=True)         >>> result = thread.get()          :param effective_at: The effective datetime or cut label at which to retrieve the rule definitions. Defaults to the current LUSID  system datetime if not specified.         :type effective_at: str         :param as_at: The asAt datetime at which to retrieve the rule definitions. Defaults to returning the latest version if not  specified.         :type as_at: datetime         :param limit: When paginating, limit the results to this number. Defaults to 100 if not specified.         :type limit: int         :param filter: Expression to filter the results.         :type filter: str         :param page: The pagination token to use to continue listing entities; this value is returned from the previous call. If  a pagination token is provided, the filter, effectiveAt and asAt fields must not have changed since the  original request.         :type page: str         :param async_req: Whether to execute the request asynchronously.         :type async_req: bool, optional         :param _preload_content: if False, the urllib3.HTTPResponse object will                                  be returned without reading/decoding response                                  data. Default is True.         :type _preload_content: bool, optional         :param _request_timeout: timeout setting for this request. If one                                  number provided, it will be total request                                  timeout. It can also be a pair (tuple) of                                  (connection, read) timeouts.         :return: Returns the result object.                  If the method is called asynchronously,                  returns the request thread.         :rtype: ResourceListOfFeeRule # noqa: E501 # noqa: E501 [EXPERIMENTAL] ListTransactionFeeRules: List fee rules, with optional filtering.  # noqa: E501          For more information about filtering results,  see https://support.lusid.com/knowledgebase/article/KA-01914.  # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True          >>> thread = api.list_transaction_fee_rules_with_http_info(async_req=True)         >>> result = thread.get()          :param effective_at: The effective datetime or cut label at which to retrieve the rule definitions. Defaults to the current LUSID  system datetime if not specified.         :type effective_at: str         :param as_at: The asAt datetime at which to retrieve the rule definitions. Defaults to returning the latest version if not  specified.         :type as_at: datetime         :param limit: When paginating, limit the results to this number. Defaults to 100 if not specified.         :type limit: int         :param filter: Expression to filter the results.         :type filter: str         :param page: The pagination token to use to continue listing entities; this value is returned from the previous call. If  a pagination token is provided, the filter, effectiveAt and asAt fields must not have changed since the  original request.         :type page: str         :param async_req: Whether to execute the request asynchronously.         :type async_req: bool, optional         :param _return_http_data_only: response data without head status code                                        and headers         :type _return_http_data_only: bool, optional         :param _preload_content: if False, the urllib3.HTTPResponse object will                                  be returned without reading/decoding response                                  data. Default is True.         :type _preload_content: bool, optional         :param _request_timeout: timeout setting for this request. If one                                  number provided, it will be total request                                  timeout. It can also be a pair (tuple) of                                  (connection, read) timeouts.         :param _request_auth: set to override the auth_settings for an a single                               request; this effectively ignores the authentication                               in the spec for a single request.         :type _request_auth: dict, optional         :return: Returns the result object.                  If the method is called asynchronously,                  returns the request thread.         :rtype: tuple(ResourceListOfFeeRule, status_code(int), headers(HTTPHeaderDict)) # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # HTTP header `Accept` # noqa: E501 # Authentication setting # noqa: E501 # noqa: E501 # noqa: E501 [EXPERIMENTAL] UpsertTransactionFeeRules: Upsert fee rules.  # noqa: E501          <br>              To upsert a new rule, the code field must be left empty, a code will then be assigned and returned as part              of the response. To update an existing rule, include the fee code. It is possible to both create and update              fee rules in the same request.                <br>              The upsert is transactional - either all create/update operations will succeed or none of them will.                # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True          >>> thread = api.upsert_transaction_fee_rules(request_body, async_req=True)         >>> result = thread.get()          :param request_body: A dictionary of upsert request identifiers to rule upsert requests. The request              identifiers are valid for the request only and can be used to link the upserted fee rule to the code of a              created fee rule. (required)         :type request_body: dict(str, FeeRuleUpsertRequest)         :param effective_at: The effective datetime or cut label at which the rule will take effect. Defaults to the current LUSID  system datetime if not specified. In the case of an update, the changes will take place from this effective  time until the next effective time that the rule as been upserted at. For example, consider a rule that  already exists, and has previously had an update applied so that the definition will change on the first day  of the coming month. An upsert effective from the current day will only change the definition until the  first day of the coming month. An additional upsert at the same time (first day of the month) is required  if the newly-updated definition is to supersede the future definition.         :type effective_at: str         :param async_req: Whether to execute the request asynchronously.         :type async_req: bool, optional         :param _preload_content: if False, the urllib3.HTTPResponse object will                                  be returned without reading/decoding response                                  data. Default is True.         :type _preload_content: bool, optional         :param _request_timeout: timeout setting for this request. If one                                  number provided, it will be total request                                  timeout. It can also be a pair (tuple) of                                  (connection, read) timeouts.         :return: Returns the result object.                  If the method is called asynchronously,                  returns the request thread.         :rtype: FeeRuleUpsertResponse # noqa: E501 # noqa: E501 [EXPERIMENTAL] UpsertTransactionFeeRules: Upsert fee rules.  # noqa: E501          <br>              To upsert a new rule, the code field must be left empty, a code will then be assigned and returned as part              of the response. To update an existing rule, include the fee code. It is possible to both create and update              fee rules in the same request.                <br>              The upsert is transactional - either all create/update operations will succeed or none of them will.                # noqa: E501         This method makes a synchronous HTTP request by default. To make an         asynchronous HTTP request, please pass async_req=True          >>> thread = api.upsert_transaction_fee_rules_with_http_info(request_body, async_req=True)         >>> result = thread.get()          :param request_body: A dictionary of upsert request identifiers to rule upsert requests. The request              identifiers are valid for the request only and can be used to link the upserted fee rule to the code of a              created fee rule. (required)         :type request_body: dict(str, FeeRuleUpsertRequest)         :param effective_at: The effective datetime or cut label at which the rule will take effect. Defaults to the current LUSID  system datetime if not specified. In the case of an update, the changes will take place from this effective  time until the next effective time that the rule as been upserted at. For example, consider a rule that  already exists, and has previously had an update applied so that the definition will change on the first day  of the coming month. An upsert effective from the current day will only change the definition until the  first day of the coming month. An additional upsert at the same time (first day of the month) is required  if the newly-updated definition is to supersede the future definition.         :type effective_at: str         :param async_req: Whether to execute the request asynchronously.         :type async_req: bool, optional         :param _return_http_data_only: response data without head status code                                        and headers         :type _return_http_data_only: bool, optional         :param _preload_content: if False, the urllib3.HTTPResponse object will                                  be returned without reading/decoding response                                  data. Default is True.         :type _preload_content: bool, optional         :param _request_timeout: timeout setting for this request. If one                                  number provided, it will be total request                                  timeout. It can also be a pair (tuple) of                                  (connection, read) timeouts.         :param _request_auth: set to override the auth_settings for an a single                               request; this effectively ignores the authentication                               in the spec for a single request.         :type _request_auth: dict, optional         :return: Returns the result object.                  If the method is called asynchronously,                  returns the request thread.         :rtype: tuple(FeeRuleUpsertResponse, status_code(int), headers(HTTPHeaderDict)) # verify the required parameter 'request_body' is set # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # noqa: E501 # HTTP header `Accept` # noqa: E501 # HTTP header `Content-Type` # noqa: E501 # noqa: E501 # set the LUSID header # Authentication setting # noqa: E501 # noqa: E501