當前位置: 首頁>>代碼示例>>C#>>正文


C# API.BarSeries類代碼示例

本文整理匯總了C#中OpenQuant.API.BarSeries的典型用法代碼示例。如果您正苦於以下問題:C# BarSeries類的具體用法?C# BarSeries怎麽用?C# BarSeries使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BarSeries類屬於OpenQuant.API命名空間,在下文中一共展示了BarSeries類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SpiderVwapBand

 public SpiderVwapBand(BarSeries input, double factor, InstrumentType instrumentType)
     : base(input)
 {
     _factor = factor;
     _instrumentType = instrumentType;
     this.Name = string.Format("SpiderVwapBand ({0:N4})", factor);
 }
開發者ID:aggarwalmanuj,項目名稱:open-quant,代碼行數:7,代碼來源:SpiderVwapBand.cs

示例2: OnBar

        /*
        按照股指的時間要求,時間劃分是這樣的
        9:15
        9:45
        10:15
        10:45
        11:15-11:30 13:00-13:15 兩個15分鍾被午休隔開了
        13:45
        14:15
        14:45
        15:15 交割日時隻到15:00,已經到最後一天了,少15分鍾也沒什麽
        */
        public override void OnBar(Bar bar)
        {
            //隻處理15分鍾的
            if (900 == bar.Size)
            {
                if (bars == null)
                    bars = new BarSeries();

                bars.Add(bar);

                //在處理11:15-11:30 13:00-13:15這兩個15分鍾時會合並成一個
                if (bars.Count == 2) // 2 * 15min = 30 min
                {
                    // get OHLC values for 30min bar
                    double open = bars[0].Open;
                    double high = bars.HighestHigh();
                    double low = bars.LowestLow();
                    double close = bars[1].Close;
                    long volume = bars[0].Volume + bars[1].Volume;

                    // todo something
                    Bar b = new Bar(bars[0].DateTime, open, high, low, close, volume, 900 * 2);
                    bars30min.Add(b);
                    Console.WriteLine(b);

                    // reset 15min bar series
                    bars = null;
                }
            }
        }
開發者ID:huangzhengyong,項目名稱:OpenQuant,代碼行數:42,代碼來源:Non-natural_TimeBar_code.cs

示例3: BIAS

 protected BIAS(BarSeries series, SMA sma, int length, BarData barData)
     : base(series)
 {
     this.length = length;
     this.sma = sma;
     this.barData = barData;
     this.Name = "BIAS";
 }
開發者ID:huangzhengyong,項目名稱:OpenQuant,代碼行數:8,代碼來源:BIAS.cs

示例4: DynamicBBU

 public DynamicBBU(ISeries series, BarSeries bars, double k, BarData barData)
     : base(series)
 {
     this.k = k;
     this.bars = bars;
     this.barData = barData;
     this.Name = "DynamicBBU";
 }
開發者ID:huangzhengyong,項目名稱:OpenQuant,代碼行數:8,代碼來源:DynamicBBU.cs

示例5: KDJ

 protected KDJ(BarSeries series, K_Fast rsv, int length)
     : base(series)
 {
     this.length = length;
     this.rsv = rsv;
     this.K = new TimeSeries("K");
     this.D = new TimeSeries("D");
     this.Name = "KDJ(" + length + ")";
 }
開發者ID:ForTrade,項目名稱:OpenQuant,代碼行數:9,代碼來源:KDJ.cs

示例6: Compress

		public BarSeries Compress(DataEntryEnumerator enumerator)
		{
			BarSeries series = new BarSeries();
			this.NewCompressedBar += (sender, args) => series.Add(args.Bar);
			while (enumerator.MoveNext())
				this.Add(enumerator.Current);
			this.Flush();
			return series;
		}
開發者ID:heber,項目名稱:FreeOQ,代碼行數:9,代碼來源:BarCompressor.cs

示例7: SpiderVwapBandOld

 public SpiderVwapBandOld(ISeries input, double factor, BarSeries priceBarSeries, int barSize, InstrumentType instrumentType)
     : base(input)
 {
     _factor = factor;
     _priceBarSeries = priceBarSeries;
     _barSize = barSize;
     _instrumentType = instrumentType;
     this.Name = string.Format("SpiderVwapBand ({0:N4})", factor);
 }
開發者ID:aggarwalmanuj,項目名稱:open-quant,代碼行數:9,代碼來源:SpiderVwapBandOld.cs

示例8: GetHistoricalBars

		public static BarSeries GetHistoricalBars(string provider, Instrument instrument, DateTime begin, DateTime end, int size)
		{
			BarSeries barSeries = new BarSeries();
			if (FreeQuant.Providers.ProviderManager.HistoricalDataProviders.Contains(provider))
			{
				IHistoricalDataProvider provider1 = FreeQuant.Providers.ProviderManager.HistoricalDataProviders[provider];
				foreach (FreeQuant.Data.Bar bar in size != 86400 ? (FreeQuant.Series.TimeSeries) FreeQuant.Instruments.DataManager.GetHistoricalBars(provider1, instrument.instrument, begin, end, (long) size) : (FreeQuant.Series.TimeSeries) FreeQuant.Instruments.DataManager.GetHistoricalDailies(provider1, instrument.instrument, begin, end))
					barSeries.series.Add(bar);
			}
			return barSeries;
		}
開發者ID:heber,項目名稱:FreeOQ,代碼行數:11,代碼來源:DataManager.cs

示例9: OnStrategyStart

        public override void OnStrategyStart()
        {
            if (Instrument1 == Instrument)
            {
                //Strategy1 = this;
                BarSeries1 = GetBars(BarType.Time, barSize);
            }
            else if (Instrument2 == Instrument)
            {
                //Strategy2 = this;
                BarSeries2 = GetBars(BarType.Time, barSize);
            }
            else
            {
                Console.WriteLine("合約錯誤!" + Instrument);
            }

            sma = new SMA(spreadSeries, Length);

            Draw(spreadSeries, 2);
            Draw(sma, 2);
        }
開發者ID:qianweiqiang,項目名稱:OpenQuant,代碼行數:22,代碼來源:PairTrading_code.cs

示例10: GetHistoricalBars

		public static BarSeries GetHistoricalBars(string provider, Instrument instrument, DateTime begin, DateTime end, int size)
		{
			BarSeries barSeries = new BarSeries();
			if (SmartQuant.Providers.ProviderManager.HistoricalDataProviders.Contains(provider))
			{
				IHistoricalDataProvider provider2 = SmartQuant.Providers.ProviderManager.HistoricalDataProviders[provider];
				SmartQuant.Series.BarSeries barSeries2;
				if (size == 86400)
				{
					barSeries2 = SmartQuant.Instruments.DataManager.GetHistoricalDailies(provider2, instrument.instrument, begin, end);
				}
				else
				{
					barSeries2 = SmartQuant.Instruments.DataManager.GetHistoricalBars(provider2, instrument.instrument, begin, end, (long)size);
				}
				foreach (SmartQuant.Data.Bar bar in barSeries2)
				{
					barSeries.series.Add(bar);
				}
			}
			return barSeries;
		}
開發者ID:houzhongxu,項目名稱:OpenQuant.API,代碼行數:22,代碼來源:DataManager.cs

示例11: PreLoadHistoricalData

        private void PreLoadHistoricalData(DateTime startDate, int barSize, BarSeries barsToAppendTo)
        {
            Stopwatch watch = new Stopwatch();
            watch.Start();

            string barName = BarNameManager.GetBarName(barSize);
            LoggingUtility.WriteInfo(this, string.Format("Trying to retrieve {0} data starting from {1} from IB", barName, startDate.ToShortDateString()));

            BarSeries historicalData = GetHistoricalBars("IB", Instrument,
                startDate,
                Clock.Now,
                barSize);

            watch.Stop();

            int retrievedBarCount = historicalData.Count;

            LoggingUtility.WriteInfo(this,
                string.Format("Took {0}ms to retrieve data from IB for {1} period data. Total bars retrieved: {2}",
                    watch.ElapsedMilliseconds, barName, retrievedBarCount));

            watch.Reset();
            watch.Start();

            foreach (Bar currentBar in historicalData)
            {
                barsToAppendTo.Add(currentBar);

                SaveData(currentBar);

                OnBar(currentBar);
            }

            watch.Stop();

            LoggingUtility.WriteInfo(this,
                string.Format("Took {0}ms to load data into memory for {1} data", watch.ElapsedMilliseconds, barName));
        }
開發者ID:aggarwalmanuj,項目名稱:open-quant,代碼行數:38,代碼來源:BaseStrategy.DataHandling.cs

示例12: MDM

		public MDM(BarSeries series, Color color)
		{
			this.indicator = new FreeQuant.Indicators.MDM(series.series, color);
		}
開發者ID:heber,項目名稱:FreeOQ,代碼行數:4,代碼來源:MDM.cs

示例13: MOM

		public MOM(BarSeries series, int length, BarData option)
		{
			this.indicator = new FreeQuant.Indicators.MOM(series.series, length, EnumConverter.Convert(option));
		}
開發者ID:heber,項目名稱:FreeOQ,代碼行數:4,代碼來源:MOM.cs

示例14: VROC

		public VROC(BarSeries series, int length, Color color)
		{
			this.indicator = new FreeQuant.Indicators.VROC(series.series, length, color);
		}
開發者ID:heber,項目名稱:FreeOQ,代碼行數:4,代碼來源:VROC.cs

示例15: K_Slow

		public K_Slow(BarSeries series, int length, int order, Color color)
		{
			this.indicator = new FreeQuant.Indicators.K_Slow(series.series, length, order, color);
		}
開發者ID:heber,項目名稱:FreeOQ,代碼行數:4,代碼來源:K_Slow.cs


注:本文中的OpenQuant.API.BarSeries類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。