﻿using System;
using QuantConnect.Parameters;
using QuantConnect.Util;

namespace QuantConnect.Data.Custom.Intrinio
{
    /// <summary>
    ///     Auxiliary class to access all Intrinio API data.
    /// </summary>
    public static class IntrinioConfig
    {
        /// <summary>
        /// </summary>
        public static RateGate RateGate =
            new RateGate(1, TimeSpan.FromMilliseconds(5000));

        /// <summary>
        ///     Check if Intrinio API user and password are not empty or null.
        /// </summary>
        public static bool IsInitialized => !string.IsNullOrWhiteSpace(User) && !string.IsNullOrWhiteSpace(Password);

        /// <summary>
        ///     Intrinio API password
        /// </summary>
        public static string Password = string.Empty;

        /// <summary>
        ///     Intrinio API user
        /// </summary>
        public static string User = string.Empty;

        /// <summary>
        ///     Set the Intrinio API user and password.
        /// </summary>
        public static void SetUserAndPassword(string user, string password)
        {
            User = user;
            Password = password;

            if (!IsInitialized)
            {
                throw new InvalidOperationException("Please set a valid Intrinio user and password.");
            }
        }
    }
}
﻿using System;
using QuantConnect.Parameters;
using QuantConnect.Util;

namespace QuantConnect.Data.Custom.Intrinio
{
    /// <summary>
    ///     Auxiliary class to access all Intrinio API data.
    /// </summary>
    public static class IntrinioConfig
    {
        /// <summary>
        /// </summary>
        public static RateGate RateGate =
            new RateGate(1, TimeSpan.FromMinutes(1));

        /// <summary>
        ///     Check if Intrinio API user and password are not empty or null.
        /// </summary>
        public static bool IsInitialized => !string.IsNullOrWhiteSpace(User) && !string.IsNullOrWhiteSpace(Password);

        /// <summary>
        ///     Intrinio API password
        /// </summary>
        public static string Password = string.Empty;

        /// <summary>
        ///     Intrinio API user
        /// </summary>
        public static string User = string.Empty;

        /// <summary>
        ///     Set the Intrinio API user and password.
        /// </summary>
        public static void SetUserAndPassword(string user, string password)
        {
            User = user;
            Password = password;

            if (!IsInitialized)
            {
                throw new InvalidOperationException("Please set a valid Intrinio user and password.");
            }
        }
    }
}
Increment Intrinio time between calls to 1 minute
Increment Intrinio time between calls to 1 minute

The actual implementation uses the Intrinio `historical_data` end point and ask for CSV format. At the moment of development, the key they provided and the one used in the test has a limit of 1 call per second for the historical_data` end point`, now the key only free access 1 call per minute.

This commit is the fastest fix for the test failing but is impractical for any user with a free account. Maybe a better solution is to implement `historical_data` end point and but asking for the JSON (default) format. This implies implementing reading the data from JSON and implement paging in the `BaseData.Read` method.