Exemplo n.º 1
0
        public IApiResource GetApiResource(DataTypeConfig dataType, ITickerPeriodParameter parameter, bool isConfigureAwait = true, bool useCache = true)
        {
            UpdateApiKeyIfNeeded();
            var useOndemand = config.IsForceOndemandApi ? true : taskHelper.ShouldUseOndemandEndpoint(dataType, parameter.GetTicker(), parameter.GetPeriod(), config.IsOndemandEndpointEnabled, isConfigureAwait, useCache);

            client.UpdateApiKey(config.ApiKey);
            var json = client.Get(dataType, parameter, useOndemand, isConfigureAwait, useCache);

            return(parser.Parse(dataType, json));
        }
Exemplo n.º 2
0
        public JObject Get(DataTypeConfig dataType, ITickerPeriodParameter parameter, bool useOndemand, bool isConfigureAwait = true, bool useCache = true)
        {
            switch (dataType)
            {
            case DataTypeConfig.Quarter:
                return(GetQuarter(parameter as TickerQuarterParameter, useOndemand, isConfigureAwait, useCache));

            case DataTypeConfig.Indicator:
                return(GetIndicator(parameter as TickerEmptyPeriodParameter, isConfigureAwait, useCache));

            case DataTypeConfig.Company:
                return(GetCompany(parameter as TickerEmptyPeriodParameter, isConfigureAwait, useCache));

            default:
                throw new NotSupportedDataTypeException($"Get {dataType} is not supported at V2");
            }
        }
 public IApiResource Fetch(DataTypeConfig dataType, ITickerPeriodParameter parameter, bool isConfigureAwait, bool useCache) => processor.GetApiResource(dataType, parameter, isConfigureAwait, useCache);