示例#1
0
        private void Run(string[] args)
        {
            var commandLineOptions = new CommandLineOptions();
            if (!CommandLine.Parser.Default.ParseArguments(args, commandLineOptions))
            {
                return;
            }

            Initialize(commandLineOptions);

            var sessionOptions = GetSessionOptions();

            Logger.InfoFormat("Connecting to [{0}]:[{1}]", _host, _port);
            var session = new Session(sessionOptions);
            bool sessionStarted = session.Start();
            if (!sessionStarted)
            {
                Logger.Error("Failed to start session.");
                return;
            }
            if (!session.OpenService("//blp/refdata"))
            {
                Logger.Error("Failed to open //blp/refdata");
                return;
            }

            try
            {
                SendRefDataRequest(session);
            }
            catch (InvalidRequestException e)
            {
                Logger.WarnFormat("Exception occurred: [{0}]", e);
            }

            // wait for events from session.
            EventLoop(session);

            session.Stop();
        }
示例#2
0
        private void Initialize(CommandLineOptions commandLineOptions)
        {
            //TODO: check last parser state

            _host = commandLineOptions.Host;
            _port = commandLineOptions.Port;
            _dateId = commandLineOptions.DateId ?? DateTime.Now.PreviousDateId();

            // add fields
            _fields.AddRange(getFields());

            // add tickers
            _securities.AddRange(GetTickers().ToList());

            //TODO: is this needed
            registerCallback(3);
        }