Пример #1
0
 /// <remarks/>
 public void retrieveCancelResponseAsync(RetrieveCancelRequest retrieveCancelRequest) {
     this.retrieveCancelResponseAsync(retrieveCancelRequest, null);
 }
Пример #2
0
 /// <remarks/>
 public void retrieveCancelResponseAsync(RetrieveCancelRequest retrieveCancelRequest, object userState) {
     if ((this.retrieveCancelResponseOperationCompleted == null)) {
         this.retrieveCancelResponseOperationCompleted = new System.Threading.SendOrPostCallback(this.OnretrieveCancelResponseOperationCompleted);
     }
     this.InvokeAsync("retrieveCancelResponse", new object[] {
                 retrieveCancelRequest}, this.retrieveCancelResponseOperationCompleted, userState);
 }
Пример #3
0
        public void run(PerSecurityWS ps)
        {

            try
            {
                //Setting headers 
                GetDataHeaders getDataHeaders = new GetDataHeaders();
                getDataHeaders.programflag = ProgramFlag.daily;
                getDataHeaders.secmaster = true;
                getDataHeaders.derived = true;
                //Setting Instrument information
                Instrument bbUniqueId = new Instrument();
                bbUniqueId.id = "EQ0086119600001000";
                bbUniqueId.type = InstrumentType.BB_UNIQUE;
                bbUniqueId.typeSpecified = true;

                Instrument ticker = new Instrument();
                ticker.id = "IBM";
                ticker.yellowkey = MarketSector.Equity;
                ticker.yellowkeySpecified = true;
                ticker.type = InstrumentType.TICKER;
                ticker.typeSpecified = true;
                Instruments instrs1 = new Instruments();
                instrs1.instrument = new Instrument[] { ticker };
                Instruments instrs2 = new Instruments();
                instrs2.instrument = new Instrument[] { bbUniqueId };

                SubmitGetDataRequest sbmtGtDtReq1 = new SubmitGetDataRequest();
                sbmtGtDtReq1.headers = getDataHeaders;
                sbmtGtDtReq1.fields = new string[] { "PX_LAST" };
                sbmtGtDtReq1.instruments = instrs1;

                SubmitGetDataRequest sbmtGtDtReq2 = new SubmitGetDataRequest();
                sbmtGtDtReq2.headers = getDataHeaders;
                sbmtGtDtReq2.fields = new string[] { "PX_LAST" };
                sbmtGtDtReq2.instruments = instrs2;

                SubmitGetDataResponse sbmtGtDtResp1 = ps.submitGetDataRequest(sbmtGtDtReq1);
                SubmitGetDataResponse sbmtGtDtResp2 = ps.submitGetDataRequest(sbmtGtDtReq1);

                Console.WriteLine("Scheduled Req 1 GetData --> " + sbmtGtDtResp1.responseId);
                Console.WriteLine("Scheduled Req 2 GetData --> " + sbmtGtDtResp2.responseId);

                System.Threading.Thread.Sleep(30000);

                SubmitCancelRequest submitCancelRequest = new SubmitCancelRequest();
                Console.WriteLine("Sending submit cancel request");
                CancelHeaders cancelHeaders = new CancelHeaders();
                cancelHeaders.programflag = ProgramFlag.monthly;
                submitCancelRequest.headers = cancelHeaders;
                String[] responseIds = { sbmtGtDtResp1.responseId, sbmtGtDtResp2.responseId, "dummy_id.out" };
                submitCancelRequest.responseId = responseIds;

                SubmitCancelResponse submitCancelResponse = ps.submitCancelRequest(submitCancelRequest);
                Console.WriteLine("Submit cancel request status: " + submitCancelResponse.statusCode.description +
                         " responseId: " + submitCancelResponse.responseId);

                do
                {
                    System.Threading.Thread.Sleep(PerSecurity.POLL_INTERVAL);
                    submitCancelResponse = ps.submitCancelRequest(submitCancelRequest);
                } while (submitCancelResponse.statusCode.code == PerSecurity.DATA_NOT_AVAILABLE);

                RetrieveCancelRequest rreq = new RetrieveCancelRequest();
                rreq.responseId = submitCancelResponse.responseId;
                RetrieveCancelResponse retrieveCancelResponse = ps.retrieveCancelResponse(rreq);
                Console.WriteLine("Sending retrieve cancel request");

                // Keep polling for response till the data is available
                do
                {
                    System.Threading.Thread.Sleep(PerSecurity.POLL_INTERVAL);
                    retrieveCancelResponse = ps.retrieveCancelResponse(rreq);
                } while (retrieveCancelResponse.statusCode.code == PerSecurity.DATA_NOT_AVAILABLE);

                // Display data
                if (retrieveCancelResponse.statusCode.code == PerSecurity.SUCCESS)
                {
                    Console.WriteLine("Retrieve cancel request successful.");
                    CancelResponseStatus[] ls = retrieveCancelResponse.cancelResponseStatus;
                    for (int i = 0; i < ls.Length; i++)
                    {
                        Console.WriteLine("The cancel status for response id :"
                                + ls[i].responseId + " is " + ls[i].cancelStatus.ToString());
                    }
                }
                else if (retrieveCancelResponse.statusCode.code == PerSecurity.REQUEST_ERROR)
                    Console.WriteLine("Error in submitted request");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }