public static void Main(string[] args) { NbboServiceImpl s = new NbboServiceImpl(); /* * test(s); * NBBO nbbo = (NBBO)s.GetNbboData("IBM"); * Console.WriteLine(nbbo); */ PricesGenerator generator = new PricesGenerator(s); generator.Start(); while (true) { Console.Write("enter nbbo ticker or depth ticker(ctrl-c to kill):"); string cmd = Console.ReadLine(); string[] tokens = cmd.Split(' '); if (tokens.Length > 1) { if (tokens[0].Equals("nbbo")) { NBBO nbbo = (NBBO)s.GetNbboData(tokens[1].ToUpper()); if (nbbo != null) { Console.WriteLine(nbbo); } else { Console.WriteLine("ticker not found"); } } else { KeyValuePair <string, Quote>[] depth = (KeyValuePair <string, Quote>[])s.GetMarketData(tokens[1].ToUpper()); if (depth != null) { foreach (KeyValuePair <string, Quote> item in depth) { Console.WriteLine(item.Value); } } else { Console.WriteLine("ticker not found"); } } } } }
public static void test(NbboServiceImpl s) { s.OnTick("Name=IBM,Bid=150,BidSize=100,Last=150,Exch=NYSE"); s.OnTick("Name=IBM,Ask=151,AskSize=200,Last=150,Exch=NYSE"); s.OnTick("Name=IBM,Bid=150.1,BidSize=50,Last=150,Exch=US-C"); s.OnTick("Name=IBM,Ask=151.1,AskSize=150,Last=150,Exch=US-C"); s.OnTick("Name=IBM,Bid=150,BidSize=25,Last=150,Exch=ARCA"); s.OnTick("Name=IBM,Ask=151,AskSize=250,Last=150,Exch=ARCA"); s.OnTick("Name=IBM,Bid=150.2,BidSize=200,Last=150,Exch=BAT"); s.OnTick("Name=IBM,Ask=151.2,AskSize=20,Last=150,Exch=BAT"); s.OnTick("Name=IBM,Bid=150.2,BidSize=210,Last=150,Exch=LSE"); s.OnTick("Name=IBM,Ask=151.2,AskSize=10,Last=150,Exch=LSE"); s.OnTick("Name=IBM,Bid=150.2,BidSize=90,Last=150,Exch=TOT"); s.OnTick("Name=IBM,Ask=151.2,AskSize=190,Last=150,Exch=TOT"); }