public void GetNewsDetailAsync(int storyId, Action<NewsDetailDTO> onSuccess, Action<Exception> onError) { var client = new Client(RPC_URI); client.BeginLogIn(USERNAME, PASSWORD, ar => { try { client.EndLogIn(ar); client.BeginGetNewsDetail(storyId.ToString(), ar2 => { try { var resp = client.EndGetNewsDetail(ar2); _client.BeginLogOut(ar3 => _client.EndLogOut(ar3), null); onSuccess(resp.NewsDetail); } catch (Exception exc) { onError(exc); } }, null); } catch (Exception exc) { onError(exc); } }, null); }
public void SetupFixture() { _rpcClient = BuildRpcClient(); _streamingClient = _rpcClient.CreateStreamingClient(); _CFDmarketId = GetAvailableCFDMarkets(_rpcClient)[0].MarketId; _accounts = _rpcClient.AccountInformation.GetClientAndTradingAccount(); }
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; }
static void Main(string[] args) { try { var curProcess = Process.GetCurrentProcess(); var secondsOnStart = curProcess.TotalProcessorTime.TotalSeconds; var totalWatch = Stopwatch.StartNew(); for (int i = 0; i < 20; i++) { var client = new Client(Const.RPC_URI, Const.STREAMING_URI, ""); var recorder = new Recorder(client); recorder.Start(); var loginWatch = Stopwatch.StartNew(); client.LogIn(Const.USERNAME, Const.PASSWORD); loginWatch.Stop(); var accountInfoWatch = Stopwatch.StartNew(); var accountInfo = client.AccountInformation.GetClientAndTradingAccount(); accountInfoWatch.Stop(); var listSpreadMarketsWatch = Stopwatch.StartNew(); var resp = client.SpreadMarkets.ListSpreadMarkets("", "", accountInfo.ClientAccountId, 100, false); listSpreadMarketsWatch.Stop(); var logoutWatch = Stopwatch.StartNew(); client.LogOut(); logoutWatch.Stop(); var purgeHandle = client.ShutDown(); if (!purgeHandle.WaitOne(60000)) throw new ApplicationException(); var requests = recorder.GetRequests(); if (requests.Count != 4) throw new ApplicationException(); AddResult(loginWatch, requests[0], "Login"); AddResult(accountInfoWatch, requests[1], "GetClientAndTradingAccount"); AddResult(listSpreadMarketsWatch, requests[2], "ListSpreadMarkets"); AddResult(logoutWatch, requests[3], "Logout"); recorder.Stop(); recorder.Dispose(); client.Dispose(); } totalWatch.Stop(); var secondsOnEnd = curProcess.TotalProcessorTime.TotalSeconds; Console.WriteLine("CPU time used, seconds: {0} total time: {1}", secondsOnEnd - secondsOnStart, totalWatch.Elapsed.TotalSeconds); } catch (Exception exc) { Console.WriteLine(exc); } Debugger.Break(); }
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 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(); }
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); } }
public Client(Uri rpcUri, Uri streamingUri, string appKey,IJsonSerializer serializer, IRequestFactory factory) : base(serializer, factory) { #if SILVERLIGHT #if WINDOWS_PHONE UserAgent = "CIAPI.PHONE7."+ GetVersionNumber(); #else UserAgent = "CIAPI.SILVERLIGHT."+ GetVersionNumber(); #endif #else UserAgent = "CIAPI.CS." + GetVersionNumber(); #endif AppKey=appKey; _client=this; _rootUri = rpcUri; _streamingUri = streamingUri; this. Authentication = new _Authentication(this); this. PriceHistory = new _PriceHistory(this); this. News = new _News(this); this. CFDMarkets = new _CFDMarkets(this); this. SpreadMarkets = new _SpreadMarkets(this); this. Market = new _Market(this); this. Preference = new _Preference(this); this. TradesAndOrders = new _TradesAndOrders(this); this. AccountInformation = new _AccountInformation(this); this. Messaging = new _Messaging(this); this. Watchlist = new _Watchlist(this); this. ClientApplication = new _ClientApplication(this); this. ExceptionHandling = new _ExceptionHandling(this); Log.Debug("Rpc.Client created for " + _rootUri.AbsoluteUri); }
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(); } }
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"); }
public Client(Uri rpcUri, Uri streamingUri, string appKey, int backgroundInterval) : base(new Serializer(),backgroundInterval) { #if SILVERLIGHT #if WINDOWS_PHONE UserAgent = "CIAPI.PHONE7."+ GetVersionNumber(); #else UserAgent = "CIAPI.SILVERLIGHT."+ GetVersionNumber(); #endif #else UserAgent = "CIAPI.CS." + GetVersionNumber(); #endif _streamingFactory=new LightStreamerStreamingClientFactory(); AppKey=appKey; _client=this; _rootUri = rpcUri; _streamingUri = streamingUri; this. Authentication = new _Authentication(this); this. PriceHistory = new _PriceHistory(this); this. News = new _News(this); this. CFDMarkets = new _CFDMarkets(this); this. SpreadMarkets = new _SpreadMarkets(this); this. Market = new _Market(this); this. Preference = new _Preference(this); this. TradesAndOrders = new _TradesAndOrders(this); this. AccountInformation = new _AccountInformation(this); this. Messaging = new _Messaging(this); this. Watchlist = new _Watchlist(this); this. ClientApplication = new _ClientApplication(this); Log.Debug("Rpc.Client created for " + _rootUri.AbsoluteUri); }
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 IStreamingClient BuildStreamingClient() { var authenticatedClient = new CIAPI.Rpc.Client(Settings.RpcUri, Settings.StreamingUri, AppKey); authenticatedClient.LogIn(Settings.RpcUserName, Settings.RpcPassword); return(authenticatedClient.CreateStreamingClient()); }
protected Client BuildUnauthenticatedRpcClient() { // 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); return rpcClient; }
private void AutoLogin() { if (_ctx == null) { _ctx = new CIAPI.Rpc.Client(RPC_URI); _ctx.LogIn(USERNAME, PASSWORD); } }
private static int GetTradingAccountId(Client client, int marketId, AccountInformationResponseDTO accountInfo) { GetMarketInformationResponseDTO marketInfo = client.Market.GetMarketInformation(marketId.ToString()); bool isCfd = marketInfo.MarketInformation.Name.EndsWith("CFD"); ApiTradingAccountDTO tradingAccount = isCfd ? accountInfo.TradingAccounts[0] : accountInfo.TradingAccounts[1]; return tradingAccount.TradingAccountId; }
/// <summary> /// /// </summary> /// <param name="client"></param> /// <param name="appmetricsUri"></param> /// <param name="metricsSession"></param> /// <param name="metricsAccessKey"></param> public MetricsRecorder(Client client, Uri appmetricsUri, string metricsSession, string metricsAccessKey = null) : base(client) { _metricsSession = metricsSession; _metricsAccessKey = metricsAccessKey; AppmetricsUri = appmetricsUri; _metricsTimer = new Timer(ignored => PostMetrics(), null, 1000, 10000); }
public override void FixtureSetup() { base.FixtureSetup(); // hmmmm... only one fixture setup allowed. _rpcClient = BuildRpcClient(); _streamingClient = _rpcClient.CreateStreamingClient(); _CFDmarketId = MarketFixture.GetAvailableCFDMarkets(_rpcClient)[0].MarketId; _accounts = _rpcClient.AccountInformation.GetClientAndTradingAccount(); }
private CIAPI.Rpc.Client BuildAuthenticatedClientAndSetupResponse(string expectedJson) { CIAPI.Rpc.Client ctx = BuildClientAndSetupResponse(expectedJson); ctx.UserName = TestConfig.ApiUsername; ctx.Session = TestConfig.ApiTestSessionId; return(ctx); }
public MainPage() { InitializeComponent(); Dispatcher.BeginInvoke(() => { StartButton.IsEnabled = false; StopButton.IsEnabled = false; }); // build an rpc client and log it in. rpcClient = new Client(new Uri(RpcServerHost)); // get a session from the rpc client rpcClient.BeginLogIn(UserName, Password, ar => { rpcClient.EndLogIn(ar); Debug.WriteLine("creating client"); // build a streaming client. _streamingClient = StreamingClientFactory.CreateStreamingClient(new Uri(PushServerHost), UserName, rpcClient.Session); Debug.WriteLine("connecting client"); // note: due to internal changes the 'connect' method // name is a misnomer: no actual network activity is occuring, // only the building of the necessary client connections for // each of the published data adapters. Actual connection is // performed on demand for each adapter. This minimizes startup time. // the upside to this is that there is no need to run .Connect in a separate thread. Debug.WriteLine("client connected"); // from this point there should be no need to stop, disconnect or dispose of the // client instance. But if you choose to disconnect a StreamingClient, it should // be disposed and reinstantiated. it is a one use object at this point as this is // the only usage pattern presented in the sample code. Dispatcher.BeginInvoke(() => { listBox1.Items.Add("logged in"); StartButton.IsEnabled = true; StopButton.IsEnabled = false; }); }, null); }
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(); }
private CIAPI.Rpc.Client BuildClientAndSetupResponse(string expectedJson) { TestRequestFactory factory = new TestRequestFactory(); var requestController = new RequestController(TimeSpan.FromSeconds(0), 2, factory, new ErrorResponseDTOJsonExceptionFactory(), new ThrottledRequestQueue(TimeSpan.FromSeconds(5), 30, 10, "data"), new ThrottledRequestQueue(TimeSpan.FromSeconds(3), 1, 3, "trading")); var ctx = new CIAPI.Rpc.Client(new Uri(TestConfig.RpcUrl), "mockApiKey", requestController); factory.CreateTestRequest(expectedJson); return(ctx); }
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(); }
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; }
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(); }
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(); }
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(); }
private void button2_Click(object sender, EventArgs e) { _rpcClient = new Client(new Uri(RpcUriTextBox.Text)); RpcClient.LogIn(UserNameTextBox.Text, PasswordTextBox.Text); _streamingClient = StreamingClientFactory.CreateStreamingClient(new Uri(StreamingUriTextBox.Text), UserNameTextBox.Text, RpcClient.Session); _streamingClient.Connect(); DialogResult = DialogResult.OK; }
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(); }
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(); }
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"); } }
private void button1_Click(object sender, EventArgs e) { if (_streamingClient != null) { try { _listener.Stop(); _streamingClient.Disconnect(); } catch { // swallow } _listener = null; _streamingClient = null; } if (_rpcClient != null) { try { _rpcClient.LogOut(); } catch { // swallow } _streamingClient = null; } var settingsForm = new Settings(); settingsForm.ShowDialog(); if (settingsForm.StreamingClient == null) { return; MessageBox.Show("Not connected"); } _streamingClient = settingsForm.StreamingClient; _listener = _streamingClient.BuildPricesListener(int.Parse(MarketIdTextBox.Text)); _listener.MessageReceived += new EventHandler<MessageEventArgs<PriceDTO>>(ListenerMessageReceived); _listener.Start(); _rpcClient = settingsForm.RpcClient; _logic = new TradingRobot.Logic.SimpleBuyLowSellHigh(_rpcClient); _logic.BidPrice = SellNUD.Value; _logic.OfferPrice = BuyNUD.Value; _logic.Quantity = QuantityNUD.Value; MessageBox.Show("Connected"); }
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"); } }
private string GetBadRequestErrorMessage(Client rpcClient) { var errorMessage = "No error thrown"; try { const int moreThanMaxHeadlines = 1000; rpcClient.News.ListNewsHeadlinesWithSource(source: "dj", category: "UK", maxResults: moreThanMaxHeadlines); } catch (ReliableHttpException ex) { errorMessage = "Message: " + ex.Message; } return(errorMessage); }
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(); }
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(); }