當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。