static void Main(string[] args) { var zmqClient = new ZmqClient(); var client = new ChumbyClient(); while (true) { var quotes = zmqClient.GetQuoteInfo(MarketDataSettings.StartupTickers.ToArray()); client.SendTickerUpdates(quotes.ToArray()); Thread.Sleep(4000); } }
public void ShouldPushQuoteMessages() { var zmqClient = new ZmqClient(); var client = new ChumbyClient(); for (var i = 0; i < 50; i++) { var quotes = zmqClient.GetQuoteInfo(MarketDataSettings.StartupTickers.ToArray()); client.SendTickerUpdates(quotes.ToArray()); Thread.Sleep(2000); } }
private static void Main(string[] args) { var zmqClient = new ZmqClient(); zmqClient.HandleSubscriberUpdate += ZmqClientOnHandleSubscriberUpdate; zmqClient.Start(MarketDataSettings.StartupTickers.ToArray()); var fleckHost = string.Empty; var fleckAddr = Dns.GetHostAddresses(fleckHost).First(a => a.AddressFamily == AddressFamily.InterNetwork).ToString(); var fleckServer = new WebSocketServer($"ws://{fleckAddr}:{MarketDataSettings.FleckServerPort}"); fleckServer.Start(socket => { socket.OnOpen = () => { Console.WriteLine($"Opened fleck server socket at {DateTime.Now.ToString("hh:mm:ss")}"); allSockets.Add(socket); }; socket.OnClose = () => { Console.WriteLine($"Closed flecker server socket at {DateTime.Now.ToString("hh:mm:ss")}"); allSockets.Remove(socket); }; socket.OnMessage = rawMessage => { // parse the list of tickers we expect to get in the message. var tickerList = rawMessage.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries); zmqClient.UpdateSubscriptions(tickerList); // not going to send a response back yet... only when we get an update from zmq server. }; isConnected = true; }); // a bit of a code smell, but Fleck will just die unless we go into a spin mode. while (true) { Thread.Sleep(100); } }
static void Main(string[] args) { if (args == null || !args.Any()) { Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Usage: MarketDataTestBench [snapshot] symbol symbol ..."); return; } using (var client = new ZmqClient()) { if (args[0] == "snapshot") { var response = client.GetQuoteInfoRaw(args.Skip(1).ToArray()); Console.WriteLine(response); Console.WriteLine(); return; } client.StartConsole(args); } }