public static MarketMLDataSet GrabData(string newfileLoad) { IMarketLoader loader = new CSVFinal(); loader.GetFile(newfileLoad); var result = new MarketMLDataSet(loader, CONFIG.INPUT_WINDOW, CONFIG.PREDICT_WINDOW); // var desc = new MarketDataDescription(Config.TICKER, // MarketDataType.Close, true, true); var desc = new MarketDataDescription(CONFIG.TICKER, MarketDataType.Close, true, true); result.AddDescription(desc); var end = DateTime.Now; // end today var begin = new DateTime(end.Ticks); // begin 30 days ago begin = begin.AddDays(-950); result.Load(begin, end); result.Generate(); return(result); }
public static MarketMLDataSet GrabData(string newfileLoad) { IMarketLoader loader = new CSVFileLoader();//CSVLoader(); loader.GetFile(newfileLoad); var result = new MarketMLDataSet(loader, Config.INPUT_WINDOW, Config.PREDICT_WINDOW); // var desc = new MarketDataDescription(Config.TICKER, // MarketDataType.Close, true, true); var desc = new MarketDataDescription(Config.TICKER, MarketDataType.Close, TemporalDataDescription.Type.PercentChange, true, true); result.AddDescription(desc); var begin = DateTime.ParseExact("29.05.2005", "dd.MM.yyyy", CultureInfo.CurrentCulture); // begin 30 days ago var end = DateTime.ParseExact("22.07.2005", "dd.MM.yyyy", CultureInfo.CurrentCulture); // begin 30 days ago begin = begin.AddDays(Config.DAYS_OFFSET).AddDays(Config.TEST_OFFSET); end = end.AddDays(Config.DAYS_OFFSET).AddDays(Config.TEST_OFFSET).AddDays(Config.TEST_STRATCH); result.Load(begin, end); result.Generate(); return(result); }
public static void Generate(FileInfo dataDir) { IMarketLoader loader = new YahooFinanceLoader(); var market = new MarketMLDataSet(loader, Config.INPUT_WINDOW, Config.PREDICT_WINDOW); var desc = new MarketDataDescription( Config.TICKER, MarketDataType.AdjustedClose, true, true); market.AddDescription(desc); var end = DateTime.Now; // end today var begin = new DateTime(end.Ticks); // begin 30 days ago // Gather training data for the last 2 years, stopping 60 days short of today. // The 60 days will be used to evaluate prediction. begin = begin.AddDays(-60); end = end.AddDays(-60); begin = begin.AddYears(-2); market.Load(begin, end); market.Generate(); EncogUtility.SaveEGB(FileUtil.CombinePath(dataDir, Config.TRAINING_FILE), market); // create a network BasicNetwork network = EncogUtility.SimpleFeedForward( market.InputSize, Config.HIDDEN1_COUNT, Config.HIDDEN2_COUNT, market.IdealSize, true); // save the network and the training EncogDirectoryPersistence.SaveObject(FileUtil.CombinePath(dataDir, Config.NETWORK_FILE), network); }
public static void Generate(string fileName) { FileInfo dataDir = new FileInfo(@Environment.CurrentDirectory); IMarketLoader loader = new CSVFinal(); var market = new MarketMLDataSet(loader, CONFIG.INPUT_WINDOW, CONFIG.PREDICT_WINDOW); // var desc = new MarketDataDescription(Config.TICKER, MarketDataType.Close, true, true); var desc = new MarketDataDescription(CONFIG.TICKER, MarketDataType.Close, true, true); market.AddDescription(desc); string currentDirectory = @"c:\"; loader.GetFile(fileName); var end = DateTime.Now; // end today var begin = new DateTime(end.Ticks); // begin 30 days ago // Gather training data for the last 2 years, stopping 60 days short of today. // The 60 days will be used to evaluate prediction. begin = begin.AddDays(-600); end = begin.AddDays(200); Console.WriteLine("You are loading date from:" + begin.ToShortDateString() + " To :" + end.ToShortDateString()); market.Load(begin, end); market.Generate(); EncogUtility.SaveEGB(FileUtil.CombinePath(dataDir, CONFIG.SVMTRAINING_FILE), market); // create a network //BasicNetwork network = EncogUtility.SimpleFeedForward( // market.InputSize, // CONFIG.HIDDEN1_COUNT, // CONFIG.HIDDEN2_COUNT, // market.IdealSize, // true); SupportVectorMachine network = new SupportVectorMachine(CONFIG.INPUT_WINDOW, true); TrainNetworks(network, market); // save the network and the training EncogDirectoryPersistence.SaveObject(FileUtil.CombinePath(dataDir, CONFIG.SVMTRAINING_FILE), network); }
public static void Generate(string fileName) { FileInfo dataDir = new FileInfo(@Environment.CurrentDirectory); //Lets use the CSVFinal..(and not the CSV Form loader). IMarketLoader loader = new CSVFinal(); loader.GetFile(fileName); var market = new MarketMLDataSet(loader, Config.INPUT_WINDOW, Config.PREDICT_WINDOW); // var desc = new MarketDataDescription(Config.TICKER, MarketDataType.Close, true, true); var desc = new MarketDataDescription(Config.TICKER, MarketDataType.Close, TemporalDataDescription.Type.PercentChange, true, true); market.AddDescription(desc); loader.GetFile(fileName); var begin = DateTime.ParseExact("01.01.2000", "dd.MM.yyyy", CultureInfo.CurrentCulture); // begin 30 days ago var end = DateTime.ParseExact("22.06.2005", "dd.MM.yyyy", CultureInfo.CurrentCulture); // begin 30 days ago begin = begin.AddDays(Config.DAYS_OFFSET); end = end.AddDays(Config.DAYS_OFFSET); // Gather training data for the last 2 years, stopping 60 days short of today. // The 60 days will be used to evaluate prediction. //begin = begin.AddDays(-200); //end = begin.AddDays(1); Console.WriteLine("You are loading date from:" + begin.ToShortDateString() + " To :" + end.ToShortDateString()); market.Load(begin, end); market.Generate(); EncogUtility.SaveEGB(FileUtil.CombinePath(dataDir, Config.TRAINING_FILE), market); // create a network BasicNetwork network = EncogUtility.SimpleFeedForward( market.InputSize, Config.HIDDEN1_COUNT, Config.HIDDEN2_COUNT, market.IdealSize, true); // save the network and the training EncogDirectoryPersistence.SaveObject(FileUtil.CombinePath(dataDir, Config.NETWORK_FILE), network); }
public static MarketMLDataSet GrabData() { IMarketLoader loader = new YahooFinanceLoader(); var result = new MarketMLDataSet(loader, Config.INPUT_WINDOW, Config.PREDICT_WINDOW); var desc = new MarketDataDescription(Config.TICKER, MarketDataType.AdjustedClose, true, true); result.AddDescription(desc); var end = DateTime.Now; // end today var begin = new DateTime(end.Ticks); // begin 30 days ago begin = begin.AddDays(-60); result.Load(begin, end); result.Generate(); return(result); }