public void DoWork() { var rpcClient = new Client(Settings.RpcUri, Settings.StreamingUri, "bogus_app_key"); var recorder = new Recorder(rpcClient); recorder.Start(); rpcClient.LogIn(Settings.RpcUserName, Settings.RpcPassword); var accounts = rpcClient.AccountInformation.GetClientAndTradingAccount(); var response = rpcClient.CFDMarkets.ListCfdMarkets("USD", null, accounts.ClientAccountId, 500, false); var dto = new ListMarketInformationRequestDTO(); dto.MarketIds = response.Markets.Select(m => m.MarketId).ToArray(); var marketInformation = rpcClient.Market.ListMarketInformation(dto); rpcClient.LogOut(); recorder.Stop(); var json = rpcClient.Serializer.SerializeObject(recorder.GetRequests()); }
/// <summary> /// Get Market Information for the specified list of markets. /// </summary> /// <param name="listMarketInformationRequestDTO">Get Market Information for the specified list of markets.</param> /// <param name="callback"></param> /// <param name="state"></param> public virtual void BeginListMarketInformation(ListMarketInformationRequestDTO listMarketInformationRequestDTO, ReliableAsyncCallback callback, object state) { string uriTemplate = "/information"; _client.BeginRequest(RequestMethod.POST, "market", uriTemplate , new Dictionary<string, object> { { "listMarketInformationRequestDTO", listMarketInformationRequestDTO} },ContentType.JSON,ContentType.JSON, TimeSpan.FromMilliseconds(1000), 30000,0 ,callback, state); }
// *********************************** // ListMarketInformation // *********************************** /// <summary> /// Get Market Information for the specified list of markets. /// </summary> /// <param name="listMarketInformationRequestDTO">Get Market Information for the specified list of markets.</param> public virtual ListMarketInformationResponseDTO ListMarketInformation(ListMarketInformationRequestDTO listMarketInformationRequestDTO) { string uriTemplate = "/information"; return _client.Request<ListMarketInformationResponseDTO>(RequestMethod.POST,"market", uriTemplate , new Dictionary<string, object> { { "listMarketInformationRequestDTO", listMarketInformationRequestDTO} },ContentType.JSON,ContentType.JSON, TimeSpan.FromMilliseconds(1000),30000,0 ); }
/// <summary> /// Get Market Information for the specified list of markets. /// </summary> /// <param name="listMarketInformationRequestDTO">Get Market Information for the specified list of markets.</param> /// <param name="callback"></param> /// <param name="state"></param> public virtual void BeginListMarketInformation(ListMarketInformationRequestDTO listMarketInformationRequestDTO, ApiAsyncCallback<ListMarketInformationResponseDTO> callback, object state) { _client.BeginRequest(callback, state, "market", "/market/information", "POST", new Dictionary<string, object> { { "listMarketInformationRequestDTO", listMarketInformationRequestDTO} }, TimeSpan.FromMilliseconds(1000), "data"); }
// *********************************** // ListMarketInformation // *********************************** /// <summary> /// Get Market Information for the specified list of markets. /// </summary> /// <param name="listMarketInformationRequestDTO">Get Market Information for the specified list of markets.</param> public virtual ListMarketInformationResponseDTO ListMarketInformation(ListMarketInformationRequestDTO listMarketInformationRequestDTO) { return _client.Request<ListMarketInformationResponseDTO>("market", "/market/information", "POST", new Dictionary<string, object> { { "listMarketInformationRequestDTO", listMarketInformationRequestDTO} }, TimeSpan.FromMilliseconds(1000), "data"); }