Ejemplo n.º 1
0
 public void BuildsSymbolsStringFromFile()
 {
     GetDefaults();
     string filepath = _dir + @"SandPRemoved.csv";
     SymbolListBuilder builder = new SymbolListBuilder();
     FileInfo symbolFileInfo = new FileInfo(filepath);
     var result = builder.BuildSymbolsStringFromFile(symbolFileInfo);
     Assert.IsTrue(result.Length > 0);
 }
Ejemplo n.º 2
0
        public void BuildsAListFromFile()
        {
            GetDefaults();
            SymbolListBuilder builder = new SymbolListBuilder();
            FileInfo symbolFileInfo = new FileInfo(_dir + @"\SandP_Companies.csv");
            Dictionary<string, string> symbolDictionary = builder.BuildListFromFile(symbolFileInfo);

            Assert.IsNotNull(symbolDictionary);
            Assert.IsNotNull(symbolFileInfo);
            Assert.IsTrue(symbolDictionary.ContainsKey("MMM"));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Main entry point for the class.  Downloads all data for all symbols in a list
        /// </summary>
        /// <returns>Task - not used</returns>
        public async Task DownloadDataFromListAsync()
        {
            FileInfo symbolFileInfo = new FileInfo(SymbolList);

            if (!symbolFileInfo.Exists)
            {
                throw new FileNotFoundException(symbolFileInfo.FullName);
            }
            // Build a list of symbols from the symbol file
            var symbolList = new SymbolListBuilder().BuildListFromFile(symbolFileInfo);

            // use a dummy symbol to create the object
            _uriBuilder = new DownloadURIBuilder(Exchange, "A");

            await LoopSymbolList(symbolList);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Entry point for downloading data from a list
        /// </summary>
        /// <returns>nothing</returns>
        public async Task DownloadDataFromListAsync()
        {
            FileInfo symbolFileInfo = new FileInfo(SymbolList);
            if (!symbolFileInfo.Exists)
            {
                throw new FileNotFoundException(symbolFileInfo.FullName);
            }
            // Build a list of symbols from the symbol file
            var symbolList = new SymbolListBuilder().BuildListFromFile(symbolFileInfo);

            // use a dummy symbol to create the object
            _uriBuilder = new DownloadURIBuilder(Exchange, "A");
            if (_wClient == null)
            {
                _wClient = new WebClient();
                _wClient.DownloadDataCompleted += wClient_DownloadDataCompleted;
            }
            await LoopSymbolList(symbolList);

        }