public void SortsJjSymbols() { FileCopier fc = new FileCopier(); fc.SymbolsFromFile(); var s = fc.Symbols; Assert.IsTrue(s.Count > 0); Assert.IsTrue(s.Contains("ABEV")); }
public void TestFileCopier() { FileCopier fc = new FileCopier(); Assert.IsTrue(fc.CopyFiles() > 0); }
/// <summary> /// Entry point into the console app /// </summary> private static void Main(string[] args) { try { //foreach (String s2 in Environment.GetEnvironmentVariables().Keys) // Console.WriteLine(s2 + "=" + Environment.GetEnvironmentVariable(s2).ToString()); Arguments commandLine = new Arguments(args); if (args[0] == "-r") RenameInteriorFiles(); else { GetHelp(commandLine); // Defalult to minute unless the user specifies eod var resolution = GetResolution(commandLine); var runmode = GetRunmode(commandLine); var destinationDirectory = GetDestinationDirectory(commandLine); var defaultInputFile = GetDefaultInputFile(commandLine); DisplayInteractiveInstructions(runmode); GetOptionsInteractive(runmode, ref defaultInputFile, ref destinationDirectory, ref resolution); if (runmode == Enums.Runmode.Automatic) { Console.WriteLine("1. Source file for ticker symbol and exchange list: \n" + defaultInputFile); Console.WriteLine("2. Destination LEAN Data directory: \n" + destinationDirectory); Console.WriteLine("3. Both minute and eod will run. "); } //Validate the user input: Validate(defaultInputFile, destinationDirectory, resolution.ToString()); //Remove the final slash to make the path building easier: defaultInputFile = StripFinalSlash(defaultInputFile); destinationDirectory = StripFinalSlash(destinationDirectory); string[] validatedArgs = new string[3]; validatedArgs[0] = defaultInputFile; validatedArgs[1] = destinationDirectory; validatedArgs[2] = resolution.ToString(); Console.WriteLine("Processing Files ..."); if (runmode == Enums.Runmode.Automatic) { validatedArgs[2] = "minute"; Task.Run(async () => { await MainAsync(validatedArgs); }).Wait(); validatedArgs[2] = "eod"; Task.Run(async () => { await MainAsync(validatedArgs); }).Wait(); FileCopier fc = new FileCopier(); int filescopied = fc.CopyFiles(); string message = string.Format(@"JJ,\nI updated the Dropbox minute and daily data. \nThe process completed at {0}\n{1} Files were copied.\n\nNick\n\nThis message was auto generated by the MarketData program. Do not reply to the sending address.", DateTime.Now.ToLongDateString(), filescopied); Notifications n = new Notifications(); n.CustomEmail("*****@*****.**", "Dropbox files have been updated", message); } else { Task.Run(async () => { await MainAsync(validatedArgs); }).Wait(); } } // if auto, just run the thing and exit //if (runmode == Enums.Runmode.Automatic) //{ //} } catch (Exception ex) { Console.WriteLine(ex.Message + ex.StackTrace); string message = string.Format(@"{0} There was a problem processing GoogleFinance. \n\n{1}", DateTime.Now.ToLongDateString(), ex.Message + "\n" + ex.StackTrace); Notifications n = new Notifications(); n.CustomEmail("*****@*****.**", "error processing Google Finance download", message); } finally { Console.WriteLine("Done. Press any key to exit."); Console.ReadKey(); } }
/// <summary> /// Entry point into the console app /// </summary> private static void Main(string[] args) { try { //foreach (String s2 in Environment.GetEnvironmentVariables().Keys) // Console.WriteLine(s2 + "=" + Environment.GetEnvironmentVariable(s2).ToString()); Arguments commandLine = new Arguments(args); if (args[0] == "-r") { RenameInteriorFiles(); } else { GetHelp(commandLine); // Defalult to minute unless the user specifies eod var resolution = GetResolution(commandLine); var runmode = GetRunmode(commandLine); var destinationDirectory = GetDestinationDirectory(commandLine); var defaultInputFile = GetDefaultInputFile(commandLine); DisplayInteractiveInstructions(runmode); GetOptionsInteractive(runmode, ref defaultInputFile, ref destinationDirectory, ref resolution); if (runmode == Enums.Runmode.Automatic) { Console.WriteLine("1. Source file for ticker symbol and exchange list: \n" + defaultInputFile); Console.WriteLine("2. Destination LEAN Data directory: \n" + destinationDirectory); Console.WriteLine("3. Both minute and eod will run. "); } //Validate the user input: Validate(defaultInputFile, destinationDirectory, resolution.ToString()); //Remove the final slash to make the path building easier: defaultInputFile = StripFinalSlash(defaultInputFile); destinationDirectory = StripFinalSlash(destinationDirectory); string[] validatedArgs = new string[3]; validatedArgs[0] = defaultInputFile; validatedArgs[1] = destinationDirectory; validatedArgs[2] = resolution.ToString(); Console.WriteLine("Processing Files ..."); if (runmode == Enums.Runmode.Automatic) { validatedArgs[2] = "minute"; Task.Run(async() => { await MainAsync(validatedArgs); }).Wait(); validatedArgs[2] = "eod"; Task.Run(async() => { await MainAsync(validatedArgs); }).Wait(); FileCopier fc = new FileCopier(); int filescopied = fc.CopyFiles(); string message = string.Format(@"JJ,\nI updated the Dropbox minute and daily data. \nThe process completed at {0}\n{1} Files were copied.\n\nNick\n\nThis message was auto generated by the MarketData program. Do not reply to the sending address.", DateTime.Now.ToLongDateString(), filescopied); Notifications n = new Notifications(); n.CustomEmail("*****@*****.**", "Dropbox files have been updated", message); } else { Task.Run(async() => { await MainAsync(validatedArgs); }).Wait(); } } // if auto, just run the thing and exit //if (runmode == Enums.Runmode.Automatic) //{ //} } catch (Exception ex) { Console.WriteLine(ex.Message + ex.StackTrace); string message = string.Format(@"{0} There was a problem processing GoogleFinance. \n\n{1}", DateTime.Now.ToLongDateString(), ex.Message + "\n" + ex.StackTrace); Notifications n = new Notifications(); n.CustomEmail("*****@*****.**", "error processing Google Finance download", message); } finally { Console.WriteLine("Done. Press any key to exit."); Console.ReadKey(); } }
private void CopyFiles() { Cursor currentCursor = Cursor.Current; currentCursor = Cursors.WaitCursor; richTextBoxData.Text += @"Copying Files ..."; richTextBoxData.Text += "\n"; this.Refresh(); FileCopier fc = new FileCopier(); int filescopied = fc.CopyFiles(); Cursor.Current = currentCursor; richTextBoxData.Text += @"Files Copied ..."; }