Files
quantconnect--lean/Algorithm.CSharp/MappedBenchmarkRegressionAlgorithm.cs
T
Alexandre Catarino 6546647e08
Regression Tests / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Get Best Effort Price For Fill Price (#5855)
`EquityFillModel` will use Trade Tick or TradeBar data if there is no L1 data available leading to filling to stale price.
2021-08-12 10:16:20 -03:00

111 lines
4.5 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 QuantConnect.Data;
using QuantConnect.Interfaces;
using System.Collections.Generic;
namespace QuantConnect.Algorithm.CSharp
{
/// <summary>
/// Regression algorithm using a benchmark security which should be mapped from SPWR to SPWRA during the backtest
/// </summary>
public class MappedBenchmarkRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
{
/// <summary>
/// Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.
/// </summary>
public override void Initialize()
{
SetStartDate(2008, 08, 20);
SetEndDate(2008, 10, 1);
SetBenchmark("SPWR");
AddEquity("SPY", Resolution.Hour);
}
/// <summary>
/// OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
/// </summary>
/// <param name="data">Slice object keyed by symbol containing the stock data</param>
public override void OnData(Slice data)
{
if (!Portfolio.Invested)
{
SetHoldings("SPY", 1);
}
}
/// <summary>
/// This is used by the regression test system to indicate if the open source Lean repository has the required data to run this algorithm.
/// </summary>
public bool CanRunLocally { get; } = true;
/// <summary>
/// This is used by the regression test system to indicate which languages this algorithm is written in.
/// </summary>
public Language[] Languages { get; } = { Language.CSharp };
/// <summary>
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
/// </summary>
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
{
{"Total Trades", "1"},
{"Average Win", "0%"},
{"Average Loss", "0%"},
{"Compounding Annual Return", "-50.371%"},
{"Drawdown", "12.700%"},
{"Expectancy", "0"},
{"Net Profit", "-7.863%"},
{"Sharpe Ratio", "-1.25"},
{"Probabilistic Sharpe Ratio", "17.179%"},
{"Loss Rate", "0%"},
{"Win Rate", "0%"},
{"Profit-Loss Ratio", "0"},
{"Alpha", "-0.357"},
{"Beta", "0.262"},
{"Annual Standard Deviation", "0.404"},
{"Annual Variance", "0.163"},
{"Information Ratio", "0.07"},
{"Tracking Error", "0.873"},
{"Treynor Ratio", "-1.927"},
{"Total Fees", "$5.10"},
{"Estimated Strategy Capacity", "$180000000.00"},
{"Lowest Capacity Asset", "SPY R735QTJ8XC9X"},
{"Fitness Score", "0.003"},
{"Kelly Criterion Estimate", "0"},
{"Kelly Criterion Probability Value", "0"},
{"Sortino Ratio", "-3.681"},
{"Return Over Maximum Drawdown", "-4.174"},
{"Portfolio Turnover", "0.034"},
{"Total Insights Generated", "0"},
{"Total Insights Closed", "0"},
{"Total Insights Analysis Completed", "0"},
{"Long Insight Count", "0"},
{"Short Insight Count", "0"},
{"Long/Short Ratio", "100%"},
{"Estimated Monthly Alpha Value", "$0"},
{"Total Accumulated Estimated Alpha Value", "$0"},
{"Mean Population Estimated Insight Value", "$0"},
{"Mean Population Direction", "0%"},
{"Mean Population Magnitude", "0%"},
{"Rolling Averaged Population Direction", "0%"},
{"Rolling Averaged Population Magnitude", "0%"},
{"OrderListHash", "d5466a4f274a65313a1f58c78d3cfd00"}
};
}
}