static void Main(string[] args)
        {
            try
            {
                Log.Level = NLog.LogLevel.Debug;

                using ISession session = Configuration.Sessions.GetSession();

                // Open the session
                session.Open();

                // Define a stream to retrieve level 1 content...
                using var stream = OMMStream.Definition("EUR=").GetStream().OnRefresh((item, msg, s) => Console.WriteLine(msg))
                                   .OnUpdate((item, msg, s) => Console.WriteLine(msg))
                                   .OnError((item, err, s) => Console.WriteLine(err))
                                   .OnStatus((item, msg, s) => Console.WriteLine(msg));
                // Open the stream...
                stream.Open();

                // Wait for data to come in then hit any key to close the stream...
                Console.ReadKey();
            }
            catch (Exception e)
            {
                Console.WriteLine($"\n**************\nFailed to execute: {e.Message}\n{e.InnerException}\n***************");
            }
        }
        static void Main(string[] args)
        {
            try
            {
                // Create the platform session.
                using (ISession session = Configuration.Sessions.GetSession())
                {
                    // Open the session and test the state...
                    if (session.Open() == Session.State.Opened)
                    {
                        // Define a stream to retrieve a batch of level 1 instruments...
                        using var stream = OMMStream.Definition("EUR=", "GBP=", "CAD=").GetStream()
                                           .OnRefresh((item, msg, s) => DumpMsg(item, msg))
                                           .OnUpdate((item, msg, s) => DumpMsg(item, msg))
                                           .OnError((item, err, s) => Console.WriteLine(err))
                                           .OnStatus((item, msg, s) => Console.WriteLine(msg))
                                           .OnComplete(s => Console.WriteLine("\nInitial response for all instruments complete.  Updates will follow based on changes in the market..."));
                        // Open the stream...
                        stream.Open();

                        // Wait for data to come in then hit any key to close the stream...
                        Console.ReadKey();
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"\n**************\nFailed to execute: {e.Message}\n{e.InnerException}\n***************");
            }
        }
        static void Main(string[] args)
        {
            try
            {
                // Create the platform session.
                using (ISession session = Configuration.Sessions.GetSession())
                {
                    // Open the session and test the state...
                    if (session.Open() == Session.State.Opened)
                    {
                        // *******************************************************************************************************************************
                        // Requesting for multiple instruments.
                        // The following code segment demonstrates the usage of the library and .NET's asynchronous capabilities to send a collection of
                        // requests and monitor the whole collection for completion.
                        // *******************************************************************************************************************************
                        List <Task <Stream.State> > tasks = new List <Task <Stream.State> >();

                        // First, prepare our item stream definition, defining the fields of interest and where to capture events...
                        var itemDef = OMMStream.Definition().Fields("DSPLY_NAME", "BID", "ASK");

                        // Next, iterate through the collection of items, applying each to our parameters specification.  Send each request asynchronously...
                        foreach (var item in new[] { "EUR=", "GBP=", "CAD=" })
                        {
                            // Create our stream
                            IStream stream = itemDef.Name(item).GetStream().OnRefresh((item, msg, s) => DumpMsg(item, msg))
                                             .OnUpdate((item, msg, s) => DumpMsg(item, msg))
                                             .OnStatus((item, msg, s) => Console.WriteLine(msg))
                                             .OnError((item, err, s) => Console.WriteLine(err));

                            // Open the stream asynchronously and keep track of the task
                            tasks.Add(stream.OpenAsync());
                        }

                        // Monitor the collection for completion.  We are intentionally blocking here waiting for the whole collection to complete.
                        Task.WhenAll(tasks).GetAwaiter().GetResult();
                        Console.WriteLine("\nInitial response for all instruments complete.  Updates will follow based on changes in the market...");

                        // Wait for updates...
                        Console.ReadKey();
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"\n**************\nFailed to execute: {e.Message}\n{e.InnerException}\n***************");
            }
        }
        private static void TestStreaming()
        {
            string item1 = "EUR=";
            string item2 = "CAD=";

            try
            {
                var stream1 = OMMStream.Definition(item1).GetStream().OnRefresh((item, msg, s) => Console.WriteLine($"{DateTime.Now}:{msg}"))
                              .OnUpdate((item, msg, s) => DumpMsg(item, msg))
                              .OnStatus((item, msg, s) => Console.WriteLine($"{DateTime.Now} => Status1: {msg}"))
                              .OnError((item, msg, s) => Console.WriteLine($"Stream1 error: {DateTime.Now}:{msg}"));
                if (stream1.Open() != Stream.State.Opened)
                {
                    Console.WriteLine($"Stream did not open: {stream1.OpenState}");
                }

                var stream2 = OMMStream.Definition(item2).GetStream().OnRefresh((item, msg, s) => Console.WriteLine($"{DateTime.Now}:{msg}"))
                              .OnUpdate((item, msg, s) => DumpMsg(item, msg))
                              .OnStatus((item, msg, s) => Console.WriteLine($"{DateTime.Now} => Status2: {msg}"))
                              .OnError((item, msg, s) => Console.WriteLine($"Stream2 error: {DateTime.Now}:{msg}"));
                stream2.Open();

                Console.ReadKey();
                stream1.Close();
                Console.WriteLine($"Stream {item1} has been closed.  Hit any key to close the {item2} stream...");
                Console.ReadKey();
                stream2.Close();
            }
            catch (PlatformNotSupportedException e)
            {
                Console.WriteLine($"\n******{e.Message} Choose an alternative WebSocket implementation.\n");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        static void Main(string[] args)
        {
            try
            {
                Log.Level = NLog.LogLevel.Debug;

                // Complete image of the concatenation our MarketByPrice level 2 initial refreshes
                JObject image = new JObject();

                // Create a session into the platform.
                using (ISession session = Configuration.Sessions.GetSession())
                {
                    // Open the session
                    session.Open();

                    // Define a MarketByPrice stream specifying the Domain "MarketByPrice"
                    // For each refresh, we merge the contents into the image object.  Once all refresh segments have arrived, the
                    // OnComplete is executed and the completed image details are presented for display.
                    using IStream stream = OMMStream.Definition("BB.TO").Domain("MarketByPrice")
                                           .GetStream().OnRefresh((item, msg, s) => image.Merge(msg))
                                           .OnComplete(s => DumpImage(image))
                                           .OnUpdate((item, msg, s) => DumpUpdate(msg))
                                           .OnStatus((item, msg, s) => Console.WriteLine(msg))
                                           .OnError((item, err, s) => Console.WriteLine(err));
                    // Open the stream...
                    stream.Open();

                    // Wait for data to come in then hit any key to close the stream...
                    Console.ReadKey();
                }
            }
            catch (Exception e)
            {
                Console.WriteLine($"\n**************\nFailed to execute: {e.Message}\n{e.InnerException}\n***************");
            }
        }