f3c386663b
* Update projects to use .NET 5.0, the successor to .NET Core
* Fix ambiguous errors. Add IBAutomator net5
* Remove FXCM
* Upgrade IBAutomater to v1.0.51
ignored, and an empty message aborts the commit.
* Fix rebase
- Fix ambiguous Index
- Remove StrategyCapacity.cs
- Update System.Threading.Tasks.Extensionsy
* Remove unrequired references
* Fixes
- Travis will use dotnet, not nunit nor mono
- Remove mono from foundation image
- Fix python setup in research
- Fix unit tests
* Don't call ReadKey when input is redirected
* Fix ConsoleLeanOptimizer
* Research fixes
* Update comment
* Add vsdbg to Dockerfile
* Fixes
- Revert dockerfile FROM custom changes
- Adjust and fix regression algorithms
- Option assignment will be deterministic in the order
- 'Rolling Averaged Population' is calculated using doubles, updating
expected values.
- Update readme, removing references to mono
- Add missing Py.Gil lock
* Replace ICSharp with .NET Interactive
* Fixes after rebase
* CSharp research fixes
- Adding new Initialize.csx that pre loads all assemblies
- Adjusting template research file
- Moving steps in dockerfilejupyter
- Fix unit tests and regression tests after rebase
Co-authored-by: Gerardo Salazar <gsalaz9800@gmail.com>
Co-authored-by: Stefano Raggi <stefano.raggi67@gmail.com>
Co-authored-by: Jasper van Merle <jaspervmerle@gmail.com>
99 lines
3.7 KiB
C#
99 lines
3.7 KiB
C#
/*
|
|
* 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.Collections.Generic;
|
|
using System.IO;
|
|
using Newtonsoft.Json;
|
|
using QuantConnect.Configuration;
|
|
using QuantConnect.Logging;
|
|
using QuantConnect.Packets;
|
|
using QuantConnect.Python;
|
|
|
|
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");
|
|
|
|
// Parse content from source files into result objects
|
|
Log.Trace($"QuantConnect.Report.Main(): Parsing source files...{backtestDataFile}, {liveDataFile}");
|
|
var backtestSettings = new JsonSerializerSettings
|
|
{
|
|
Converters = new List<JsonConverter> { new NullResultValueTypeJsonConverter<BacktestResult>() },
|
|
FloatParseHandling = FloatParseHandling.Decimal
|
|
};
|
|
|
|
var backtest = JsonConvert.DeserializeObject<BacktestResult>(File.ReadAllText(backtestDataFile), backtestSettings);
|
|
LiveResult live = null;
|
|
|
|
if (liveDataFile != string.Empty)
|
|
{
|
|
var settings = new JsonSerializerSettings
|
|
{
|
|
NullValueHandling = NullValueHandling.Ignore,
|
|
Converters = new List<JsonConverter> { new NullResultValueTypeJsonConverter<LiveResult>() }
|
|
};
|
|
|
|
live = JsonConvert.DeserializeObject<LiveResult>(File.ReadAllText(liveDataFile), settings);
|
|
}
|
|
|
|
//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...");
|
|
string html;
|
|
string _;
|
|
|
|
report.Compile(out html, out _);
|
|
|
|
//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.");
|
|
|
|
if (!Console.IsInputRedirected)
|
|
{
|
|
Console.ReadKey();
|
|
}
|
|
}
|
|
}
|
|
}
|