private static void StoreNewSymbolsByMinuteData(HttpClient client, string apiKey, string tradeDataPath, List <string> symbols) { foreach (string symbol in symbols) { Log.write($"Updating Market Hours for Symbols {symbol}"); try { string newStockPath = StockHistory.Gather10daysByTheMinute(client, apiKey, symbol, tradeDataPath); Log.write($"{DateTime.Now.ToString()} {symbol} minute history as been added to {newStockPath}"); } catch (Exception ex) { Log.write(ex); } Ultility.delay(250); } }
private static void UpdateTrackedSymbolsMyMinuteData(HttpClient client, string apiKey, string tradeDataPath, List <string> TrackedStockSymbols) { foreach (string symbol in TrackedStockSymbols) { Log.write($"Updating Market Hours for Symbols {symbol}"); string storageFolderPath = StockHistory.getSymbolsPriceHistoryPath(tradeDataPath, symbol, "ByMinute"); List <QuoteFile> priceByMinuteFiles = ReadWriteJSONToDisk.getQuotesFileListFromDirectory(storageFolderPath); DateTime MaxModDate = new DateTime(0); if (priceByMinuteFiles.Count() > 0) { MaxModDate = priceByMinuteFiles.Select(s => s.info.LastWriteTime).Max(); } if (DateTime.Now.AddDays(-1) > MaxModDate) { string newUpdatedFile = StockHistory.UpdateStockByMinuteHistoryFile(client, apiKey, symbol, tradeDataPath, true); Log.write($"Symbol By Minute updated {newUpdatedFile}"); Ultility.delay(250); } } }
public static void Main(string[] args) { //Load up all the setting and operating parameters ConsoleRunningParameters cmdParams = new ConsoleRunningParameters(); Ultility.delay(250); //Get Watch lists var allWatchLists = AIStockTradingBotLogic.Watchlists.GetAllWatchLists(cmdParams.client); //Saving data really only needs to happen once a day cmdParams.SavedAllByMinuteData = RecordingMinuteHistory.updateAllTrackedSymbolsData(cmdParams, allWatchLists); //-----looping section----- "preMarket", "regularMarket", "postMarket", "outsideMarket" //often Call //TODO Check For Trades //TODO Check Currently Trading stocks list Log.write($"EndTime {DateTime.Now.ToString()}"); }