public void CanChangePassword()
        {
            const string NEWPASSWORD = "******";
            var rpcClient = new Client(Settings.RpcUri,Settings.StreamingUri, AppKey);
            
            //Login with existing credentials
            rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);

            //And change password
            var changePasswordResponse = rpcClient.Authentication.ChangePassword(new ApiChangePasswordRequestDTO()
                                                                                         {
                                                                                             UserName = Settings.RpcUserName,
                                                                                             Password = Settings.RpcPassword,
                                                                                             NewPassword = NEWPASSWORD
                                                                                         });

            Assert.IsTrue(changePasswordResponse.IsPasswordChanged);
            rpcClient.LogOut();

            //Make sure that login existing password fails 
            Assert.Throws<ReliableHttpException>(() => rpcClient.LogIn(Settings.RpcUserName, Settings.RpcUserName));

            //Login with changed password and change back
            rpcClient.LogIn(Settings.RpcUserName, NEWPASSWORD);
            changePasswordResponse = rpcClient.Authentication.ChangePassword(new ApiChangePasswordRequestDTO()
                                                                                         {
                                                                                             UserName = Settings.RpcUserName,
                                                                                             Password = NEWPASSWORD,
                                                                                             NewPassword = Settings.RpcPassword
                                                                                         });

            Assert.IsTrue(changePasswordResponse.IsPasswordChanged);
            rpcClient.LogOut();
            rpcClient.Dispose();
        }
        public void Issue42()
        {

            var rpcClient = new Client(Settings.RpcUri);
            rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);
            var param = new NewStopLimitOrderRequestDTO
                            {
                                OrderId = 0,
                                MarketId = 99498,
                                Currency = null,
                                AutoRollover = false,
                                Direction = "buy",
                                Quantity = 10m,
                                BidPrice = 12094m,
                                OfferPrice = 12098m,
                                AuditId = "20110629-G2PREPROD3-0102794",
                                TradingAccountId = 400002249,
                                IfDone = null,
                                OcoOrder = null,
                                Applicability = null,
                                ExpiryDateTimeUTC = null,
                                Guaranteed = false,
                                TriggerPrice = 0m
                            };
            var response = rpcClient.TradesAndOrders.Order(param);


            rpcClient.LogOut();
        }
        public void RecordNewDataForCIAPI()
        {
            var rpcClient = new Client(new Uri("https://ciapi.cityindex.com/tradingapi"), new Uri("https://push.cityindex.com"), "foobardotnet");

            // start recording requests
            var stream = new MemoryStream();
            var streamRecorder = new StreamRecorder(rpcClient, stream);
            streamRecorder.Start();

            rpcClient.LogIn("secret", "secret");

            var accountInfo = rpcClient.AccountInformation.GetClientAndTradingAccount();
            rpcClient.SpreadMarkets.ListSpreadMarkets("", "", accountInfo.ClientAccountId, 100, false);
            rpcClient.News.ListNewsHeadlinesWithSource("dj", "UK", 10);
            rpcClient.Market.GetMarketInformation(MarketId.ToString());
            rpcClient.PriceHistory.GetPriceBars(MarketId.ToString(), "MINUTE", 1, "20");
            rpcClient.TradesAndOrders.ListOpenPositions(accountInfo.SpreadBettingAccount.TradingAccountId);

            rpcClient.LogOut();

            streamRecorder.Stop();
            stream.Position = 0;

            using (var fileStream = File.Create("recorded_requests.txt"))
            {
                stream.WriteTo(fileStream);
            }
        }
Ejemplo n.º 4
0
        private static void DoPolling()
        {
            var client = new Client(Const.RPC_URI, Const.STREAMING_URI, "Test.{B4E415A7-C453-4867-BDD1-C77ED345777B}");
            try
            {
                client.AppKey = "Test";
                client.StartMetrics();

                client.LogIn(Const.USERNAME, Const.PASSWORD);

                for (int i = 0; i < 10; i++)
                {
                    var accountInfo = client.AccountInformation.GetClientAndTradingAccount();
                    client.TradesAndOrders.ListOpenPositions(accountInfo.CFDAccount.TradingAccountId);
                    Thread.Sleep(1000);
                }

                client.LogOut();
            }
            catch (Exception exc)
            {
                Trace.WriteLine(exc);
            }
            finally
            {
                client.Dispose();
            }
        }
Ejemplo n.º 5
0
        public IStreamingClient BuildStreamingClient()
        {
            var authenticatedClient = new CIAPI.Rpc.Client(Settings.RpcUri, Settings.StreamingUri, AppKey);

            authenticatedClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);
            return(authenticatedClient.CreateStreamingClient());
        }
        public void CanMockCiapiServerConversation()
        {
            Uri uri = new Uri(NormalizeUrl("/"));
            var rpcClient = new Client(uri, uri, "foobardotnet");

            rpcClient.LogIn("Foo", "Bar");

            Assert.AreEqual("5f28983b-0e0a-4a57-92af-0d07c6fdbc38", rpcClient.Session);

            // get some headlines
            var headlines = rpcClient.News.ListNewsHeadlinesWithSource("dj", "UK", 100);
            Assert.AreEqual(100, headlines.Headlines.Length);

            // get a story id from one of the headlines
            var storyId = headlines.Headlines[0].StoryId;
            Assert.AreEqual(1416482, storyId);

            var storyDetail = rpcClient.News.GetNewsDetail("dj", storyId.ToString());

            Assert.IsTrue(storyDetail.NewsDetail.Story.Contains("By Anita Greil "));

            rpcClient.LogOut();

            rpcClient.Dispose();
        }
Ejemplo n.º 7
0
        public void CanSendMetrics()
        {

            // set up a listener
            var log = new StringBuilder();
            var writer = new StringWriter(log);
            var listener = new TextWriterTraceListener(writer);
            Trace.Listeners.Add(listener);

            var rpcClient = new Client(Settings.RpcUri, Settings.StreamingUri, "my-test-appkey");
            var metricsRecorder = new MetricsRecorder(rpcClient, new Uri("http://metrics.labs.cityindex.com/LogEvent.ashx"));
            metricsRecorder.Start();

            rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);

            var headlines = rpcClient.News.ListNewsHeadlinesWithSource("dj", "UK", 100);

            foreach (var item in headlines.Headlines)
            {
                rpcClient.News.GetNewsDetail("dj", item.StoryId.ToString());
            }

            new AutoResetEvent(false).WaitOne(10000);

            rpcClient.LogOut();

            metricsRecorder.Stop();
            rpcClient.Dispose();

            Trace.Listeners.Remove(listener);

            var logText = log.ToString();

            Assert.IsTrue(logText.Contains("Latency message complete"), "did not find evidence of metrics being posted");
        }
Ejemplo n.º 8
0
 public Client BuildRpcClient()
 {
     //Thread.Sleep(2000); // to let throttle settle down
     var rpcClient = new Client(Settings.RpcUri, Settings.StreamingUri, AppKey);
     rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);
     return rpcClient;
 }
Ejemplo n.º 9
0
 private void AutoLogin()
 {
     if (_ctx == null)
     {
         _ctx = new CIAPI.Rpc.Client(RPC_URI);
         _ctx.LogIn(USERNAME, PASSWORD);
     }
 }
Ejemplo n.º 10
0
        protected Client BuildRpcClient()
        {
            // WARNING: do not nest or otherwise refactor this method
            // buildUri is looking back 2 stack frames to get the method that called this

            var rpcClient = new Client(BuildUri(), new Uri(_streamingUrl), _apiKey);
            rpcClient.LogIn(_userName, _password);
            return rpcClient;
        }
Ejemplo n.º 11
0
        public void AppKeyIsAppendedToLogonRequest()
        {
            // look at the log to verify - need to expose interals and provide a means to examine the cache to verify programmatically

            var rpcClient = new Client(Settings.RpcUri, Settings.StreamingUri, "my-test-appkey");
            rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);

            rpcClient.LogOut();
            rpcClient.Dispose();
        }
Ejemplo n.º 12
0
 private void LoginButton_Click(object sender, EventArgs e)
 {
     _client = new Client(new Uri(EndpointTextBox.Text), new Uri("http://foo.com"), "mocument client demo");
     _client.LogIn(UsernameTextBox.Text, PasswordTextBox.Text);
     SessionIDLabel.Text = _client.Session;
     OpenPositionsGroupBox.Enabled = false;
     ClientAccountsGroupBox.Enabled = true;
     LogInGroupBox.Enabled = false;
     LogOutButton.Enabled = true;
 }
Ejemplo n.º 13
0
		public static void Connect() 
		{
			Console.WriteLine ("Connecting to CIAPI");
			_rpcClient = new Client(
				new Uri(ConfigurationManager.AppSettings["Server"]), 
				new Uri(ConfigurationManager.AppSettings["StreamingServer"]), 
				ConfigurationManager.AppSettings["ApiKey"] );
			_rpcClient.LogIn(ConfigurationManager.AppSettings["UserName"], ConfigurationManager.AppSettings["Password"]);
			_streamingClient = _rpcClient.CreateStreamingClient();
		}
Ejemplo n.º 14
0
        public void InvalidLoginShouldThrow()
        {
            var rpcClient = new Client(Settings.RpcUri, Settings.StreamingUri, AppKey);
            rpcClient.LogIn(Settings.RpcUserName, "foo");

            Assert.That(rpcClient.Session, Is.Not.Empty);

            rpcClient.LogOut();
            rpcClient.Dispose();
        }
Ejemplo n.º 15
0
        public void LoginShouldCreateSession()
        {
            var rpcClient = new Client(Settings.RpcUri, Settings.StreamingUri, AppKey);
            rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);

            Assert.That(rpcClient.Session, Is.Not.Empty);

            rpcClient.LogOut();
            rpcClient.Dispose();
        }
Ejemplo n.º 16
0
        public void CheckNetLatency()
        {
            Console.WriteLine("Checking .net latency");

            var server = new CassiniDevServer();
            server.StartServer(Environment.CurrentDirectory);

            var ctx = new Client(new Uri(server.NormalizeUrl("/")), new Uri(server.NormalizeUrl("/")), "foo");

            DateTimeOffset requestRecieved = DateTimeOffset.MinValue;
            RequestCompletedEventArgs requestInfo = null;
            ctx.RequestCompleted += (i, e) =>
                                        {
                                            requestInfo = e;
                                        };
            server.Server.ProcessRequest += (i, e) =>
                                                {
                                                    e.Continue = false;
                                                    e.Response = LoggedIn;
                                                    e.ResponseStatus = 200;
                                                    requestRecieved = DateTimeOffset.UtcNow;

                                                };


            try
            {
                ctx.LogIn(Settings.RpcUserName, Settings.RpcPassword);
            }
            finally
            {
                server.Dispose();
            }

            Console.WriteLine("elapsed   {0}", requestInfo.Info.Watch.ElapsedMilliseconds);

            // #TODO: not sure i like the complete removal of temporal data

            //Console.WriteLine("issued   {0}", requestInfo.Info.Issued.Ticks);
            //Console.WriteLine("recieved {0}", requestRecieved.Ticks);
            //Console.WriteLine("competed {0}", requestInfo.Info.Completed.Ticks);

            //Console.WriteLine("issued to recieved {0}", TimeSpan.FromTicks(requestRecieved.Ticks - requestInfo.Info.Issued.Ticks));
            //Console.WriteLine("recieved to completed {0}", TimeSpan.FromTicks(requestInfo.Info.Completed.Ticks - requestRecieved.Ticks));
            //Console.WriteLine("issued to completed {0}", TimeSpan.FromTicks(requestInfo.Info.Completed.Ticks - requestInfo.Info.Issued.Ticks));


            

            Assert.IsNotNullOrEmpty(ctx.Session);



            ctx.Dispose();
        }
        public void CanListOpenPositions()
        {

            var rpcClient = new Client(Settings.RpcUri);
            rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);
            AccountInformationResponseDTO accounts = rpcClient.AccountInformation.GetClientAndTradingAccount();
            rpcClient.TradesAndOrders.ListOpenPositions(accounts.TradingAccounts[0].TradingAccountId);
     

            rpcClient.LogOut();
        }
Ejemplo n.º 18
0
        public void InvalidLoginShouldThrow()
        {
            var rpcClient = new Client(Settings.RpcUri, Settings.StreamingUri, AppKey);

            rpcClient.LogIn(Settings.RpcUserName, "foo");

            Assert.That(rpcClient.Session, Is.Not.Empty);

            rpcClient.LogOut();
            rpcClient.Dispose();
        }
Ejemplo n.º 19
0
        public void LoginShouldCreateSession()
        {
            var rpcClient = new Client(Settings.RpcUri, Settings.StreamingUri, AppKey);

            rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);

            Assert.That(rpcClient.Session, Is.Not.Empty);

            rpcClient.LogOut();
            rpcClient.Dispose();
        }
Ejemplo n.º 20
0
 public void ShouldGiveGuidanceWhenSpecifyingInvalidServerName()
 {
     try
     {
         var rpcClient = new Client(new Uri("http://invalidservername.asiuhd8h38hsh.wam/TradingApi"));
         rpcClient.LogIn("username", "password");
     }
     catch (Exception ex)
     {
         Assert.That(ex.Message, Is.StringContaining("DNS"),"Expecting some info explaining that the server name used cannot be found in DNS");                
     }
 }
Ejemplo n.º 21
0
 public void ShouldGiveGuidanceWhenSpecifyingInvalidServerName()
 {
     try
     {
         var rpcClient = new Client(new Uri("http://invalidservername.asiuhd8h38hsh.wam/TradingApi"),new Uri("http://foo.bar.com"), AppKey);
         rpcClient.LogIn("username", "password");
     }
     catch (Exception ex)
     {
         Assert.That(ex.Message, Is.StringContaining("Invalid response received.  Are you connecting to the correct server Url?"), "Expecting some info explaining that the server Url is invalid");                
     }
 }
        public void Issue35()
        {

            var rpcClient = new Client(Settings.RpcUri);
            rpcClient.LogIn("xx189949", "password");

            var accountInfo = rpcClient.AccountInformation.GetClientAndTradingAccount();
            var resp = rpcClient.TradesAndOrders.ListTradeHistory(accountInfo.ClientAccountId, 20);


            rpcClient.LogOut();
        }
Ejemplo n.º 23
0
        public void TheSameErrorShouldhaveTheSameErrorMessage()
        {
            var rpcClient = new Client(Settings.RpcUri);
            rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);

            var error1 = GetBadRequestErrorMessage(rpcClient);
            var error2 = GetBadRequestErrorMessage(rpcClient);
            var error3 = GetBadRequestErrorMessage(rpcClient);

            Console.WriteLine("Error1:{0}\nError2:{1}\nError3:{2}", error1, error2, error3);
            Assert.That(error1, Is.EqualTo(error2), "errors should be the same");
            Assert.That(error2, Is.EqualTo(error3), "errors should be the same");
        }
Ejemplo n.º 24
0
 public void ShouldGiveGuidanceWhenSpecifyingInvalidServerName()
 {
     try
     {
         var rpcClient = new Client(new Uri("http://invalidservername.asiuhd8h38hsh.wam/TradingApi"), new Uri("http://foo.bar.com"), AppKey);
         rpcClient.LogIn("username", "password");
         Assert.Fail("Expected exception");
     }
     catch (Exception ex)
     {
         Assert.That(ex.Message, Is.StringContaining("Invalid response received.  Are you connecting to the correct server Url?"), "Expecting some info explaining that the server Url is invalid");
     }
 }
        public void Json_Ho_01()
        {

            var rpcClient = new Client(Settings.RpcUri);
            rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);



            GetPriceBarResponseDTO bars = rpcClient.PriceHistory.GetPriceBars("71442", "MINUTE", 1, "15");
            Assert.IsNotNull(bars);

            rpcClient.LogOut();
        }
Ejemplo n.º 26
0
        public void CanGetLookup()
        {

            var rpcClient = new Client(Settings.RpcUri);
            rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);

            const string lookupEntityName = "OrderStatusReason";
            var orderStatus = rpcClient.Messaging.GetSystemLookup(lookupEntityName, 69);

            Assert.IsTrue(orderStatus.ApiLookupDTOList.Length > 0, "no lookup values returned for " + lookupEntityName);

            rpcClient.LogOut();
        }
Ejemplo n.º 27
0
 public void ShouldGiveGuidanceWhenSpecifyingInvalidServerName()
 {
     try
     {
         var rpcClient = new Client(new Uri("http://invalidservername.asiuhd8h38hsh.wam/TradingApi"));
         rpcClient.LogIn("username", "password");
     }
     catch (Exception ex)
     {
         Assert.That(ex, Is.TypeOf(typeof(ServerConnectionException)));
         Assert.That(ex.Message, Is.StringContaining("server Url"),"Expecting some info explaining that the server Url is invalid");                
     }
 }
Ejemplo n.º 28
0
        public void Login()
        {
            MyLogger.OnMessage = AddLogMessage;
            // demonstrates how to inject an external logger
            LogManager.CreateInnerLogger = (logName, logLevel, showLevel, showDateTime, showLogName, dateTimeFormat) =>
            {
                // create external logger implementation and return instance.
                // this will be called whenever CIAPI requires a logger
                return new MyLogger(logName, logLevel, showLevel, showDateTime, showLogName, dateTimeFormat);
            };

            _client = new Client(Const.RPC_URI, Const.STREAMING_URI, "");
            _client.LogIn(Const.USERNAME, Const.PASSWORD);
        }
Ejemplo n.º 29
0
        public void CanGetMarketInformation()
        {

            var rpcClient = new Client(Settings.RpcUri);
            rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);

            for (int i = 0; i < 10; i++)
            {
                var response = rpcClient.Market.GetMarketInformation("71442");
                Assert.IsTrue(response.MarketInformation.MarketId == 71442);
            }

            rpcClient.LogOut();
        }
Ejemplo n.º 30
0
        public void CanResolveMagicNumber()
        {

            var rpcClient = new Client(Settings.RpcUri);
            rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);

            var resolver = new MagicNumberResolver(rpcClient);
            const string lookupEntityName = MagicNumberKeys.ApiOrderResponseDTO_Status;

            string orderStatusReason = resolver.ResolveMagicNumber(lookupEntityName, 1);

            Assert.IsNotNullOrEmpty(orderStatusReason, "could not resolve magic string");

            rpcClient.LogOut();
        }
Ejemplo n.º 31
0
        public void LoginUsingSessionShouldValidateSession()
        {
            var rpcClient = new Client(Settings.RpcUri, Settings.StreamingUri, AppKey);

            rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);

            Assert.That(rpcClient.Session, Is.Not.Null.Or.Empty);

            //This should work
            var rpcClientUsingSession = new Client(Settings.RpcUri, Settings.StreamingUri, AppKey);

            rpcClientUsingSession.LogInUsingSession(Settings.RpcUserName, rpcClient.Session);
                
            Assert.That(rpcClientUsingSession.Session, Is.Not.Null.Or.Empty);

            //After the session has been destroyed, trying to login using it should fail
            rpcClient.LogOut();
     

            try
            {
                rpcClientUsingSession.LogInUsingSession(Settings.RpcUserName, rpcClient.Session);
                Assert.Fail("should throw");
            }
            catch (ReliableHttpException)
            {
                
            }

            try
            {
                rpcClientUsingSession.LogInUsingSession(Settings.RpcUserName, Guid.NewGuid().ToString());
                Assert.Fail("should throw");
            }
            catch (ReliableHttpException)
            {

            }
 
            //And there shouldn't be a session
            Assert.IsNullOrEmpty(rpcClientUsingSession.Session);


            // this client is already logged out. should we swallow unauthorized exceptions in the logout methods?
            // rpcClientUsingSession.LogOut();
            rpcClientUsingSession.Dispose();
            rpcClient.Dispose();
        }
Ejemplo n.º 32
0
        public void LoginUsingSessionShouldValidateSession()
        {
            var rpcClient = new Client(Settings.RpcUri, Settings.StreamingUri, AppKey);

            rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);

            Assert.That(rpcClient.Session, Is.Not.Null.Or.Empty);

            //This should work
            var rpcClientUsingSession = new Client(Settings.RpcUri, Settings.StreamingUri, AppKey);

            rpcClientUsingSession.LogInUsingSession(Settings.RpcUserName, rpcClient.Session);

            Assert.That(rpcClientUsingSession.Session, Is.Not.Null.Or.Empty);

            //After the session has been destroyed, trying to login using it should fail
            rpcClient.LogOut();


            try
            {
                rpcClientUsingSession.LogInUsingSession(Settings.RpcUserName, rpcClient.Session);
                Assert.Fail("should throw");
            }
            catch (ReliableHttpException)
            {
            }

            try
            {
                rpcClientUsingSession.LogInUsingSession(Settings.RpcUserName, Guid.NewGuid().ToString());
                Assert.Fail("should throw");
            }
            catch (ReliableHttpException)
            {
            }

            //And there shouldn't be a session
            Assert.IsNullOrEmpty(rpcClientUsingSession.Session);


            // this client is already logged out. should we swallow unauthorized exceptions in the logout methods?
            // rpcClientUsingSession.LogOut();
            rpcClientUsingSession.Dispose();
            rpcClient.Dispose();
        }
Ejemplo n.º 33
0
        private static void DoPolling()
        {
            var client = new Client(Const.RPC_URI, Const.STREAMING_URI, "Test.{B4E415A7-C453-4867-BDD1-C77ED345777B}");
            try
            {
                client.LogIn(Const.USERNAME, Const.PASSWORD);

                using (var streamingClient = client.CreateStreamingClient())
                {
                    var topics = new[] { 99498, 99500 };
                    using (var pricesListener = streamingClient.BuildPricesListener(topics))
                    {
                        var finished = new ManualResetEvent(false);

                        pricesListener.MessageReceived +=
                            (s, e) =>
                            {
                                finished.Set();
                                Console.WriteLine("{0} -> {1}", e.Data.MarketId, e.Data.Price);
                            };

                        finished.WaitOne(10000);

                        streamingClient.TearDownListener(pricesListener);
                    }
                }

                client.LogOut();
            }
            catch (Exception exc)
            {
                Console.WriteLine(exc);
            }
            finally
            {
                try
                {
                    client.Dispose();
                }
                catch (Exception exc)
                {
                    Console.WriteLine(exc);
                }
            }
        }
        public void TestSubscribeMultiplePrices()
        {
            const string userName = "******";
            const string password = "******";

            var client = new Client(RPC_URI);
            client.LogIn(userName, password);

            var streamingClient = StreamingClientFactory.CreateStreamingClient(
                STREAMING_URI, userName, client.Session);

            streamingClient.Connect();

            var sync = new object();
            var listeners = new List<IStreamingListener<PriceDTO>>();
            try
            {
                var i = 0;
                var options = new ParallelOptions { MaxDegreeOfParallelism = 1 };
                Parallel.ForEach(Const.MarketIds, options,
                    marketId =>
                    {
                        lock (sync)
                        {
                            var listener = streamingClient.BuildPricesListener(new[] { marketId });
                            listeners.Add(listener);
                            listener.MessageReceived += listener_MessageReceived;
                            listener.Start();
                        }
                        Debug.WriteLine("item: {0}", i++);
                    });
                Debug.WriteLine("\r\nAll listeners created ok\r\n");
            }
            finally
            {
                var i = 0;
                foreach (var listener in listeners)
                {
                    listener.Stop();
                    Debug.WriteLine("unsubscribed item: {0}", i++);
                }
                streamingClient.Disconnect();
                client.LogOut();
            }
        }
Ejemplo n.º 35
0
        public void CanResolveDTO()
        {

            var rpcClient = new Client(Settings.RpcUri);
            rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword);
            

            // this would be the value you get back from the API
            GetOpenPositionResponseDTO source = new GetOpenPositionResponseDTO
            {
                OpenPosition = new ApiOpenPositionDTO { Status = 1 }
            };

            rpcClient.MagicNumberResolver.ResolveMagicNumbers(source);

            Assert.AreEqual("Pending", source.OpenPosition.Status_Resolved, "status reason not resolved");

            rpcClient.LogOut();
        }
Ejemplo n.º 36
0
        public void CanSimultaneousSessionsExist()
        {
            var rpcClient1 = new Client(Settings.RpcUri, Settings.StreamingUri, AppKey);

            rpcClient1.LogIn(Settings.RpcUserName, Settings.RpcPassword);

            Assert.That(rpcClient1.Session, Is.Not.Empty);

            var rpcClient2 = new Client(Settings.RpcUri, Settings.StreamingUri, AppKey);

            rpcClient2.LogIn(Settings.RpcUserName, Settings.RpcPassword);

            Assert.That(rpcClient2.Session, Is.Not.Empty);


            var result1 = rpcClient1.AccountInformation.GetClientAndTradingAccount();
            var result2 = rpcClient2.AccountInformation.GetClientAndTradingAccount();

            rpcClient1.LogOut();
            rpcClient1.Dispose();

            rpcClient2.LogOut();
            rpcClient2.Dispose();
        }