Example #1
0
    def setUpClass(cls):
        # create a configured API client
        api_client = ApiClientBuilder().build(CredentialsSource.secrets_path())

        cls.transaction_portfolios_api = lusid.TransactionPortfoliosApi(
            api_client)
        cls.instruments_api = lusid.InstrumentsApi(api_client)

        instrument_loader = InstrumentLoader(cls.instruments_api)
        cls.instrument_ids = instrument_loader.load_instruments()

        cls.test_data_utilities = TestDataUtilities(
            cls.transaction_portfolios_api)
    def setUpClass(cls):

        cls.wait_time = 15
        open_excel(cls.wait_time)

        api_client = ApiClientBuilder().build(CredentialsSource.secrets_path())

        cls.scopes_api = lusid.ScopesApi(api_client)
        cls.portfolios_api = lusid.PortfoliosApi(api_client)
        cls.transaction_portfolios_api = lusid.TransactionPortfoliosApi(api_client)
        cls.aggregation_api = lusid.AggregationApi(api_client)
        cls.reconciliations_api = lusid.ReconciliationsApi(api_client)
        cls.book_name = "LUSID Excel - Setting up your IBOR template Global Equity Fund.xlsx"
Example #3
0
    def setUp(cls):
        # create a configured API client
        api_client = ApiClientBuilder().build(
            str(CredentialsSource.secrets_path()))

        cls.instruments_api = lusid.InstrumentsApi(api_client)
        cls.portfolios_api = lusid.PortfoliosApi(api_client)
        cls.transaction_portfolios_api = lusid.TransactionPortfoliosApi(
            api_client)
        cls.corporate_actions_sources_api = lusid.CorporateActionSourcesApi(
            api_client)

        cls.id_generator = IdGenerator(scope=TestDataUtilities.tutorials_scope)
Example #4
0
    def setUpClass(cls):
        # create a configured API client
        api_client = ApiClientBuilder().build(CredentialsSource.secrets_path())

        cls.property_definitions_api = lusid.PropertyDefinitionsApi(api_client)
        cls.transaction_portfolios_api = lusid.TransactionPortfoliosApi(api_client)
        cls.instruments_api = lusid.InstrumentsApi(api_client)
        cls.portfolios_api = lusid.PortfoliosApi(api_client)

        instrument_loader = InstrumentLoader(cls.instruments_api)
        cls.instrument_ids = instrument_loader.load_instruments()

        cls.test_data_utilities = TestDataUtilities(cls.transaction_portfolios_api)
        cls.id_generator = IdGenerator(scope=TestDataUtilities.tutorials_scope)
    def __init__(self, **kwargs):
        """
        Iniitalise an ApiClientFactory by passing the token, api_url and app_name, or by
        passing in the api_secrets_filename

        :param str token: Bearer token used to initialise the API
        :param str api_secrets_filename: Name of secrets file (including full path)
        :param str api_url: LUSID API url
        :param str app_name: Application name (optional)
        :param str certificate_filename: Name of the certificate file (.pem, .cer or .crt)
        :param str proxy_url: The url of the proxy to use including the port e.g. http://myproxy.com:8888
        :param str proxy_username: The username for the proxy to use
        :param str proxy_password: The password for the proxy to use
        :param str correlation_id: Correlation id for all calls made from the returned LUSID API instances
        :param bool tcp_keep_alive: A flag for controlling if the API client uses TCP keep-alive probes
        """

        builder_kwargs = {}

        if "token" in kwargs and str(kwargs["token"]) != "None":

            # If there is a token use it along with the specified proxy details if specified
            config = ApiConfiguration(
                api_url=kwargs.get("api_url", None),
                certificate_filename=kwargs.get("certificate_filename", None),
                proxy_config=ProxyConfig(
                    address=kwargs.get("proxy_url", None),
                    username=kwargs.get("proxy_username", None),
                    password=kwargs.get("proxy_password", None),
                ) if kwargs.get("proxy_url", None) is not None else None,
                app_name=kwargs.get("app_name", None))

            builder_kwargs["api_configuration"] = config
            builder_kwargs["token"] = kwargs["token"]

        # Otherwise use a secrets file if it exists
        builder_kwargs["api_secrets_filename"] = kwargs.get(
            "api_secrets_filename", None)

        # add the correlation id if specified
        builder_kwargs["correlation_id"] = kwargs.get("correlation_id", None)

        # add the id provider response handler if specified
        builder_kwargs["id_provider_response_handler"] = kwargs.get(
            "id_provider_response_handler", None)

        builder_kwargs["tcp_keep_alive"] = kwargs.get("tcp_keep_alive", False)

        # Call the client builder, this will result in using either a token, secrets file or environment variables
        self.api_client = ApiClientBuilder.build(**builder_kwargs)
    def __init__(self, **kwargs):
        """
        Iniitalise an ApiClientFactory by passing the token, api_url and app_name, or by
        passing in the api_secrets_filename

        :param str token: Bearer token used to initialise the API
        :param str api_secrets_filename: Name of secrets file (including full path)
        :param str api_url: LUSID API url
        :param str app_name: Application name (optional)
        :param str certificate_filename: Name of the certificate file (.pem, .cer or .crt)
        :param str proxy_url: The url of the proxy to use including the port e.g. http://myproxy.com:8888
        :param str proxy_username: The username for the proxy to use
        :param str proxy_password: The password for the proxy to use
        """

        builder_kwargs = {}

        if "token" in kwargs and str(kwargs["token"]) != "None":
            # If there is a token use it along with the specified proxy details if specified
            config = ApiConfiguration(
                api_url=kwargs.get("api_url", None),
                certificate_filename=kwargs.get("certificate_filename", None),
                proxy_config=ProxyConfig(
                    address=kwargs.get("proxy_url", None),
                    username=kwargs.get("proxy_username", None),
                    password=kwargs.get("proxy_password", None),
                ) if kwargs.get("proxy_url", None) is not None else None,
                app_name=kwargs.get("app_name", None))

            builder_kwargs["api_configuration"] = config
            builder_kwargs["token"] = kwargs["token"]

        # Otherwise use a secrets file if it exists
        builder_kwargs["api_secrets_filename"] = kwargs.get(
            "api_secrets_filename", None)

        # Call the client builder, this will result in using either a token, secrets file or environment variables
        self.api_client = ApiClientBuilder.build(**builder_kwargs)
    def setUp(cls):
        # create a configured API client
        api_client = ApiClientBuilder().build(CredentialsSource.secrets_path())

        cls.corporate_actions_sources_api = lusid.CorporateActionSourcesApi(
            api_client)