예제 #1
0
 public void EmitUpdateMessage(UpdateMessageEventArgs args)
 {
     if (null != HandleUpdateMessage)
     {
         HandleUpdateMessage(this, args);
     }
 }
예제 #2
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;
            }
        }
예제 #3
0
        private void SymbolSpecificUpdateMessage(object o, UpdateMessageEventArgs args)
        {
            string Symbol = args.Message.Symbol;

            if (htWatchSymbols.ContainsKey(Symbol))
            {
                SymbolEvent se = htWatchSymbols[Symbol] as SymbolEvent;
                se.EmitUpdateMessage(args);
            }
        }