public void Add(string symbol) { Trends stock = new Trends(symbol); TrendsUniverseContents.Add(stock); SortSymbol(); }
public virtual void Add(Trends stock) { TrendsUniverseContents.Add(stock); SortSymbol(); }
public async static Task<decimal> PriceBySymbolAsync(string symbol, DateTime date) { if (symbol == "ZZZCASH") return 1; Trends stock = new Trends(symbol); decimal price = await stock.SingleGetPriceAsync(date); return price; }
public static TrendUniverse OpenTrendsUniverse(string openLocation) { string extension = Path.GetExtension(openLocation); TrendUniverse temp = new TrendUniverse(); if (extension == ".pfo") { using (System.IO.StreamReader sr = new StreamReader(openLocation)) { String line; while ((line = sr.ReadLine()) != null) { Trends stock = new Trends(line); temp.Add(stock); } return temp; } } else if (extension == ".csv") { using (System.IO.StreamReader sr = new StreamReader(openLocation)) { string unparsedCSV = sr.ReadToEnd(); string[] parsedCSV = unparsedCSV.Replace("\n", " ").Replace(" ", ",").Split(','); foreach (string parsedCSVstockMember in parsedCSV) { string tempString = parsedCSVstockMember; tempString = parsedCSVstockMember.Replace("\r", ""); if (parsedCSVstockMember != "") { Trends stock = new Trends(parsedCSVstockMember); temp.Add(tempString); } } return temp; } } else { throw new FileLoadException("Only accepts file types of *.pfo or *.csv"); } }
// For retreiving a single stock price public static decimal PriceBySymbol(string symbol, DateTime date) { if (symbol == "ZZZCASH") return 1; Trends stock = new Trends(symbol); return stock.SingleGetPrice(date); }