Ejemplo n.º 1
0
        public void EmitMarketDepth(global::OpenQuant.API.Instrument instrument, DateTime time, BidAsk side, OrderBookAction action, double price, int size, int position)
        {
            MarketDepth marketDepth = new MarketDepth(time, string.Empty, position, global::OpenQuant.API.EnumConverter.Convert(action), global::OpenQuant.API.EnumConverter.Convert(side), price, size);

            if (this.NewMarketDepth != null)
            {
                this.NewMarketDepth(this, new MarketDepthEventArgs(marketDepth, instrument.instrument, this));
            }
        }
Ejemplo n.º 2
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);
     }
 }
Ejemplo n.º 3
0
        public void SendMarketDataRequest(FIXMarketDataRequest request)
        {
            SubscriptionDataType subscriptionDataType = (SubscriptionDataType)0;

            for (int i = 0; i < request.NoMDEntryTypes; i++)
            {
                FIXMDEntryTypesGroup mDEntryTypesGroup = request.GetMDEntryTypesGroup(i);
                switch (mDEntryTypesGroup.MDEntryType)
                {
                case '0':
                case '1':
                    if (request.MarketDepth == 1)
                    {
                        subscriptionDataType |= SubscriptionDataType.Quotes;
                    }
                    else
                    {
                        subscriptionDataType |= SubscriptionDataType.OrderBook;
                    }
                    break;

                case '2':
                    subscriptionDataType |= SubscriptionDataType.Trades;
                    break;
                }
            }
            for (int j = 0; j < request.NoRelatedSym; j++)
            {
                FIXRelatedSymGroup relatedSymGroup           = request.GetRelatedSymGroup(j);
                SmartQuant.Instruments.Instrument key        = SmartQuant.Instruments.InstrumentManager.Instruments[relatedSymGroup.Symbol];
                global::OpenQuant.API.Instrument  instrument = Map.SQ_OQ_Instrument[key] as global::OpenQuant.API.Instrument;
                switch (request.SubscriptionRequestType)
                {
                case '1':
                    this.provider.CallSubscribe(instrument, subscriptionDataType);
                    break;

                case '2':
                    this.provider.CallUnsubscribe(instrument, subscriptionDataType);
                    break;

                default:
                    throw new Exception("Unknown subscription request type " + request.SubscriptionRequestType);
                }
            }
        }
Ejemplo n.º 4
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);
     }
 }
Ejemplo n.º 5
0
 public void EmitTrade(global::OpenQuant.API.Instrument instrument, DateTime time, byte providerId, double price, int size)
 {
     SmartQuant.Data.Trade trade = new SmartQuant.Data.Trade(time, price, size);
     trade.ProviderId = providerId;
     if (this.MarketDataFilter != null)
     {
         trade = this.MarketDataFilter.FilterTrade(trade, instrument.Symbol);
     }
     if (trade == null)
     {
         return;
     }
     if (this.NewTrade != null)
     {
         this.NewTrade(this, new TradeEventArgs(trade, instrument.instrument, this));
     }
     if (this.barFactory != null)
     {
         this.barFactory.OnNewTrade(instrument.instrument, trade);
     }
 }