-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathProgram.cs
More file actions
61 lines (57 loc) · 1.75 KB
/
Copy pathProgram.cs
File metadata and controls
61 lines (57 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright (c) 2023 Philippe Matray. All rights reserved.
// This file is part of TaLibStandard.
// TaLibStandard is licensed under the GNU General Public License v3.0.
// See the LICENSE file in the project root for the full license text.
// For more information, visit https://github.com/phmatray/TaLibStandard.
namespace TechnicalAnalysis.Samples.Backtesting;
/// <summary>
/// Entry point of the backtesting sample.
/// </summary>
internal static class Program
{
/// <summary>
/// Parses the command line, runs the sample and prints its report.
/// </summary>
/// <param name="args">The command-line arguments.</param>
/// <returns><c>0</c> on success, <c>1</c> when the command line or the input data was rejected.</returns>
internal static int Main(string[] args)
{
CommandLineOptions options;
try
{
options = CommandLineOptions.Parse(args);
}
catch (FormatException ex)
{
Console.Error.WriteLine(ex.Message);
Console.Error.WriteLine();
Console.Error.WriteLine(CommandLineOptions.Usage);
return 1;
}
if (options.ShowHelp)
{
Console.WriteLine(CommandLineOptions.Usage);
return 0;
}
try
{
Console.WriteLine(BacktestSampleRunner.Run(options));
return 0;
}
catch (FileNotFoundException ex)
{
Console.Error.WriteLine(ex.Message);
return 1;
}
catch (FormatException ex)
{
Console.Error.WriteLine(ex.Message);
return 1;
}
catch (IOException ex)
{
Console.Error.WriteLine(ex.Message);
return 1;
}
}
}