Ejemplo n.º 1
0
        internal void EmitQuoteTrade(object sender, UpdateMessageEventArgs args)
        {
            IQFeedDataRequestRecord rr = htL1WatchedSymbols[args.Message.Symbol] as IQFeedDataRequestRecord;

            /*
             * if (SmartQuant.TraceLevel.Verbose == trace) {
             * string s;
             * s = string.Format("  sym='{0}',lst='{1}',vol='{2}',bid='{3}',ask='{4}',bsz='{5}',asz='{6}',typ='{7}'",
             *  args.Message.Symbol, args.Message.Last, args.Message.LastSize,
             *  args.Message.Bid, args.Message.Ask, args.Message.BidSize, args.Message.Type );
             * Console.WriteLine(s);
             * }
             */

            switch (args.Message.Type)
            {
            case "a":
            case "b":
                if (null != NewQuote)
                {
                    QuoteEventArgs q = new QuoteEventArgs(
                        new Quote(
                            rr.GetUniqueTimeStamp(),
                            args.Message.Bid,
                            args.Message.BidSize,
                            args.Message.Ask,
                            args.Message.AskSize),
                        rr.instrument, this);
                    NewQuote(this, q);
                }
                break;

            case "t":
            case "T":
                Trade trade = new Trade(
                    rr.GetUniqueTimeStamp(),
                    args.Message.Last,
                    args.Message.LastSize);
                if (null != NewTrade)
                {
                    TradeEventArgs t = new TradeEventArgs(trade, rr.instrument, this);
                    NewTrade(this, t);
                }
                if (null != factory)
                {
                    factory.OnNewTrade(rr.instrument, trade);
                }
                break;

            case "o":
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
 private void EmitNewTradeEvent(IFIXInstrument instrument, Trade trade)
 {
     if (NewTrade != null)
     {
         NewTrade(this, new TradeEventArgs(trade, instrument, this));
     }
     if (factory != null)
     {
         factory.OnNewTrade(instrument, trade);
     }
 }
        private void EmitNewTradeEvent(IFIXInstrument instrument, Trade trade)
        {
            if (this.MarketDataFilter != null)
            {
                trade = this.MarketDataFilter.FilterTrade(trade, instrument.Symbol);
            }

            if (trade != null)
            {
                if (NewTrade != null)
                {
                    NewTrade(this, new TradeEventArgs(trade, instrument, this));
                }
                if (factory != null)
                {
                    factory.OnNewTrade(instrument, trade);
                }
            }
        }
Ejemplo n.º 4
0
        private void EmitNewTradeEvent(IFIXInstrument instrument, SmartQuant.Data.Trade trade)
        {
            if (trade == null)
            {
                return;
            }

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

            var NewTradeDelegate = (MulticastDelegate)NewTradeField.GetValue(marketDataProvider);

            foreach (Delegate dlg in NewTradeDelegate.GetInvocationList())
            {
                dlg.Method.Invoke(dlg.Target, new object[] { marketDataProvider, new TradeEventArgs(trade, instrument, marketDataProvider) });
            }

            if (factory != null)
            {
                factory.OnNewTrade(instrument, trade);
            }
        }