// Refreshes a single fund price public async static Task RefreshCurrentFundPrices(string ticker, string fundId) { // Gets the yahoo finance url, gets its html, and parses through it to get the price var financeUrl = string.Format("https://finance.yahoo.com/quote/{0}/?p={1}", ticker, ticker); string html = GetHtml(financeUrl); double price = GetFundPrice(html); // Need to use something in the format of Ticker-Date also put in time DateTime dateTime = DateTime.Now; string idDateString = dateTime.ToString("yyyy-MM-dd-HH:mm:ss"); var id = ticker + "-" + idDateString; //var random = new Random(); //var id = random.Next().ToString(); var newFundPriceHistory = new FundPriceHistory() { Id = id, FundId = fundId, Ticker = ticker, TickerPrice = price, Time = dateTime }; // Asynchronously inserts the data await FundPriceHistoryDataAccess.InsertData(newFundPriceHistory); }
public static async Task <FundPriceHistory> GetFundPriceHistory(string id) { var fundPriceHistory = await FundPriceHistoryDataAccess.GetFundPriceHistoryById(id); return(fundPriceHistory); }
public static async Task <List <FundPriceHistory> > GetAllFundPriceHistorys() { var fundPriceHistorys = await FundPriceHistoryDataAccess.GetAllFundPriceHistorys(); return(fundPriceHistorys); }
public async static Task DeleteFundPriceHistory(string id) { await FundPriceHistoryDataAccess.DeleteData(id); }
public async static Task UpdateFundPriceHistory(FundPriceHistory fundPriceHistory) { await FundPriceHistoryDataAccess.UpdateData(fundPriceHistory); }
public async static Task InsertFundPriceHistory(FundPriceHistory fundPriceHistory) { await FundPriceHistoryDataAccess.InsertData(fundPriceHistory); }