Exemple #1
0
        /// <summary>
        /// Returns history requirements for the volatility model expressed in the form of history request
        /// </summary>
        /// <param name="security">The security of the request</param>
        /// <param name="utcTime">The date of the request</param>
        /// <returns>History request object list, or empty if no requirements</returns>
        public IEnumerable <HistoryRequest> GetHistoryRequirements(Security security, DateTime utcTime)
        {
            var barCount       = _window.Size + 1;
            var localStartTime = Time.GetStartTimeForTradeBars(security.Exchange.Hours, utcTime.ConvertFromUtc(security.Exchange.TimeZone), _periodSpan, barCount, security.IsExtendedMarketHours);
            var utcStartTime   = localStartTime.ConvertToUtc(security.Exchange.TimeZone);

            return(new[]
            {
                new HistoryRequest(utcStartTime,
                                   utcTime,
                                   typeof(TradeBar),
                                   security.Symbol,
                                   Resolution.Daily,
                                   security.Exchange.Hours,
                                   MarketHoursDatabase.FromDataFolder().GetDataTimeZone(security.Symbol.ID.Market, security.Symbol, security.Type),
                                   Resolution.Daily,
                                   security.IsExtendedMarketHours,
                                   security.IsCustomData(),
                                   security.DataNormalizationMode,
                                   LeanData.GetCommonTickTypeForCommonDataTypes(typeof(TradeBar), security.Type))
            });
        }