public static void Main(string[] args)
        {
            var container = new Container();

            container.Configure(c => c.Scan(_ =>
            {
                _.AssemblyContainingType(typeof(Program));
                _.WithDefaultConventions();
            }));

            var subscriptionManager      = container.GetInstance <ISubscriptionManager>();
            var signalRConnectionManager = container.GetInstance <ISignalRConnectionManager>();
            var activityMonitor          = container.GetInstance <IActivityMonitor>();

            var accountVariables = container.GetInstance <AccountVariables>();

            accountVariables.InitializeVariables();

            try
            {
                using (var stream = new QuoteStream(subscriptionManager, signalRConnectionManager, activityMonitor))
                    stream.Run().Wait();
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("Stream terminated with exception:");
                Console.Error.WriteLine($"  {ex.GetType()}: {ex.Message}");
                if (ex.InnerException != null)
                {
                    Console.Error.WriteLine($"  {ex.InnerException.GetType()}: {ex.InnerException.Message}");
                }
            }
        }
        /// <summary>
        /// Configure all the actors and dependancies, returns an IActorRef for the ProgramActor actor
        /// </summary>
        public static IActorRef ConfigureServices(ActorSystem system, InsuranceProvider[] providers, Barrier barrier)
        {
            IActorRef backLogManager = BacklogManager.Create(system);
            IActorRef quoteStream    = QuoteStream.Create(system, backLogManager, 100, 100, 1500, QuoteGenerator.GenerateQuote);
            var       userInterface  = new UserInterface();
            IActorRef ux             = UIManager.Create(system, quoteStream, userInterface, barrier);
            IActorRef monitor        = UpstreamMonitor.Create(system, quoteStream, userInterface.Panel, providers);

            // trick to allow bidirectional dependancies,tell the other actors about the actor via a message
            // instead of via props.
            var uxReady = new UserInterfaceReady(ux);

            backLogManager.Tell(uxReady);
            quoteStream.Tell(uxReady);

            IActorRef program = ProgramActor.Create(system, ux, monitor);

            return(program);
        }
        /// <summary>
        /// Creates a new TradeHub Tick Data object
        /// </summary>
        /// <param name="quoteStream"></param>
        /// <returns></returns>
        private Tick CreateTickData(QuoteStream quoteStream)
        {
            try
            {
                if (quoteStream.type.Equals("summary"))
                {
                    return(null);
                }
                // Format our new DateTime object to start at the UNIX Epoch
                DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);

                // Create new Tick object
                Tick tick = new Tick(new Security()
                {
                    Symbol = quoteStream.symbol
                }, _marketDataProviderName);

                if (quoteStream.type.Equals("quote"))
                {
                    // Extract UNIX timestamp
                    var timestamp = Convert.ToDouble(quoteStream.biddate);

                    // Add the timestamp (number of seconds since the Epoch) to be converted
                    dateTime = dateTime.AddMilliseconds(timestamp);

                    // Set time to local object
                    tick.DateTime = dateTime;

                    // Extract BID information
                    tick.BidPrice    = Convert.ToDecimal(quoteStream.bid);
                    tick.BidSize     = Convert.ToDecimal(quoteStream.bidsz);
                    tick.BidExchange = quoteStream.bidexch;

                    // Extract ASK information
                    tick.AskPrice    = Convert.ToDecimal(quoteStream.ask);
                    tick.AskSize     = Convert.ToDecimal(quoteStream.asksz);
                    tick.AskExchange = quoteStream.askexch;
                }
                else if (quoteStream.type.Equals("trade"))
                {
                    // Extract UNIX timestamp
                    var timestamp = Convert.ToDouble(quoteStream.date);

                    // Add the timestamp (number of seconds since the Epoch) to be converted
                    dateTime = dateTime.AddMilliseconds(timestamp);

                    // Set time to local object
                    tick.DateTime = dateTime;

                    // Extract LAST/TRADE information
                    tick.LastPrice    = Convert.ToDecimal(quoteStream.price);
                    tick.LastSize     = Convert.ToDecimal(quoteStream.size);
                    tick.LastExchange = quoteStream.exch;
                }

                return(tick);
            }
            catch (Exception exception)
            {
                _logger.Error(exception, _type.FullName, "CreateTickData");
                return(null);
            }
        }