Пример #1
0
 /// <remarks/>
 public void submitGetCompanyRequestAsync(SubmitGetCompanyRequest submitGetCompanyRequest1) {
     this.submitGetCompanyRequestAsync(submitGetCompanyRequest1, null);
 }
Пример #2
0
 /// <remarks/>
 public void submitGetCompanyRequestAsync(SubmitGetCompanyRequest submitGetCompanyRequest1, object userState) {
     if ((this.submitGetCompanyRequestOperationCompleted == null)) {
         this.submitGetCompanyRequestOperationCompleted = new System.Threading.SendOrPostCallback(this.OnsubmitGetCompanyRequestOperationCompleted);
     }
     this.InvokeAsync("submitGetCompanyRequest", new object[] {
                 submitGetCompanyRequest1}, this.submitGetCompanyRequestOperationCompleted, userState);
 }
Пример #3
0
        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);
            }
        }