当前位置: 首页>>代码示例>>C#>>正文


C# Data.SubscriptionDataConfig类代码示例

本文整理汇总了C#中QuantConnect.Data.SubscriptionDataConfig的典型用法代码示例。如果您正苦于以下问题:C# SubscriptionDataConfig类的具体用法?C# SubscriptionDataConfig怎么用?C# SubscriptionDataConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SubscriptionDataConfig类属于QuantConnect.Data命名空间,在下文中一共展示了SubscriptionDataConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StreamStore

 /// <summary>
 /// Initializes a new instance of the <see cref="StreamStore"/> class
 /// </summary>
 /// <param name="config">The subscripton's configuration</param>
 /// <param name="security">The security object, used for exchange hours</param>
 public StreamStore(SubscriptionDataConfig config, Security security)
 {
     _security = security;
     _config = config;
     _increment = config.Increment;
     _queue = new ConcurrentQueue<BaseData>();
 }
开发者ID:hittudiv,项目名称:Lean,代码行数:12,代码来源:StreamStore.cs

示例2: UniverseSelectionEventArgs

 /// <summary>
 /// Initializes a new instance of the <see cref="UniverseSelectionEventArgs"/> class
 /// </summary>
 /// <param name="universe">The universe that raised this event</param>
 /// <param name="configuration">Theconfiguration for the data</param>
 /// <param name="dateTimeUtc">The date time this event was fired in UTC</param>
 /// <param name="data">The data contained within this event</param>
 public UniverseSelectionEventArgs(Universe universe, SubscriptionDataConfig configuration, DateTime dateTimeUtc, IReadOnlyList<BaseData> data)
 {
     Universe = universe;
     Configuration = configuration;
     DateTimeUtc = dateTimeUtc;
     Data = data;
 }
开发者ID:tremblayEric,项目名称:LeanHistory,代码行数:14,代码来源:UniverseSelectionEventArgs.cs

示例3: CreateEnumerator

        /// <summary>
        /// Creates an enumerator to read the specified request
        /// </summary>
        /// <param name="request">The subscription request to be read</param>
        /// <param name="dataFileProvider">Provider used to get data when it is not present on disk</param>
        /// <returns>An enumerator reading the subscription request</returns>
        public IEnumerator<BaseData> CreateEnumerator(SubscriptionRequest request, IDataFileProvider dataFileProvider)
        {
            var tradableDays = _tradableDaysProvider(request);

            var fineFundamental = new FineFundamental();
            var fineFundamentalConfiguration = new SubscriptionDataConfig(request.Configuration, typeof(FineFundamental), request.Security.Symbol);

            return (
                from date in tradableDays

                let fineFundamentalSource = GetSource(fineFundamental, fineFundamentalConfiguration, date)
                let fineFundamentalFactory = SubscriptionDataSourceReader.ForSource(fineFundamentalSource, dataFileProvider, fineFundamentalConfiguration, date, false)
                let fineFundamentalForDate = (FineFundamental)fineFundamentalFactory.Read(fineFundamentalSource).FirstOrDefault()

                select new FineFundamental
                {
                    DataType = MarketDataType.Auxiliary,
                    Symbol = request.Configuration.Symbol,
                    Time = date,
                    CompanyReference = fineFundamentalForDate != null ? fineFundamentalForDate.CompanyReference : new CompanyReference(),
                    SecurityReference = fineFundamentalForDate != null ? fineFundamentalForDate.SecurityReference : new SecurityReference(),
                    FinancialStatements = fineFundamentalForDate != null ? fineFundamentalForDate.FinancialStatements : new FinancialStatements(),
                    EarningReports = fineFundamentalForDate != null ? fineFundamentalForDate.EarningReports : new EarningReports(),
                    OperationRatios = fineFundamentalForDate != null ? fineFundamentalForDate.OperationRatios : new OperationRatios(),
                    EarningRatios = fineFundamentalForDate != null ? fineFundamentalForDate.EarningRatios : new EarningRatios(),
                    ValuationRatios = fineFundamentalForDate != null ? fineFundamentalForDate.ValuationRatios : new ValuationRatios()
                }
                ).GetEnumerator();
        }
开发者ID:AlexCatarino,项目名称:Lean,代码行数:35,代码来源:FineFundamentalSubscriptionEnumeratorFactory.cs

示例4: TextSubscriptionFactory

 /// <summary>
 /// Initializes a new instance of the <see cref="TextSubscriptionFactory"/> class
 /// </summary>
 /// <param name="config">The subscription's configuration</param>
 /// <param name="date">The date this factory was produced to read data for</param>
 /// <param name="isLiveMode">True if we're in live mode, false for backtesting</param>
 public TextSubscriptionFactory(SubscriptionDataConfig config, DateTime date, bool isLiveMode)
 {
     _date = date;
     _config = config;
     _isLiveMode = isLiveMode;
     _factory = (BaseData) ObjectActivator.GetActivator(config.Type).Invoke(new object[0]);
 }
开发者ID:neosb,项目名称:Lean,代码行数:13,代码来源:TextSubscriptionFactory.cs

示例5: Equity

        /// <summary>
        /// Construct the Equity Object
        /// </summary>
        public Equity(SubscriptionDataConfig config, decimal leverage)
            : this(MarketHoursDatabase.FromDataFolder().GetExchangeHours(config), config, leverage)
        {
            // this constructor is provided for backward compatibility

            // should we even keep this?
        }
开发者ID:skyfyl,项目名称:Lean,代码行数:10,代码来源:Equity.cs

示例6: GetSource

 public override SubscriptionDataSource GetSource(SubscriptionDataConfig config, DateTime date, bool isLiveMode)
 {
     // this file is only a few seconds worth of data, so it's quick to download
     var remoteFileSource = @"http://www.quantconnect.com/live-test?type=file&symbols=" + config.Symbol.Value;
     remoteFileSource = @"http://beta.quantconnect.com/live-test?type=file&symbols=" + config.Symbol.Value;
     return new SubscriptionDataSource(remoteFileSource, SubscriptionTransportMedium.RemoteFile, FileFormat.Csv);
 }
开发者ID:vikewoods,项目名称:Lean,代码行数:7,代码来源:RemoteFileBaseData.cs

示例7: Equity

        /// <summary>
        /// Construct the Equity Object
        /// </summary>
        public Equity(SubscriptionDataConfig config, decimal leverage, bool isDynamicallyLoadedData = false)
            : this(SecurityExchangeHoursProvider.FromDataFolder().GetExchangeHours(config), config, leverage, isDynamicallyLoadedData)
        {
            // this constructor is provided for backward compatibility

            // should we even keep this?
        }
开发者ID:rchien,项目名称:Lean,代码行数:10,代码来源:Equity.cs

示例8: PerformsLimitFillSell

        public void PerformsLimitFillSell()
        {
            var model = new SecurityTransactionModel();
            var order = new LimitOrder(Symbol, -100, 101.5m, DateTime.Now, type: SecurityType.Equity);
            var config = new SubscriptionDataConfig(typeof(TradeBar), SecurityType.Equity, Symbol, Resolution.Minute, true, true, true, true, false, 0);
            var security = new Security(config, 1);
            security.SetMarketPrice(DateTime.Now, new IndicatorDataPoint(Symbol, DateTime.Now, 101m));

            var fill = model.LimitFill(security, order);

            Assert.AreEqual(0, fill.FillQuantity);
            Assert.AreEqual(0, fill.FillPrice);
            Assert.AreEqual(OrderStatus.None, fill.Status);
            Assert.AreEqual(OrderStatus.None, order.Status);

            security.SetMarketPrice(DateTime.Now, new TradeBar(DateTime.Now, Symbol, 102m, 103m, 101m, 102.3m, 100));

            fill = model.LimitFill(security, order);

            // this fills worst case scenario, so it's at the limit price
            Assert.AreEqual(order.Quantity, fill.FillQuantity);
            Assert.AreEqual(Math.Max(order.LimitPrice, security.Low), fill.FillPrice);
            Assert.AreEqual(OrderStatus.Filled, fill.Status);
            Assert.AreEqual(OrderStatus.Filled, order.Status);
        }
开发者ID:sopnic,项目名称:Lean,代码行数:25,代码来源:SecurityTransactionModelTests.cs

示例9: ZipEntryNameSubscriptionFactory

 /// <summary>
 /// Initializes a new instance of the <see cref="ZipEntryNameSubscriptionFactory"/> class
 /// </summary>
 /// <param name="config">The subscription's configuration</param>
 /// <param name="dateTime">The date this factory was produced to read data for</param>
 /// <param name="isLiveMode">True if we're in live mode, false for backtesting</param>
 public ZipEntryNameSubscriptionFactory(SubscriptionDataConfig config, DateTime dateTime, bool isLiveMode)
 {
     _config = config;
     _dateTime = dateTime;
     _isLiveMode = isLiveMode;
     _factory = (BaseData) Activator.CreateInstance(config.Type);
 }
开发者ID:kaffeebrauer,项目名称:Lean,代码行数:13,代码来源:ZipEntryNameSubscriptionFactory.cs

示例10: Forex

        /// <summary>
        /// Constructor for the forex security
        /// </summary>
        /// <param name="quoteCurrency">The cash object that represent the quote currency</param>
        /// <param name="config">The subscription configuration for this security</param>
        /// <param name="leverage">The leverage used for this security</param>
        public Forex(Cash quoteCurrency, SubscriptionDataConfig config, decimal leverage)
            : this(SecurityExchangeHoursProvider.FromDataFolder().GetExchangeHours(config), quoteCurrency, config, leverage)
        {
            // this constructor is provided for backward compatibility

            // should we even keep this?
        }
开发者ID:vikewoods,项目名称:Lean,代码行数:13,代码来源:Forex.cs

示例11: ConstructorDecomposesBaseAndQuoteCurrencies

 public void ConstructorDecomposesBaseAndQuoteCurrencies()
 {
     var config = new SubscriptionDataConfig(typeof(TradeBar), Symbols.EURUSD, Resolution.Minute, TimeZones.NewYork, TimeZones.NewYork, true, true, true);
     var forex = new QuantConnect.Securities.Forex.Forex(SecurityExchangeHours.AlwaysOpen(config.DataTimeZone), new Cash("usd", 0, 0), config, SymbolProperties.GetDefault("usd"));
     Assert.AreEqual("EUR", forex.BaseCurrencySymbol);
     Assert.AreEqual("USD", forex.QuoteCurrency.Symbol);
 }
开发者ID:kaffeebrauer,项目名称:Lean,代码行数:7,代码来源:ForexTests.cs

示例12: UpdatesAfterCorrectPeriodElapses

        public void UpdatesAfterCorrectPeriodElapses()
        {
            const int periods = 3;
            var periodSpan = Time.OneMinute;
            var reference = new DateTime(2016, 04, 06, 12, 0, 0);
            var referenceUtc = reference.ConvertToUtc(TimeZones.NewYork);
            var timeKeeper = new TimeKeeper(referenceUtc);
            var config = new SubscriptionDataConfig(typeof (TradeBar), Symbols.SPY, Resolution.Minute, TimeZones.NewYork, TimeZones.NewYork, true, false, false);
            var security = new Security(SecurityExchangeHours.AlwaysOpen(TimeZones.NewYork), config, new Cash("USD", 0, 0), SymbolProperties.GetDefault("USD"));
            security.SetLocalTimeKeeper(timeKeeper.GetLocalTimeKeeper(TimeZones.NewYork));

            var model = new RelativeStandardDeviationVolatilityModel(periodSpan, periods);
            security.VolatilityModel = model;

            var first = new IndicatorDataPoint(reference, 1);
            security.SetMarketPrice(first);

            Assert.AreEqual(0m, model.Volatility);

            const decimal value = 0.471404520791032M; // std of 1,2 is ~0.707 over a mean of 1.5
            var second = new IndicatorDataPoint(reference.AddMinutes(1), 2);
            security.SetMarketPrice(second);
            Assert.AreEqual(value, model.Volatility);

            // update should not be applied since not enough time has passed
            var third = new IndicatorDataPoint(reference.AddMinutes(1.01), 1000);
            security.SetMarketPrice(third);
            Assert.AreEqual(value, model.Volatility);

            var fourth = new IndicatorDataPoint(reference.AddMinutes(2), 3m);
            security.SetMarketPrice(fourth);
            Assert.AreEqual(0.5m, model.Volatility);
        }
开发者ID:kaffeebrauer,项目名称:Lean,代码行数:33,代码来源:RelativeStandardDeviationVolatilityModelTests.cs

示例13: FundamentalEventArgs

 /// <summary>
 /// Initializes a new instance of the <see cref="FundamentalEventArgs"/> class
 /// </summary>
 /// <param name="fundamentalType">The type of fundamental data</param>
 /// <param name="configuration">Theconfiguration for the data</param>
 /// <param name="dateTimeUtc">The date time this event was fired in UTC</param>
 /// <param name="data">The data contained within this event</param>
 public FundamentalEventArgs(FundamentalType fundamentalType, SubscriptionDataConfig configuration, DateTime dateTimeUtc, IReadOnlyList<BaseData> data)
 {
     FundamentalType = fundamentalType;
     Configuration = configuration;
     DateTimeUtc = dateTimeUtc;
     Data = data;
 }
开发者ID:WadeLWright,项目名称:Lean,代码行数:14,代码来源:FundamentalEventArgs.cs

示例14: UsedAsDictionaryKey

 public void UsedAsDictionaryKey()
 {
     var set = new HashSet<SubscriptionDataConfig>();
     var config1 = new SubscriptionDataConfig(typeof(TradeBar), Symbols.SPY, Resolution.Minute, TimeZones.NewYork, TimeZones.NewYork, false, false, false, false, TickType.Trade, false);
     Assert.IsTrue(set.Add(config1));
     var config2 = new SubscriptionDataConfig(config1);
     Assert.IsFalse(set.Add(config2));
 }
开发者ID:AlexCatarino,项目名称:Lean,代码行数:8,代码来源:SubscriptionDataConfigTests.cs

示例15: GetCoarseFundamentals

 /// <summary>
 /// Gets the <see cref="CoarseFundamental"/> data for the specified market/date
 /// </summary>
 public static IEnumerable<CoarseFundamental> GetCoarseFundamentals(string market, DateTimeZone timeZone, DateTime date, bool isLiveMode)
 {
     var factory = new CoarseFundamental();
     var config = new SubscriptionDataConfig(typeof(CoarseFundamental), SecurityType.Equity, new Symbol(market + "-coarse"), Resolution.Daily, market, timeZone, true, false, true, false);
     var reader = new BaseDataSubscriptionFactory(config, date, isLiveMode);
     var source = factory.GetSource(config, date, isLiveMode);
     return reader.Read(source).OfType<CoarseFundamental>();
 }
开发者ID:reinhardtken,项目名称:Lean,代码行数:11,代码来源:UniverseSelection.cs


注:本文中的QuantConnect.Data.SubscriptionDataConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。