public static LookupClient CreateNew(string host   = IQFeedDefault.Hostname, int port = IQFeedDefault.LookupPort,
                                             int timeoutMs = LookupDefault.TimeoutMs, int numberOfClients = 1, int bufferSize = LookupDefault.BufferSize)
        {
            // Common
            var requestFormatter    = new RequestFormatter();
            var lookupDispatcher    = new LookupDispatcher(host, port, bufferSize, IQFeedDefault.ProtocolVersion, numberOfClients, requestFormatter);
            var errorMessageHandler = new ErrorMessageHandler();
            var rawMessageHandler   = new RawMessageHandler(lookupDispatcher, errorMessageHandler, timeoutMs);

            // Historical
            var historicalDataRequestFormatter = new HistoricalRequestFormatter();
            var historicalRawFace = new HistoricalRawFacade(historicalDataRequestFormatter, rawMessageHandler);
            var historicalFacade  = new HistoricalFacade(
                historicalDataRequestFormatter,
                lookupDispatcher,
                errorMessageHandler,
                new HistoricalMessageHandler(),
                historicalRawFace,
                timeoutMs
                );

            // News
            var newsFacade = new NewsFacade();

            // Symbol
            var symbolFacade = new SymbolFacade(new MarketSymbolDownloader(), new MarketSymbolReader(), new ExpiredOptionDownloader(), new ExpiredOptionReader());

            // Chains
            var chainsFacade = new ChainsFacade(new ChainsRequestFormatter(), new ChainsMessageHandler(), lookupDispatcher, errorMessageHandler, timeoutMs);

            return(new LookupClient(lookupDispatcher, historicalFacade, newsFacade, symbolFacade, chainsFacade));
        }
 public LookupClient(LookupDispatcher lookupDispatcher, HistoricalFacade historical, NewsFacade news, SymbolFacade symbol, ChainsFacade chains)
 {
     _lookupDispatcher = lookupDispatcher;
     Historical        = historical;
     News   = news;
     Symbol = symbol;
     Chains = chains;
 }
Example #3
0
        public void SetUp()
        {
            var lookupClient = LookupClientFactory.CreateNew();

            lookupClient.Connect();

            _historicalFacade = lookupClient.Historical;
        }
        public static LookupClient CreateNew(
            string host,
            int port,
            int numberOfClients,
            TimeSpan timeout,
            int bufferSize)
        {
            // Common
            var requestFormatter         = new RequestFormatter();
            var lookupDispatcher         = new LookupDispatcher(host, port, bufferSize, IQFeedDefault.ProtocolVersion, numberOfClients, requestFormatter);
            var exceptionFactory         = new ExceptionFactory();
            var lookupMessageFileHandler = new LookupMessageFileHandler(lookupDispatcher, exceptionFactory, timeout);
            var historicalMessageHandler = new HistoricalMessageHandler();

            // Historical
            var historicalDataRequestFormatter = new HistoricalRequestFormatter();
            var historicalFileFacade           = new HistoricalFileFacade(historicalDataRequestFormatter, lookupMessageFileHandler);
            var historicalFacade = new HistoricalFacade(
                historicalDataRequestFormatter,
                lookupDispatcher,
                exceptionFactory,
                historicalMessageHandler,
                historicalFileFacade,
                timeout
                );

            // News
            var newsFacade = new NewsFacade(
                new NewsRequestFormatter(),
                lookupDispatcher,
                exceptionFactory,
                new NewsMessageHandler(),
                timeout);

            // Symbol
            var symbolFacade = new SymbolFacade(
                new SymbolRequestFormatter(),
                lookupDispatcher,
                exceptionFactory,
                new SymbolMessageHandler(),
                new MarketSymbolDownloader(),
                new MarketSymbolReader(),
                new ExpiredOptionDownloader(),
                new ExpiredOptionReader(),
                timeout);

            // Chains
            var chainsFacade = new ChainsFacade(new ChainsRequestFormatter(), new ChainsMessageHandler(), lookupDispatcher, exceptionFactory, timeout);

            return(new LookupClient(lookupDispatcher, historicalFacade, newsFacade, symbolFacade, chainsFacade));
        }
 public LookupClient(
     LookupDispatcher lookupDispatcher,
     HistoricalFacade historical,
     NewsFacade news,
     SymbolFacade symbol,
     ChainsFacade chains,
     MarketSummaryFacade marketSummary)
 {
     _lookupDispatcher = lookupDispatcher;
     Historical        = historical;
     News          = news;
     Symbol        = symbol;
     Chains        = chains;
     MarketSummary = marketSummary;
 }