public async Task<GetTimeAndSalesResponse> GetTimeAndSales(GetTimeAndSalesRequest request) { var command = new GetTimeAndSalesCommand(request.Symbol, Gateway.AccesToken); command.Interval = request.Interval; command.SessionFilter = request.SessionFilter; command.StartDateTime = request.StartDateTime; command.EndDateTime = request.EndDateTime; //Send command to API await MakeApiCall(command); //Some handling of the response var response = new GetTimeAndSalesResponse(command.RawResponse, command.MessageFormat); return response; }
private async void btnGo_Click(object sender, EventArgs e) { if (!ValidateInput()) return; string responseText = ""; string interval = ""; string sessionFilter = ""; DateTime? dtEnd = null; DateTime? dtStart = null; if (cmbInterval.SelectedItem != null) interval = cmbInterval.SelectedItem.ToString().ToLower(); if (cmbSession.SelectedItem != null) { if (cmbSession.SelectedItem.ToString() == "Include Pre/After Market") sessionFilter = "all"; else sessionFilter = "open"; } if (dateTimeEnd.Value.CompareTo(SqlDateTime.MinValue.Value) > 0) dtEnd = dateTimeEnd.Value; if (dateTimeStart.Value.CompareTo(SqlDateTime.MinValue.Value) > 0) dtStart = dateTimeStart.Value; if (ApiCall.CompareTo("Market/Get Historical Pricing") == 0) { var request = new GetHistoricalPricingRequest(txtSymbol.Text); request.Interval = interval; request.StartDateTime = dtStart; request.EndDateTime = dtEnd; var response = await ApiGateway.MarketData.GetHistoricalPricing(request); responseText = response.RawResponse.Content; } else if (ApiCall.CompareTo("Market/Get Time And Sales") == 0) { var request = new GetTimeAndSalesRequest(txtSymbol.Text); request.Interval = interval; request.SessionFilter = sessionFilter; request.StartDateTime = dtStart; request.EndDateTime = dtEnd; var response = await ApiGateway.MarketData.GetTimeAndSales(request); responseText = response.RawResponse.Content; } txtResponse.Text = responseText; }