/// <remarks/> public void retrieveGetCompanyResponseAsync(RetrieveGetCompanyRequest retrieveGetCompanyRequest) { this.retrieveGetCompanyResponseAsync(retrieveGetCompanyRequest, null); }
/// <remarks/> public void retrieveGetCompanyResponseAsync(RetrieveGetCompanyRequest retrieveGetCompanyRequest, object userState) { if ((this.retrieveGetCompanyResponseOperationCompleted == null)) { this.retrieveGetCompanyResponseOperationCompleted = new System.Threading.SendOrPostCallback(this.OnretrieveGetCompanyResponseOperationCompleted); } this.InvokeAsync("retrieveGetCompanyResponse", new object[] { retrieveGetCompanyRequest}, this.retrieveGetCompanyResponseOperationCompleted, userState); }
public void run(PerSecurityWS ps) { //Setting request header information GetCompanyHeaders gtCompHdrs = new GetCompanyHeaders(); gtCompHdrs.creditrisk = true; //Setting instruments Instrument ticker = new Instrument(); ticker.id = "AAPL US"; ticker.yellowkey = MarketSector.Equity; ticker.yellowkeySpecified = true; //Setting the get Company request parameter SubmitGetCompanyRequest sbmtGtCompReq = new SubmitGetCompanyRequest(); sbmtGtCompReq.headers = gtCompHdrs; Instruments instrs = new Instruments(); instrs.instrument = new Instrument[] { ticker }; sbmtGtCompReq.instruments = instrs; //Setting fields for the request FieldSet fieldSet = new FieldSet(); fieldSet.fieldmacro = FieldMacro.BO_CREDIT_RISK_COMPANY; sbmtGtCompReq.fieldset = fieldSet; try { Console.WriteLine("Submit Get Company Request"); SubmitGetCompanyResponse sbmtGtCompResp = ps.submitGetCompanyRequest(sbmtGtCompReq); System.Console.WriteLine("status " + sbmtGtCompResp.statusCode.description); System.Console.WriteLine("Submit Get Company request - response ID = " + sbmtGtCompResp.responseId); //retrieve get company request. The response ID sent for the request is the response ID //received from SubmitGetCompanyRequest() Console.WriteLine("Retrieve Company request"); RetrieveGetCompanyRequest rtvGrCompReq = new RetrieveGetCompanyRequest(); rtvGrCompReq.responseId = sbmtGtCompResp.responseId; RetrieveGetCompanyResponse rtrvGtCompResp = new RetrieveGetCompanyResponse(); //Keep sending the request if status is 100 do { System.Threading.Thread.Sleep(PerSecurity.POLL_INTERVAL); rtrvGtCompResp = ps.retrieveGetCompanyResponse(rtvGrCompReq); } while (rtrvGtCompResp.statusCode.code == PerSecurity.DATA_NOT_AVAILABLE); if (rtrvGtCompResp.statusCode.code == PerSecurity.SUCCESS) { //Displaying the rtrvGtCompResp for (int i = 0; i < rtrvGtCompResp.instrumentDatas.Length; i++) { Console.WriteLine("Data for :" + rtrvGtCompResp.instrumentDatas[i].instrument.id + " " + rtrvGtCompResp.instrumentDatas[i].instrument.yellowkey); for (int j = 0; j < rtrvGtCompResp.instrumentDatas[i].data.Length; j++) { if (rtrvGtCompResp.instrumentDatas[i].data[j].isArray == true) { //In case this is a bulk field request for (int k = 0; k < rtrvGtCompResp.instrumentDatas[i].data[j].bulkarray.Length; k++) { Console.WriteLine("-------------------------_"); for (int l = 0; l < rtrvGtCompResp.instrumentDatas[i].data[j]. bulkarray[k].data.Length; l++) Console.WriteLine(rtrvGtCompResp.instrumentDatas[i].data[j].bulkarray[k].data[l].value); } } else Console.WriteLine(" " + rtrvGtCompResp.fields[j] + " : " + rtrvGtCompResp.instrumentDatas[i].data[j].value); } } } else if (rtrvGtCompResp.statusCode.code == PerSecurity.REQUEST_ERROR) Console.WriteLine("Error in the submitted request"); } catch (Exception e) { Console.WriteLine(e.Message); } }