コード例 #1
0
        public static BarCompressor GetCompressor(global::OpenQuant.API.BarType barType, long oldBarSize, long newBarSize)
        {
            BarCompressor barCompressor;

            switch (barType)
            {
            case global::OpenQuant.API.BarType.Time:
                barCompressor = new TimeBarCompressor();
                break;

            case global::OpenQuant.API.BarType.Tick:
                barCompressor = new TickBarCompressor();
                break;

            case global::OpenQuant.API.BarType.Volume:
                barCompressor = new VolumeBarCompressor();
                break;

            case global::OpenQuant.API.BarType.Range:
                barCompressor = new RangeBarCompressor();
                break;

            default:
                throw new ArgumentException(string.Format("Unknown bar type - {0}", barType));
            }
            barCompressor.oldBarSize = oldBarSize;
            barCompressor.newBarSize = newBarSize;
            return(barCompressor);
        }
コード例 #2
0
 protected void CreateNewBar(global::OpenQuant.API.BarType barType, DateTime beginTime, DateTime endTime, double price)
 {
     if (barType == global::OpenQuant.API.BarType.Time && this.newBarSize == 86400L)
     {
         this.bar = new global::OpenQuant.API.Bar(new Daily(beginTime, price, price, price, price, 0L));
         return;
     }
     this.bar = new global::OpenQuant.API.Bar(new SmartQuant.Data.Bar(EnumConverter.Convert(barType), this.newBarSize, beginTime, endTime, price, price, price, price, 0L, 0L));
 }
コード例 #3
0
 public void EmitBar(global::OpenQuant.API.Instrument instrument, global::OpenQuant.API.BarType barType, long barSize, DateTime beginDateTime, DateTime endDateTime, double open, double high, double low, double close, long volume)
 {
     SmartQuant.Data.Bar bar = new SmartQuant.Data.Bar(global::OpenQuant.API.EnumConverter.Convert(barType), barSize, beginDateTime, endDateTime, open, high, low, close, volume, 0L);
     if (this.MarketDataFilter != null)
     {
         bar = this.MarketDataFilter.FilterBar(bar, instrument.Symbol);
     }
     if (bar != null)
     {
         this.EmitBar(instrument.instrument, bar);
     }
 }