Пример #1
0
        private void EmitNewQuoteEvent(IFIXInstrument instrument, SmartQuant.Data.Quote quote)
        {
            if (quote == null)
            {
                return;
            }

            if (instrument == null)
            {
                throw new ArgumentException("合约不存在,请检查是否创建了合约");
            }

            // 本想把这行代码放在构造函数中的,结果发现有问题
            // 在QuoteMonitor中可以看到价差,但在策略中并不会触发相应的事件
            var NewQuoteDelegate = (MulticastDelegate)NewQuoteField.GetValue(marketDataProvider);

            foreach (Delegate dlg in NewQuoteDelegate.GetInvocationList())
            {
                dlg.Method.Invoke(dlg.Target, new object[] { marketDataProvider, new QuoteEventArgs(quote, instrument, marketDataProvider) });
            }

            if (factory != null)
            {
                factory.OnNewQuote(instrument, quote);
            }
        }
Пример #2
0
 public void EmitHistoricalQuote(global::OpenQuant.API.HistoricalDataRequest request, DateTime datetime, double bid, int bidSize, double ask, int askSize)
 {
     if (this.NewHistoricalQuote != null)
     {
         SmartQuant.Data.Quote    quote = new SmartQuant.Data.Quote(datetime, bid, bidSize, ask, askSize);
         HistoricalQuoteEventArgs args  = new HistoricalQuoteEventArgs(quote, request.request.RequestId, request.request.Instrument, this, 0);
         this.NewHistoricalQuote(this, args);
     }
 }
        public SmartQuant.Data.Quote FilterQuote(SmartQuant.Data.Quote quote, string symbol)
        {
            Quote quote2 = this.oqFilter.FilterQuote(new Quote(quote), symbol);

            if (quote2 == null)
            {
                return(null);
            }
            return(quote2.quote);
        }
        public void EmitQuote(string instrument, DateTime time, byte providerId, double bid, int bidSize, double ask, int askSize)
        {
            SmartQuant.Data.Quote quote = new SmartQuant.Data.Quote(time, bid, bidSize, ask, askSize)
            {
                ProviderId = providerId
            };

            SmartQuant.Instruments.Instrument inst = SmartQuant.Instruments.InstrumentManager.Instruments[instrument];

            EmitNewQuoteEvent(inst, quote);
        }
Пример #5
0
        public void EmitQuote(string instrument, DateTime time, byte providerId, double bid, int bidSize, double ask, int askSize)
        {
            SmartQuant.Data.Quote quote = new SmartQuant.Data.Quote(time, bid, bidSize, ask, askSize)
            {
                ProviderId = providerId
            };

            SmartQuant.Instruments.Instrument inst = SmartQuant.Instruments.InstrumentManager.Instruments[instrument];

            EmitNewQuoteEvent(inst, quote);
        }
Пример #6
0
 public void EmitQuote(global::OpenQuant.API.Instrument instrument, DateTime time, byte providerId, double bid, int bidSize, double ask, int askSize)
 {
     SmartQuant.Data.Quote quote = new SmartQuant.Data.Quote(time, bid, bidSize, ask, askSize);
     quote.ProviderId = providerId;
     if (this.MarketDataFilter != null)
     {
         quote = this.MarketDataFilter.FilterQuote(quote, instrument.Symbol);
     }
     if (quote == null)
     {
         return;
     }
     if (this.NewQuote != null)
     {
         this.NewQuote(this, new QuoteEventArgs(quote, instrument.instrument, this));
     }
     if (this.barFactory != null)
     {
         this.barFactory.OnNewQuote(instrument.instrument, quote);
     }
 }
Пример #7
0
		internal Quote(SmartQuant.Data.Quote quote)
		{
			this.quote = quote;
		}
Пример #8
0
		public Quote(DateTime dateTime, double bid, int bidSize, double ask, int askSize)
		{
			this.quote = new SmartQuant.Data.Quote(dateTime, bid, bidSize, ask, askSize);
		}
Пример #9
0
 internal Quote(SmartQuant.Data.Quote quote)
 {
     this.quote = quote;
 }
Пример #10
0
 public Quote(DateTime dateTime, double bid, int bidSize, double ask, int askSize)
 {
     this.quote = new SmartQuant.Data.Quote(dateTime, bid, bidSize, ask, askSize);
 }
Пример #11
0
		public void EmitHistoricalQuote(global::OpenQuant.API.HistoricalDataRequest request, DateTime datetime, double bid, int bidSize, double ask, int askSize)
		{
			if (this.NewHistoricalQuote != null)
			{
				SmartQuant.Data.Quote quote = new SmartQuant.Data.Quote(datetime, bid, bidSize, ask, askSize);
				HistoricalQuoteEventArgs args = new HistoricalQuoteEventArgs(quote, request.request.RequestId, request.request.Instrument, this, 0);
				this.NewHistoricalQuote(this, args);
			}
		}
Пример #12
0
		public void EmitQuote(global::OpenQuant.API.Instrument instrument, DateTime time, byte providerId, double bid, int bidSize, double ask, int askSize)
		{
			SmartQuant.Data.Quote quote = new SmartQuant.Data.Quote(time, bid, bidSize, ask, askSize);
			quote.ProviderId = providerId;
			if (this.MarketDataFilter != null)
			{
				quote = this.MarketDataFilter.FilterQuote(quote, instrument.Symbol);
			}
			if (quote == null)
			{
				return;
			}
			if (this.NewQuote != null)
			{
				this.NewQuote(this, new QuoteEventArgs(quote, instrument.instrument, this));
			}
			if (this.barFactory != null)
			{
				this.barFactory.OnNewQuote(instrument.instrument, quote);
			}
		}
Пример #13
0
 public object Convert(SmartQuant.Data.Quote quote)
 {
     return(new Quote(quote));
 }