Skip to content

Commit

Permalink
Debug commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredbroad authored and gsalaz98 committed Dec 19, 2019
1 parent d3bcfd5 commit f66a682
Show file tree
Hide file tree
Showing 35 changed files with 3,684 additions and 1 deletion.
1 change: 1 addition & 0 deletions Common/Python/PythonInitializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*
*/

using System;
using Python.Runtime;
using QuantConnect.Logging;

Expand Down
1 change: 1 addition & 0 deletions Configuration/QuantConnect.Configuration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
<Compile Include="ApplicationParser.cs" />
<Compile Include="CommandLineOption.cs" />
<Compile Include="Config.cs" />
<Compile Include="ReportArgumentParser.cs" />
<Compile Include="LeanArgumentParser.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ToolboxArgumentParser.cs" />
Expand Down
36 changes: 36 additions & 0 deletions Configuration/ReportArgumentParser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Collections.Generic;
using Microsoft.Extensions.CommandLineUtils;

namespace QuantConnect.Configuration
{
/// <summary>
/// Command Line arguments parser for Report Creator
/// </summary>
public static class ReportArgumentParser
{
private const string ApplicationName = "Report Creator";

private const string ApplicationDescription =
"LEAN Report Creator generates beautiful PDF reports from your backtesting strategies for sharing with prospective partners.";

private const string ApplicationHelpText =
"If you are looking for help, please go to https://www.quantconnect.com/docs";

private static readonly List<CommandLineOption> Options = new List<CommandLineOption>
{
new CommandLineOption("strategy-name", CommandOptionType.SingleValue, "Strategy name"),
new CommandLineOption("strategy-description", CommandOptionType.SingleValue, "Strategy description"),
new CommandLineOption("live-data-source-file", CommandOptionType.SingleValue, "Live source data json file"),
new CommandLineOption("backtest-data-source-file", CommandOptionType.SingleValue, "Backtest source data json file"),
new CommandLineOption("report-destination", CommandOptionType.SingleValue, "Destination of processed report file")
};

/// <summary>
/// Parse and construct the args.
/// </summary>
public static Dictionary<string, object> ParseArguments(string[] args)
{
return ApplicationParser.Parse(ApplicationName, ApplicationDescription, ApplicationHelpText, args, Options);
}
}
}
15 changes: 14 additions & 1 deletion QuantConnect.Lean.sln
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuantConnect.Algorithm.Pyth
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuantConnect.ToolBox", "ToolBox\QuantConnect.ToolBox.csproj", "{AC9A142C-B485-44D7-91FF-015C22C43D05}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuantConnect.VisualStudioPlugin", "VisualStudioPlugin\QuantConnect.VisualStudio17Plugin.csproj", "{5326A9FB-0270-4647-8C43-20C5607DB529}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuantConnect.VisualStudio17Plugin", "VisualStudioPlugin\QuantConnect.VisualStudio17Plugin.csproj", "{5326A9FB-0270-4647-8C43-20C5607DB529}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuantConnect.Jupyter", "Jupyter\QuantConnect.Jupyter.csproj", "{9561D14A-467E-40AD-928E-EE9F758D7D98}"
EndProject
Expand All @@ -56,6 +56,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuantConnect.Algorithm.Fram
EndProject
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "QuantConnect.PythonToolbox", "PythonToolbox\QuantConnect.PythonToolbox.pyproj", "{1C47F4DB-2AFF-4FAE-9142-B33BE654A516}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QuantConnect.Report", "Report\QuantConnect.Report.csproj", "{2431419F-8BC6-4F59-944E-9A1CD28982DF}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -208,8 +210,19 @@ Global
{1C47F4DB-2AFF-4FAE-9142-B33BE654A516}.Debug|x64.ActiveCfg = Debug|Any CPU
{1C47F4DB-2AFF-4FAE-9142-B33BE654A516}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1C47F4DB-2AFF-4FAE-9142-B33BE654A516}.Release|x64.ActiveCfg = Release|Any CPU
{2431419F-8BC6-4F59-944E-9A1CD28982DF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2431419F-8BC6-4F59-944E-9A1CD28982DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2431419F-8BC6-4F59-944E-9A1CD28982DF}.Debug|x64.ActiveCfg = Debug|Any CPU
{2431419F-8BC6-4F59-944E-9A1CD28982DF}.Debug|x64.Build.0 = Debug|Any CPU
{2431419F-8BC6-4F59-944E-9A1CD28982DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2431419F-8BC6-4F59-944E-9A1CD28982DF}.Release|Any CPU.Build.0 = Release|Any CPU
{2431419F-8BC6-4F59-944E-9A1CD28982DF}.Release|x64.ActiveCfg = Release|Any CPU
{2431419F-8BC6-4F59-944E-9A1CD28982DF}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {67BACDB0-1FDB-4AF0-A199-88CF436FB470}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions QuantConnect.Lean.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp60</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_INVOCATION_PARS/@EntryValue">INSIDE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSORHOLDER_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_INVOCATION_LPAR/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ARGUMENTS_STYLE/@EntryValue">CHOP_IF_LONG</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_INVOCATION_RPAR/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpRenamePlacementToArrangementMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EAddAccessorOwnerDeclarationBracesMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002ECSharpPlaceAttributeOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateThisQualifierSettings/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Quant/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=QUANTCONNECT/@EntryIndexedValue">True</s:Boolean>
</wpf:ResourceDictionary>
6 changes: 6 additions & 0 deletions Report/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2"/>
</startup>
</configuration>
82 changes: 82 additions & 0 deletions Report/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
/*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.IO;
using Newtonsoft.Json;
using QuantConnect.Configuration;
using QuantConnect.Logging;
using QuantConnect.Orders;
using QuantConnect.Packets;

namespace QuantConnect.Report
{
/// <summary>
/// Lean Report creates a PDF strategy summary from the backtest and live json objects.
/// </summary>
class Program
{
static void Main(string[] args)
{
// Parse report arguments and merge with config to use in report creator:
if (args.Length > 0)
{
Config.MergeCommandLineArgumentsWithConfiguration(ReportArgumentParser.ParseArguments(args));
}
var name = Config.Get("strategy-name");
var description = Config.Get("strategy-description");
var version = Config.Get("strategy-version");
var backtestDataFile = Config.Get("backtest-data-source-file");
var liveDataFile = Config.Get("live-data-source-file");
var destination = Config.Get("report-destination");

//Set the Order Parser For JSON:
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
{
Converters = { new OrderJsonConverter() }
};

// Parse content from source files into result objects
Log.Trace($"QuantConnect.Report.Main(): Parsing source files...{backtestDataFile}, {liveDataFile}");
var backtest = JsonConvert.DeserializeObject<BacktestResult>(File.ReadAllText(backtestDataFile));

LiveResult live = null;
if (liveDataFile != string.Empty)
{
live = JsonConvert.DeserializeObject<LiveResult>(File.ReadAllText(liveDataFile));
}

//Create a new report
Log.Trace("QuantConnect.Report.Main(): Instantiating report...");
var report = new Report(name, description, version, backtest, live);

// Generate the html content
Log.Trace("QuantConnect.Report.Main(): Starting content compile...");
var html = report.Compile();

//Write it to target destination.
if (destination != string.Empty)
{
Log.Trace($"QuantConnect.Report.Main(): Writing content to file {destination}");
File.WriteAllText(destination, html);
}
else
{
Console.Write(html);
}
Log.Trace("QuantConnect.Report.Main(): Completed.");
Console.ReadKey();
}
}
}
36 changes: 36 additions & 0 deletions Report/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("QuantConnect.Report")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("QuantConnect.Report")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("2431419f-8bc6-4f59-944e-9a1cd28982df")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Loading

0 comments on commit f66a682

Please sign in to comment.