public bool LoginToTradingScreen()
        {
            InitializeApi();

            _log.Info("Clearing position cache");
            _positionCache.Clear();
            _log.Info("Clearing order event cache");
            _orderEventIds.Clear();

            if (!_api.Login())
            {
                return(false);
            }

            _log.Info(_api.LastLoginMessage);

            return(!_api.LoginFailed && _api.LoggedIn);
        }
Example #2
0
        public void TestLogon()
        {
            var api = new TradingScreenApi {
                UserId = "malbec2_uat", Password = "******", Site = "UAT Prod B", PricingServer = "tcp://uatprod.trandingscreen.net:9901"
            };

            Assert.IsFalse(api.LoggedIn);
            Assert.IsFalse(api.LoginStarted);
            Assert.IsTrue(api.Login());
            Assert.IsFalse(api.LoginStarted);
            Assert.IsTrue(api.LoggedIn);
            Assert.IsNotNull(api.LastLoginMessage);


            Assert.AreEqual("OK", api.StartListeningForOrders(TestOrderEventHandler));
            // wait for a second in case we have orders to receive
            Thread.Sleep(1000);

            Assert.IsTrue(api.Logout());
        }