当前位置: 首页>>代码示例>>C#>>正文


C# Session.SendRequest方法代码示例

本文整理汇总了C#中Session.SendRequest方法的典型用法代码示例。如果您正苦于以下问题:C# Session.SendRequest方法的具体用法?C# Session.SendRequest怎么用?C# Session.SendRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Session的用法示例。


在下文中一共展示了Session.SendRequest方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test

        public void Test()
        {
            string serverHost = "localhost";
            int serverPort = 8194;

            SessionOptions sessionOptions = new SessionOptions();
            sessionOptions.ServerHost = serverHost;
            sessionOptions.ServerPort = serverPort;

            Debug.WriteLine("Connecting to " + serverHost + ":" + serverPort);
            Session session = new Session(sessionOptions);
            bool sessionStarted = session.Start();
            if (!sessionStarted)
            {
                System.Console.Error.WriteLine("Failed to start session.");
                return;
            }
            if (!session.OpenService("//blp/refdata"))
            {
                System.Console.Error.WriteLine("Failed to open //blp/refdata");
                return;
            }
            Service refDataService = session.GetService("//blp/refdata");
            Request request = refDataService.CreateRequest("IntradayBarRequest");
            request.Set("security", "IBM US Equity");
            request.Set("eventType", "TRADE");
            request.Set("interval", 60);	// bar interval in minutes
            DateTime tradedOn = getPreviousTradingDate();
            request.Set("startDateTime", new Datetime(tradedOn.Year,
                                                      tradedOn.Month,
                                                      tradedOn.Day,
                                                      13, 30, 0, 0));
            request.Set("endDateTime", new Datetime(tradedOn.Year,
                                                    tradedOn.Month,
                                                    tradedOn.Day,
                                                    21, 30, 0, 0));
            Debug.WriteLine("Sending Request: " + request);
            session.SendRequest(request, null);

            while (true)
            {
                Event eventObj = session.NextEvent();
                foreach (Message msg in eventObj.GetMessages())
                {
                    Debug.WriteLine(msg.ToString());
                }
                if (eventObj.Type == Event.EventType.RESPONSE)
                {
                    break;
                }
            }
        }
开发者ID:azmikamis,项目名称:bloombergdotnet,代码行数:52,代码来源:MainWindowViewModel.cs

示例2: SendIntradayBarRequest

        private void SendIntradayBarRequest(Session session, RealTimeDataRequest req)
        {
            session.OpenService("//blp/refdata");
            Service refDataService = session.GetService("//blp/refdata");
            Request request = refDataService.CreateRequest("IntradayBarRequest");

            // only one security/eventType per request
            request.Set("security", req.Instrument.DatasourceSymbol);
            request.Set("eventType", "TRADE");
            request.Set("interval", req.Frequency.ToTimeSpan().TotalSeconds);

            DateTime prevTradedDate = DateTime.Now.AddDays(-1); //todo fix
            var startDateTime = string.Format("{0}-{1}-{2}T13:30:00", prevTradedDate.Year, prevTradedDate.Month, prevTradedDate.Day);
            prevTradedDate = prevTradedDate.AddDays(1); // next day for end date
            var endDateTime = string.Format("{0}-{1}-{2}T13:30:00", prevTradedDate.Year, prevTradedDate.Month, prevTradedDate.Day);

            request.Set("startDateTime", startDateTime);
            request.Set("endDateTime", endDateTime);


            request.Set("gapFillInitialBar", true);

            session.SendRequest(request, null);
        }
开发者ID:leo90skk,项目名称:qdms,代码行数:24,代码来源:Bloomberg.cs

示例3: SendRefDataRequest

        private void SendRefDataRequest(Session session)
        {
            var request = CreateRequest(session);

            Logger.Info("Sending Request: " + request);
            session.SendRequest(request, null);
        }
开发者ID:jbontik,项目名称:bloomberg_downloader,代码行数:7,代码来源:Program.cs

示例4: SendIntradayTickRequest

        private void SendIntradayTickRequest(Session session)
        {
            Service refDataService = session.GetService("//blp/refdata");
            Request request = refDataService.CreateRequest("IntradayTickRequest");

            request.Set("security", _dSecurity);

            // Add fields to request
            var eventTypes = request.GetElement("eventTypes");
            foreach (object t in _dEvents)
            {
                eventTypes.AppendValue((string)t);
            }

            // All times are in GMT
            request.Set("startDateTime", _dStartDateTime);
            request.Set("endDateTime", _dEndDateTime);

            if (_dConditionCodes)
            {
                request.Set("includeConditionCodes", true);
            }

            Console.WriteLine(@"Sending Request: " + request);
            session.SendRequest(request, null);
        }
开发者ID:rlyalko,项目名称:REVERSALS_v14,代码行数:26,代码来源:IntradayTick.cs

示例5: ProcessEvents

        public void ProcessEvents(Session s, Request req)
        {
            s.SendRequest(req, new CorrelationID(1));

            bool continueToLoop = true;
            while (continueToLoop)
            {
                Event eventObj = s.NextEvent();
                switch (eventObj.Type)
                {
                    case Event.EventType.RESPONSE: // final response
                        continueToLoop = false;
                        HandleResponseEvent(eventObj);
                        break;
                    case Event.EventType.PARTIAL_RESPONSE:
                        HandleResponseEvent(eventObj);
                        break;
                    default:
                        //if (Debug)
                        HandleOtherEvent(eventObj);
                        break;
                }
            }
        }
开发者ID:Rab815,项目名称:BBWebApi,代码行数:24,代码来源:RequestProcessor.cs

示例6: Submit

        public result Submit(string ISIN)
        {
            result FOSresult = new result();
            //open excel to get two parameter

            SessionOptions sessionOptions = new SessionOptions();
            sessionOptions.ServerHost = "WSG053";
            sessionOptions.ServerPort = 0x2002;
            Session session = new Session(sessionOptions);
            if (!session.Start())
            {
                Console.WriteLine("Could not start session.");
                Environment.Exit(1);
            }
            if (!session.OpenService("//blp/refdata"))
            {
                Console.WriteLine("Could not open service //blp/refdata");
                Environment.Exit(1);
            }
            CorrelationID requestID = new CorrelationID(1L);
            Request request = session.GetService("//blp/refdata").CreateRequest("ReferenceDataRequest");
            request.GetElement("securities").AppendValue(ISIN + " corp");
            Element fields = request.GetElement("fields");
            fields.AppendValue("SECURITY_DES");
            fields.AppendValue("CRNCY");
            fields.AppendValue("ISSUER");
            fields.AppendValue("COUNTRY_FULL_NAME");
            fields.AppendValue("MARKET_SECTOR_DES");
            fields.AppendValue("INDUSTRY_SECTOR");
            fields.AppendValue("PX_BID");
            fields.AppendValue("COUPON");
            fields.AppendValue("YLD_YTM_BID");
            fields.AppendValue("DUR_BID");
            fields.AppendValue("RTG_SP");
            fields.AppendValue("RTG_SP_LT_LC_ISSUER_CREDIT");
            fields.AppendValue("RTG_MOODY");
            fields.AppendValue("RTG_MOODY_LONG_TERM");
            fields.AppendValue("RTG_MDY_LC_CURR_ISSUER_RATING");
            fields.AppendValue("RTG_FITCH");
            fields.AppendValue("RTG_FITCH_LT_ISSUER_DEFAULT");
            fields.AppendValue("COLLAT_TYP");
            fields.AppendValue("MTY_YEARS_TDY");
            fields.AppendValue("NXT_CALL_DT");
            fields.AppendValue("MATURITY");
            fields.AppendValue("GUARANTOR");
            Console.WriteLine("Sending Request:" + request);
            session.SendRequest(request, null);
            while (true)
            {
                Event eventObj = session.NextEvent();
                this.processEvent(eventObj, session);
                if (eventObj.Type == Event.EventType.RESPONSE)
                {
                    IssueRating = RTG_SP + "/" + this.GetMoody(RTG_MOODY, RTG_MOODY_LONG_TERM) + "/" + RTG_FITCH;
                    IssuerRating = RTG_SP_LT_LC_ISSUER_CREDIT + "/" + RTG_MDY_LC_CURR_ISSUER_RATING + "/" + RTG_FITCH_LT_ISSUER_DEFAULT;
                    if (CallDate != "NA")
                    {
                        DateTime newdate = DateTime.Parse(CallDate);
                        DateTime nowdate = DateTime.Now;
                        decimal dCallDate = (decimal)(((TimeSpan)(newdate - nowdate)).Days) / 365;
                        CallDate = StandardFormat(Math.Round(dCallDate, 2).ToString(), 2);
                    }

                    FOSresult.CallDate = CallDate;
                    FOSresult.COLLATERAL_TYPE = COLLATERAL_TYPE;
                    FOSresult.COUNTRY_FULL_NAME = COUNTRY_FULL_NAME;
                    FOSresult.COUPON = COUPON;
                    FOSresult.CRNCY = CRNCY;
                    FOSresult.DUR_BID = DUR_BID;
                    FOSresult.INDUSTRY_SECTOR = INDUSTRY_SECTOR.ToUpper();
                    FOSresult.PX_BID = PX_BID;
                    FOSresult.YLD_YTM_BID = YLD_YTM_BID;
                    FOSresult.SECURITY_DES = SECURITY_DES;
                    FOSresult.IssueRating = IssueRating;
                    FOSresult.IssuerRating = IssuerRating;
                    FOSresult.MARKET_SECTOR_DES = MARKET_SECTOR_DES;
                    FOSresult.YearToMaturity = Maturity;
                    FOSresult.ISSUER = ISSUER;

                    GetInfoFromExcel(FOSresult);
                    //undoImpersonation();
                    return FOSresult;
                    //return base.Json(new { SECURITY_DES = SECURITY_DES, CRNCY = CRNCY, ISSUER = ISSUER, COUNTRY_FULL_NAME = COUNTRY_FULL_NAME, MARKET_SECTOR_DES = MARKET_SECTOR_DES, INDUSTRY_SECTOR = INDUSTRY_SECTOR.ToUpper(), PX_BID = PX_BID, COUPON = COUPON, YLD_YTM_BID = YLD_YTM_BID, DUR_BID = DUR_BID, IssueRating = IssueRating, IssuerRating = IssuerRating, COLLATERAL_TYPE = COLLATERAL_TYPE, YearToMaturity = Maturity, CallDate = CallDate });
                }
            }
        }
开发者ID:kyoliumiao,项目名称:PTCWebService,代码行数:86,代码来源:Submit.asmx.cs


注:本文中的Session.SendRequest方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。