当前位置: 首页>>代码示例>>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;未经允许,请勿转载。