public async Task <StockData> DownloadStockData(Api.Interval interval) { string filePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\DataMAN\\Financial data\\Stocks\\" + _stockSymbol + "\\" + interval.ToString() + "\\" + _stockSymbol + ".json"; await Api.GetDataToFile(_stockSymbol, interval, Api.Outputsize.full, filePath); StockData stockData = LoadStockDataFromFile(interval); return(stockData); }
public StockData LoadStockDataFromFile(Api.Interval interval) { StockData stockData = new StockData(); if (StockSymbol.Length > 0) { string filePath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\DataMAN\\Financial data\\Stocks\\" + _stockSymbol + "\\" + interval.ToString() + "\\" + _stockSymbol + ".json"; if (File.Exists(filePath)) { stockData = JsonConverter.ConvertJsonFromFile(filePath); } } return(stockData); }