Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6351773a01 | ||
|
|
bf4b08e202 | ||
|
|
fa9ff399cc | ||
|
|
16c4259342 | ||
|
|
724d0b06a5 | ||
|
|
ba7fe05574 | ||
|
|
50437946e2 | ||
|
|
418970bb48 | ||
|
|
bef045a360 | ||
|
|
49bf436aa2 | ||
|
|
e29bb2c5e0 | ||
|
|
8fcc9f7d4e | ||
|
|
5209332074 | ||
|
|
adfad475cc | ||
|
|
21fcadf0f8 | ||
|
|
e893e67e9b | ||
|
|
3b588d04fb | ||
|
|
e81bcbb987 | ||
|
|
96e91b446d | ||
|
|
403f0348bd | ||
|
|
eeeb310438 | ||
|
|
271f0bb08e | ||
|
|
3a09c70851 | ||
|
|
f31251732e | ||
|
|
9baacdbdd6 | ||
|
|
363d469d6a | ||
|
|
c186addf94 | ||
|
|
17049dcd56 | ||
|
|
d88387ac67 | ||
|
|
74c3501ed3 | ||
|
|
a543af71dc | ||
|
|
9b332c2149 | ||
|
|
1e620e54fe |
@@ -40,8 +40,8 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
|
||||
var aapl = QuantConnect.Symbol.Create("AAPL", SecurityType.Equity, Market.USA);
|
||||
|
||||
_contract = OptionChainProvider.GetOptionContractList(aapl, Time)
|
||||
.OrderBy(symbol => symbol.ID.Symbol)
|
||||
_contract = OptionChain(aapl)
|
||||
.OrderBy(x => x.ID.Symbol)
|
||||
.FirstOrDefault(optionContract => optionContract.ID.OptionRight == OptionRight.Call
|
||||
&& optionContract.ID.OptionStyle == OptionStyle.American);
|
||||
AddOptionContract(_contract);
|
||||
@@ -90,7 +90,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -39,8 +39,8 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
|
||||
var aapl = AddEquity("AAPL").Symbol;
|
||||
|
||||
_contract = OptionChainProvider.GetOptionContractList(aapl, Time)
|
||||
.OrderBy(symbol => symbol.ID.Symbol)
|
||||
_contract = OptionChain(aapl)
|
||||
.OrderBy(x => x.ID.Symbol)
|
||||
.FirstOrDefault(optionContract => optionContract.ID.OptionRight == OptionRight.Call
|
||||
&& optionContract.ID.OptionStyle == OptionStyle.American);
|
||||
}
|
||||
@@ -87,7 +87,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{
|
||||
foreach (var contract in futuresContracts)
|
||||
{
|
||||
var option_contract_symbols = OptionChainProvider.GetOptionContractList(contract.Symbol, Time).ToList();
|
||||
var option_contract_symbols = OptionChain(contract.Symbol).ToList();
|
||||
if(option_contract_symbols.Count == 0)
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -55,10 +55,10 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{
|
||||
_optionFilterRan = true;
|
||||
|
||||
var expiry = new HashSet<DateTime>(optionContracts.Select(x => x.Underlying.ID.Date)).SingleOrDefault();
|
||||
// Cast to IEnumerable<Symbol> because OptionFilterContract overrides some LINQ operators like `Select` and `Where`
|
||||
var expiry = new HashSet<DateTime>(optionContracts.Select(x => x.Symbol.Underlying.ID.Date)).SingleOrDefault();
|
||||
// Cast to List<Symbol> because OptionFilterContract overrides some LINQ operators like `Select` and `Where`
|
||||
// and cause it to mutate the underlying Symbol collection when using those operators.
|
||||
var symbol = new HashSet<Symbol>(((IEnumerable<Symbol>)optionContracts).Select(x => x.Underlying)).SingleOrDefault();
|
||||
var symbol = new HashSet<Symbol>(((List<Symbol>)optionContracts).Select(x => x.Underlying)).SingleOrDefault();
|
||||
|
||||
if (expiry == null || symbol == null)
|
||||
{
|
||||
|
||||
@@ -46,8 +46,8 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{
|
||||
if (_option == null)
|
||||
{
|
||||
var option = OptionChainProvider.GetOptionContractList(_twx, Time)
|
||||
.OrderBy(symbol => symbol.ID.Symbol)
|
||||
var option = OptionChain(_twx)
|
||||
.OrderBy(x => x.ID.Symbol)
|
||||
.FirstOrDefault(optionContract => optionContract.ID.Date == _expiration
|
||||
&& optionContract.ID.OptionRight == OptionRight.Call
|
||||
&& optionContract.ID.OptionStyle == OptionStyle.American);
|
||||
@@ -122,7 +122,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using QuantConnect.Data;
|
||||
using QuantConnect.Data.UniverseSelection;
|
||||
using QuantConnect.Interfaces;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace QuantConnect.Algorithm.CSharp
|
||||
{
|
||||
@@ -110,14 +110,14 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
|
||||
foreach (var addedSecurity in changes.AddedSecurities)
|
||||
{
|
||||
var option = OptionChainProvider.GetOptionContractList(addedSecurity.Symbol, Time)
|
||||
.OrderBy(symbol => symbol.ID.Symbol)
|
||||
var option = OptionChain(addedSecurity.Symbol)
|
||||
.OrderBy(contractData => contractData.ID.Symbol)
|
||||
.First(optionContract => optionContract.ID.Date == _expiration
|
||||
&& optionContract.ID.OptionRight == OptionRight.Call
|
||||
&& optionContract.ID.OptionStyle == OptionStyle.American);
|
||||
AddOptionContract(option);
|
||||
|
||||
foreach (var symbol in new[] { option, option.Underlying })
|
||||
foreach (var symbol in new[] { option.Symbol, option.Underlying.Symbol })
|
||||
{
|
||||
var config = SubscriptionManager.SubscriptionDataConfigService.GetSubscriptionDataConfigs(symbol).ToList();
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 2;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -43,8 +43,8 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
|
||||
var aapl = QuantConnect.Symbol.Create("AAPL", SecurityType.Equity, Market.USA);
|
||||
|
||||
_contract = OptionChainProvider.GetOptionContractList(aapl, Time)
|
||||
.OrderBy(symbol => symbol.ID.StrikePrice)
|
||||
_contract = OptionChain(aapl)
|
||||
.OrderBy(x => x.ID.StrikePrice)
|
||||
.FirstOrDefault(optionContract => optionContract.ID.OptionRight == OptionRight.Call
|
||||
&& optionContract.ID.OptionStyle == OptionStyle.American);
|
||||
AddOptionContract(_contract);
|
||||
@@ -121,7 +121,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using QuantConnect.Data.UniverseSelection;
|
||||
@@ -59,19 +58,9 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
var changeOptions = changes.AddedSecurities.Concat(changes.RemovedSecurities)
|
||||
.Where(s => s.Type == SecurityType.Option);
|
||||
|
||||
// Susbtract one minute to get the actual market open. If market open is at 9:30am, this will be invoked at 9:31am
|
||||
var expectedTime = Time.TimeOfDay - TimeSpan.FromMinutes(1);
|
||||
var allOptionsWereChangedOnMarketOpen = changeOptions.All(s =>
|
||||
if (Time != Time.Date)
|
||||
{
|
||||
var firstMarketSegment = s.Exchange.Hours.MarketHours[Time.DayOfWeek].Segments
|
||||
.First(segment => segment.State == MarketHoursState.Market);
|
||||
|
||||
return firstMarketSegment.Start == expectedTime;
|
||||
});
|
||||
|
||||
if (!allOptionsWereChangedOnMarketOpen)
|
||||
{
|
||||
throw new RegressionTestException("Expected options filter to be run only on market open");
|
||||
throw new RegressionTestException($"Expected options filter to be run only at midnight. Actual was {Time}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +77,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all time slices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 5952220;
|
||||
public long DataPoints => 470217;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -35,14 +35,15 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
private readonly HashSet<Symbol> _expectedData = new HashSet<Symbol>();
|
||||
private readonly HashSet<Symbol> _expectedUniverses = new HashSet<Symbol>();
|
||||
private bool _expectUniverseSubscription;
|
||||
private DateTime _universeSubscriptionTime;
|
||||
|
||||
// order of expected contract additions as price moves
|
||||
private int _expectedContractIndex;
|
||||
private readonly List<Symbol> _expectedContracts = new List<Symbol>
|
||||
{
|
||||
SymbolRepresentation.ParseOptionTickerOSI("GOOG 151224P00747500"),
|
||||
SymbolRepresentation.ParseOptionTickerOSI("GOOG 151224P00750000"),
|
||||
SymbolRepresentation.ParseOptionTickerOSI("GOOG 151224P00752500")
|
||||
SymbolRepresentation.ParseOptionTickerOSI("GOOG 151224P00752500"),
|
||||
SymbolRepresentation.ParseOptionTickerOSI("GOOG 151224P00755000")
|
||||
};
|
||||
|
||||
public override void Initialize()
|
||||
@@ -68,7 +69,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
Log($"SubscriptionManager.Subscriptions: {string.Join(" -- ", SubscriptionManager.Subscriptions)}");
|
||||
throw new RegressionTestException($"Unexpected {OptionChainSymbol} subscription presence");
|
||||
}
|
||||
if (!slice.ContainsKey(Underlying))
|
||||
if (Time != _universeSubscriptionTime && !slice.ContainsKey(Underlying))
|
||||
{
|
||||
// TODO : In fact, we're unable to properly detect whether or not we auto-added or it was manually added
|
||||
// this is because when we auto-add the underlying we don't mark it as an internal security like we do with other auto adds
|
||||
@@ -91,7 +92,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
var actual = string.Join(Environment.NewLine, UniverseManager.Keys.OrderBy(s => s.ToString()));
|
||||
throw new RegressionTestException($"{Time}:: Detected differences in expected and actual universes{Environment.NewLine}Expected:{Environment.NewLine}{expected}{Environment.NewLine}Actual:{Environment.NewLine}{actual}");
|
||||
}
|
||||
if (_expectedData.AreDifferent(slice.Keys.ToHashSet()))
|
||||
if (Time != _universeSubscriptionTime && _expectedData.AreDifferent(slice.Keys.ToHashSet()))
|
||||
{
|
||||
var expected = string.Join(Environment.NewLine, _expectedData.OrderBy(s => s.ToString()));
|
||||
var actual = string.Join(Environment.NewLine, slice.Keys.OrderBy(s => s.ToString()));
|
||||
@@ -99,7 +100,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
}
|
||||
|
||||
// 10AM add GOOG option chain
|
||||
if (Time.TimeOfDay.Hours == 10 && Time.TimeOfDay.Minutes == 0)
|
||||
if (Time.TimeOfDay.Hours == 10 && Time.TimeOfDay.Minutes == 0 && !_expectUniverseSubscription)
|
||||
{
|
||||
if (Securities.ContainsKey(OptionChainSymbol))
|
||||
{
|
||||
@@ -110,9 +111,9 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
googOptionChain.SetFilter(u =>
|
||||
{
|
||||
// we added the universe at 10, the universe selection data should not be from before
|
||||
if (u.Underlying.EndTime.Hour < 10)
|
||||
if (u.LocalTime.Hour < 10)
|
||||
{
|
||||
throw new RegressionTestException($"Unexpected underlying data point {u.Underlying.EndTime} {u.Underlying}");
|
||||
throw new RegressionTestException($"Unexpected selection time {u.LocalTime}");
|
||||
}
|
||||
// find first put above market price
|
||||
return u.IncludeWeeklys()
|
||||
@@ -124,6 +125,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
_expectedSecurities.Add(OptionChainSymbol);
|
||||
_expectedUniverses.Add(OptionChainSymbol);
|
||||
_expectUniverseSubscription = true;
|
||||
_universeSubscriptionTime = Time;
|
||||
}
|
||||
|
||||
// 11:30AM remove GOOG option chain
|
||||
@@ -151,7 +153,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
var expectedContract = _expectedContracts[_expectedContractIndex];
|
||||
if (added.Symbol != expectedContract)
|
||||
{
|
||||
throw new RegressionTestException($"Expected option contract {expectedContract} to be added but received {added.Symbol}");
|
||||
throw new RegressionTestException($"Expected option contract {expectedContract.Value} to be added but received {added.Symbol}");
|
||||
}
|
||||
|
||||
_expectedContractIndex++;
|
||||
@@ -186,7 +188,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
|
||||
if (Securities.ContainsKey(Underlying))
|
||||
{
|
||||
Console.WriteLine($"{Time:o}:: PRICE:: {Securities[Underlying].Price} CHANGES:: {changes}");
|
||||
Log($"{Time:o}:: PRICE:: {Securities[Underlying].Price} CHANGES:: {changes}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +205,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 200807;
|
||||
public long DataPoints => 3502;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -227,7 +229,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Drawdown", "0%"},
|
||||
{"Expectancy", "0"},
|
||||
{"Start Equity", "100000"},
|
||||
{"End Equity", "99079"},
|
||||
{"End Equity", "98784"},
|
||||
{"Net Profit", "0%"},
|
||||
{"Sharpe Ratio", "0"},
|
||||
{"Sortino Ratio", "0"},
|
||||
@@ -243,10 +245,10 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Tracking Error", "0"},
|
||||
{"Treynor Ratio", "0"},
|
||||
{"Total Fees", "$6.00"},
|
||||
{"Estimated Strategy Capacity", "$3000.00"},
|
||||
{"Lowest Capacity Asset", "GOOCV 305RBR0BSWIX2|GOOCV VP83T1ZUHROL"},
|
||||
{"Portfolio Turnover", "1.49%"},
|
||||
{"OrderListHash", "bd115ec8bb7734b1561d6a6cc6c00039"}
|
||||
{"Estimated Strategy Capacity", "$4000.00"},
|
||||
{"Lowest Capacity Asset", "GOOCV 305RBQ2BZBZT2|GOOCV VP83T1ZUHROL"},
|
||||
{"Portfolio Turnover", "2.58%"},
|
||||
{"OrderListHash", "09f766c470a8bcf4bb6862da52bf25a7"}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,8 +41,8 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
|
||||
var aapl = QuantConnect.Symbol.Create("AAPL", SecurityType.Equity, Market.USA);
|
||||
|
||||
var contracts = OptionChainProvider.GetOptionContractList(aapl, Time)
|
||||
.OrderBy(symbol => symbol.ID.StrikePrice)
|
||||
var contracts = OptionChain(aapl)
|
||||
.OrderBy(x => x.ID.StrikePrice)
|
||||
.Where(optionContract => optionContract.ID.OptionRight == OptionRight.Call
|
||||
&& optionContract.ID.OptionStyle == OptionStyle.American)
|
||||
.Take(2)
|
||||
@@ -106,7 +106,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -296,7 +296,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 1267414;
|
||||
public long DataPoints => 27071;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -316,7 +316,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Total Orders", "3"},
|
||||
{"Average Win", "0%"},
|
||||
{"Average Loss", "-0.40%"},
|
||||
{"Compounding Annual Return", "-22.717%"},
|
||||
{"Compounding Annual Return", "-21.378%"},
|
||||
{"Drawdown", "0.400%"},
|
||||
{"Expectancy", "-1"},
|
||||
{"Start Equity", "100000"},
|
||||
|
||||
239
Algorithm.CSharp/BasicTemplateEurexFuturesAlgorithm.cs
Normal file
239
Algorithm.CSharp/BasicTemplateEurexFuturesAlgorithm.cs
Normal file
@@ -0,0 +1,239 @@
|
||||
/*
|
||||
* 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 QuantConnect.Data;
|
||||
using QuantConnect.Data.UniverseSelection;
|
||||
using QuantConnect.Interfaces;
|
||||
using QuantConnect.Orders;
|
||||
using QuantConnect.Securities;
|
||||
using QuantConnect.Securities.Future;
|
||||
|
||||
namespace QuantConnect.Algorithm.CSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// This algorithm tests and demonstrates EUREX futures subscription and trading:
|
||||
/// - It tests contracts rollover by adding a continuous future and asserting that mapping happens at some point.
|
||||
/// - It tests basic trading by buying a contract and holding it until expiration.
|
||||
/// - It tests delisting and asserts the holdings are liquidated after that.
|
||||
/// </summary>
|
||||
public class BasicTemplateEurexFuturesAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
|
||||
{
|
||||
private Future _continuousContract;
|
||||
private Symbol _mappedSymbol;
|
||||
private Symbol _contractToTrade;
|
||||
private int _mappingsCount;
|
||||
private decimal _boughtQuantity;
|
||||
private decimal _liquidatedQuantity;
|
||||
private bool _delisted;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
SetStartDate(2024, 5, 30);
|
||||
SetEndDate(2024, 6, 23);
|
||||
|
||||
SetAccountCurrency(Currencies.EUR);
|
||||
SetCash(1000000);
|
||||
|
||||
_continuousContract = AddFuture(Futures.Indices.EuroStoxx50, Resolution.Minute,
|
||||
dataNormalizationMode: DataNormalizationMode.BackwardsRatio,
|
||||
dataMappingMode: DataMappingMode.FirstDayMonth,
|
||||
contractDepthOffset: 0);
|
||||
_continuousContract.SetFilter(TimeSpan.Zero, TimeSpan.FromDays(180));
|
||||
_mappedSymbol = _continuousContract.Mapped;
|
||||
|
||||
var benchmark = AddIndex("SX5E", market: Market.EUREX);
|
||||
SetBenchmark(benchmark.Symbol);
|
||||
|
||||
var seeder = new FuncSecuritySeeder(GetLastKnownPrices);
|
||||
SetSecurityInitializer(security => seeder.SeedSecurity(security));
|
||||
}
|
||||
|
||||
public override void OnData(Slice slice)
|
||||
{
|
||||
foreach (var changedEvent in slice.SymbolChangedEvents.Values)
|
||||
{
|
||||
if (++_mappingsCount > 1)
|
||||
{
|
||||
throw new RegressionTestException($"{Time} - Unexpected number of symbol changed events (mappings): {_mappingsCount}. " +
|
||||
$"Expected only 1.");
|
||||
}
|
||||
|
||||
Debug($"{Time} - SymbolChanged event: {changedEvent}");
|
||||
|
||||
if (changedEvent.OldSymbol != _mappedSymbol.ID.ToString())
|
||||
{
|
||||
throw new RegressionTestException($"{Time} - Unexpected symbol changed event old symbol: {changedEvent}");
|
||||
}
|
||||
|
||||
if (changedEvent.NewSymbol != _continuousContract.Mapped.ID.ToString())
|
||||
{
|
||||
throw new RegressionTestException($"{Time} - Unexpected symbol changed event new symbol: {changedEvent}");
|
||||
}
|
||||
|
||||
// Let's trade the previous mapped contract, so we can hold it until expiration for testing
|
||||
// (will be sooner than the new mapped contract)
|
||||
_contractToTrade = _mappedSymbol;
|
||||
_mappedSymbol = _continuousContract.Mapped;
|
||||
}
|
||||
|
||||
// Let's trade after the mapping is done
|
||||
if (_contractToTrade != null && _boughtQuantity == 0 && Securities[_contractToTrade].Exchange.ExchangeOpen)
|
||||
{
|
||||
Buy(_contractToTrade, 1);
|
||||
}
|
||||
|
||||
if (_contractToTrade != null && slice.Delistings.TryGetValue(_contractToTrade, out var delisting))
|
||||
{
|
||||
if (delisting.Type == DelistingType.Delisted)
|
||||
{
|
||||
_delisted = true;
|
||||
|
||||
if (Portfolio.Invested)
|
||||
{
|
||||
throw new RegressionTestException($"{Time} - Portfolio should not be invested after the traded contract is delisted.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnOrderEvent(OrderEvent orderEvent)
|
||||
{
|
||||
if (orderEvent.Symbol != _contractToTrade)
|
||||
{
|
||||
throw new RegressionTestException($"{Time} - Unexpected order event symbol: {orderEvent.Symbol}. Expected {_contractToTrade}");
|
||||
}
|
||||
|
||||
if (orderEvent.Direction == OrderDirection.Buy)
|
||||
{
|
||||
if (orderEvent.Status == OrderStatus.Filled)
|
||||
{
|
||||
if (_boughtQuantity != 0 && _liquidatedQuantity != 0)
|
||||
{
|
||||
throw new RegressionTestException($"{Time} - Unexpected buy order event status: {orderEvent.Status}");
|
||||
}
|
||||
_boughtQuantity = orderEvent.Quantity;
|
||||
}
|
||||
}
|
||||
else if (orderEvent.Direction == OrderDirection.Sell)
|
||||
{
|
||||
if (orderEvent.Status == OrderStatus.Filled)
|
||||
{
|
||||
if (_boughtQuantity <= 0 && _liquidatedQuantity != 0)
|
||||
{
|
||||
throw new RegressionTestException($"{Time} - Unexpected sell order event status: {orderEvent.Status}");
|
||||
}
|
||||
_liquidatedQuantity = orderEvent.Quantity;
|
||||
|
||||
if (_liquidatedQuantity != -_boughtQuantity)
|
||||
{
|
||||
throw new RegressionTestException($"{Time} - Unexpected liquidated quantity: {_liquidatedQuantity}. Expected: {-_boughtQuantity}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnSecuritiesChanged(SecurityChanges changes)
|
||||
{
|
||||
foreach (var addedSecurity in changes.AddedSecurities)
|
||||
{
|
||||
if (addedSecurity.Symbol.SecurityType == SecurityType.Future && addedSecurity.Symbol.IsCanonical())
|
||||
{
|
||||
_mappedSymbol = _continuousContract.Mapped;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnEndOfAlgorithm()
|
||||
{
|
||||
if (_mappingsCount == 0)
|
||||
{
|
||||
throw new RegressionTestException($"Unexpected number of symbol changed events (mappings): {_mappingsCount}. Expected 1.");
|
||||
}
|
||||
|
||||
if (!_delisted)
|
||||
{
|
||||
throw new RegressionTestException("Contract was not delisted");
|
||||
}
|
||||
|
||||
// Make sure we traded and that the position was liquidated on delisting
|
||||
if (_boughtQuantity <= 0 || _liquidatedQuantity >= 0)
|
||||
{
|
||||
throw new RegressionTestException($"Unexpected sold quantity: {_boughtQuantity} and liquidated quantity: {_liquidatedQuantity}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <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 List<Language> Languages { get; } = new() { Language.CSharp, Language.Python };
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 133945;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 26;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
/// </summary>
|
||||
public AlgorithmStatus AlgorithmStatus => AlgorithmStatus.Completed;
|
||||
|
||||
/// <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 Orders", "2"},
|
||||
{"Average Win", "0%"},
|
||||
{"Average Loss", "-0.11%"},
|
||||
{"Compounding Annual Return", "-1.667%"},
|
||||
{"Drawdown", "0.100%"},
|
||||
{"Expectancy", "-1"},
|
||||
{"Start Equity", "1000000"},
|
||||
{"End Equity", "998849.48"},
|
||||
{"Net Profit", "-0.115%"},
|
||||
{"Sharpe Ratio", "-34.455"},
|
||||
{"Sortino Ratio", "-57.336"},
|
||||
{"Probabilistic Sharpe Ratio", "0.002%"},
|
||||
{"Loss Rate", "100%"},
|
||||
{"Win Rate", "0%"},
|
||||
{"Profit-Loss Ratio", "0"},
|
||||
{"Alpha", "0"},
|
||||
{"Beta", "0"},
|
||||
{"Annual Standard Deviation", "0.002"},
|
||||
{"Annual Variance", "0"},
|
||||
{"Information Ratio", "-6.176"},
|
||||
{"Tracking Error", "0.002"},
|
||||
{"Treynor Ratio", "0"},
|
||||
{"Total Fees", "€1.02"},
|
||||
{"Estimated Strategy Capacity", "€2300000000.00"},
|
||||
{"Lowest Capacity Asset", "FESX YJHOAMPYKRS5"},
|
||||
{"Portfolio Turnover", "0.40%"},
|
||||
{"OrderListHash", "54040d29a467becaedcf59d79323321b"}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 378;
|
||||
public override long DataPoints => 356;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 2163;
|
||||
public override long DataPoints => 1269;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 471135;
|
||||
public long DataPoints => 15023;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -142,7 +142,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Tracking Error", "0"},
|
||||
{"Treynor Ratio", "0"},
|
||||
{"Total Fees", "$26.00"},
|
||||
{"Estimated Strategy Capacity", "$70000.00"},
|
||||
{"Estimated Strategy Capacity", "$69000.00"},
|
||||
{"Lowest Capacity Asset", "GOOCV W78ZERHAOVVQ|GOOCV VP83T1ZUHROL"},
|
||||
{"Portfolio Turnover", "61.31%"},
|
||||
{"OrderListHash", "35d406df401e5b27244e20f5ec57346e"}
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 471124;
|
||||
public long DataPoints => 15130;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -152,7 +152,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Tracking Error", "0"},
|
||||
{"Treynor Ratio", "0"},
|
||||
{"Total Fees", "$543.40"},
|
||||
{"Estimated Strategy Capacity", "$3000.00"},
|
||||
{"Estimated Strategy Capacity", "$4000.00"},
|
||||
{"Lowest Capacity Asset", "GOOCV W78ZFMEBBB2E|GOOCV VP83T1ZUHROL"},
|
||||
{"Portfolio Turnover", "338.60%"},
|
||||
{"OrderListHash", "301c15063f6e269023d144ca69a765da"}
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 471124;
|
||||
public long DataPoints => 15012;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 339;
|
||||
public long DataPoints => 308;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using QuantConnect.Data;
|
||||
@@ -100,7 +99,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 1252633;
|
||||
public long DataPoints => 12290;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -120,7 +119,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Total Orders", "2"},
|
||||
{"Average Win", "0%"},
|
||||
{"Average Loss", "-0.40%"},
|
||||
{"Compounding Annual Return", "-21.622%"},
|
||||
{"Compounding Annual Return", "-20.338%"},
|
||||
{"Drawdown", "0.300%"},
|
||||
{"Expectancy", "-1"},
|
||||
{"Start Equity", "100000"},
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 1847643;
|
||||
public long DataPoints => 17486;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -157,32 +157,32 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
public Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
|
||||
{
|
||||
{"Total Orders", "5"},
|
||||
{"Average Win", "0.14%"},
|
||||
{"Average Loss", "-0.28%"},
|
||||
{"Compounding Annual Return", "-47.543%"},
|
||||
{"Average Win", "0.13%"},
|
||||
{"Average Loss", "-0.30%"},
|
||||
{"Compounding Annual Return", "-46.395%"},
|
||||
{"Drawdown", "1.600%"},
|
||||
{"Expectancy", "0.502"},
|
||||
{"Expectancy", "0.429"},
|
||||
{"Start Equity", "100000"},
|
||||
{"End Equity", "99178.50"},
|
||||
{"Net Profit", "-0.821%"},
|
||||
{"Sharpe Ratio", "-4.136"},
|
||||
{"End Equity", "99149.50"},
|
||||
{"Net Profit", "-0.850%"},
|
||||
{"Sharpe Ratio", "-4.298"},
|
||||
{"Sortino Ratio", "0"},
|
||||
{"Probabilistic Sharpe Ratio", "17.155%"},
|
||||
{"Probabilistic Sharpe Ratio", "15.319%"},
|
||||
{"Loss Rate", "0%"},
|
||||
{"Win Rate", "100%"},
|
||||
{"Profit-Loss Ratio", "0.50"},
|
||||
{"Alpha", "-0.855"},
|
||||
{"Beta", "1.047"},
|
||||
{"Annual Standard Deviation", "0.099"},
|
||||
{"Profit-Loss Ratio", "0.43"},
|
||||
{"Alpha", "-0.84"},
|
||||
{"Beta", "0.986"},
|
||||
{"Annual Standard Deviation", "0.098"},
|
||||
{"Annual Variance", "0.01"},
|
||||
{"Information Ratio", "-9.141"},
|
||||
{"Information Ratio", "-9.299"},
|
||||
{"Tracking Error", "0.091"},
|
||||
{"Treynor Ratio", "-0.392"},
|
||||
{"Treynor Ratio", "-0.428"},
|
||||
{"Total Fees", "$4.00"},
|
||||
{"Estimated Strategy Capacity", "$0"},
|
||||
{"Lowest Capacity Asset", "AAPL R735QTJ8XC9X"},
|
||||
{"Portfolio Turnover", "13.49%"},
|
||||
{"OrderListHash", "2722fee93126736e03d66d7ab880b537"}
|
||||
{"Portfolio Turnover", "13.50%"},
|
||||
{"OrderListHash", "cf14a7ce9c86e6844051820fd4c9394c"}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 32351;
|
||||
public long DataPoints => 9504;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -129,7 +129,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Total Orders", "5"},
|
||||
{"Average Win", "0%"},
|
||||
{"Average Loss", "-0.07%"},
|
||||
{"Compounding Annual Return", "-12.496%"},
|
||||
{"Compounding Annual Return", "-11.517%"},
|
||||
{"Drawdown", "0.200%"},
|
||||
{"Expectancy", "-1"},
|
||||
{"Start Equity", "100000"},
|
||||
|
||||
@@ -43,14 +43,12 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
SetEndDate(2021, 1, 10);
|
||||
SetCash(1000000);
|
||||
|
||||
var spx = AddIndex("SPX").Symbol;
|
||||
|
||||
// regular option SPX contracts
|
||||
var spxOptions = AddIndexOption(spx);
|
||||
var spxOptions = AddIndexOption("SPX");
|
||||
spxOptions.SetFilter(u => u.Strikes(0, 1).Expiration(0, 30));
|
||||
|
||||
// weekly option SPX contracts
|
||||
var spxw = AddIndexOption(spx, "SPXW");
|
||||
var spxw = AddIndexOption("SPX", "SPXW");
|
||||
spxw.SetFilter(u => u.Strikes(0, 1)
|
||||
// single week ahead since there are many SPXW contracts and we want to preserve performance
|
||||
.Expiration(0, 7)
|
||||
@@ -105,7 +103,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public virtual long DataPoints => 57869;
|
||||
public virtual long DataPoints => 21467;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -125,29 +123,29 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Total Orders", "5"},
|
||||
{"Average Win", "0%"},
|
||||
{"Average Loss", "-0.69%"},
|
||||
{"Compounding Annual Return", "59.804%"},
|
||||
{"Compounding Annual Return", "54.478%"},
|
||||
{"Drawdown", "0.400%"},
|
||||
{"Expectancy", "-0.5"},
|
||||
{"Start Equity", "1000000"},
|
||||
{"End Equity", "1006025"},
|
||||
{"Net Profit", "0.602%"},
|
||||
{"Sharpe Ratio", "3.01"},
|
||||
{"Sharpe Ratio", "2.62"},
|
||||
{"Sortino Ratio", "0"},
|
||||
{"Probabilistic Sharpe Ratio", "62.865%"},
|
||||
{"Probabilistic Sharpe Ratio", "63.221%"},
|
||||
{"Loss Rate", "50%"},
|
||||
{"Win Rate", "50%"},
|
||||
{"Profit-Loss Ratio", "0"},
|
||||
{"Alpha", "0.249"},
|
||||
{"Beta", "-0.033"},
|
||||
{"Alpha", "0.067"},
|
||||
{"Beta", "-0.013"},
|
||||
{"Annual Standard Deviation", "0.004"},
|
||||
{"Annual Variance", "0"},
|
||||
{"Information Ratio", "-99.414"},
|
||||
{"Tracking Error", "0.072"},
|
||||
{"Treynor Ratio", "-0.382"},
|
||||
{"Information Ratio", "-50.808"},
|
||||
{"Tracking Error", "0.086"},
|
||||
{"Treynor Ratio", "-0.725"},
|
||||
{"Total Fees", "$0.00"},
|
||||
{"Estimated Strategy Capacity", "$580000.00"},
|
||||
{"Lowest Capacity Asset", "SPXW 31K54PVWHUJHQ|SPX 31"},
|
||||
{"Portfolio Turnover", "0.48%"},
|
||||
{"Portfolio Turnover", "0.40%"},
|
||||
{"OrderListHash", "07a085baedb37bb7c8d460558ea77e88"}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public virtual long DataPoints => 40968;
|
||||
public virtual long DataPoints => 16680;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -48,7 +48,12 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
UniverseSettings.Resolution = Resolution.Minute;
|
||||
|
||||
SetStartDate(2014, 06, 04);
|
||||
SetEndDate(2014, 06, 06);
|
||||
// TWX is selected the 4th and 5th and aapl after that.
|
||||
// If the algo ends on the 6th, TWX subscriptions will not be removed before OnEndOfAlgorithm is called:
|
||||
// - 6th: AAPL is selected, TWX is removed but subscriptions are not removed because the securities are invested.
|
||||
// - TWX and its options are liquidated.
|
||||
// - 7th: Since options universe selection is daily now, TWX subscriptions are removed the next day (7th)
|
||||
SetEndDate(2014, 06, 07);
|
||||
|
||||
var selectionUniverse = AddUniverse(enumerable => new[] { Time.Date <= new DateTime(2014, 6, 5) ? _twx : _aapl },
|
||||
enumerable => new[] { Time.Date <= new DateTime(2014, 6, 5) ? _twx : _aapl });
|
||||
@@ -157,7 +162,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 998464;
|
||||
public long DataPoints => 18993;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -197,8 +202,8 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Tracking Error", "0.048"},
|
||||
{"Treynor Ratio", "0.172"},
|
||||
{"Total Fees", "$16.10"},
|
||||
{"Estimated Strategy Capacity", "$3100000.00"},
|
||||
{"Lowest Capacity Asset", "AOL VRKS95ENLBYE|AOL R735QTJ8XC9X"},
|
||||
{"Estimated Strategy Capacity", "$5000000.00"},
|
||||
{"Lowest Capacity Asset", "AOL R735QTJ8XC9X"},
|
||||
{"Portfolio Turnover", "17.64%"},
|
||||
{"OrderListHash", "a8605c1f5a9c67f60f1ddc963ec45542"}
|
||||
};
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 471135;
|
||||
public override long DataPoints => 15023;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 471135;
|
||||
public override long DataPoints => 15023;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 471135;
|
||||
public override long DataPoints => 15023;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -92,7 +92,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Tracking Error", "0"},
|
||||
{"Treynor Ratio", "0"},
|
||||
{"Total Fees", "$26.00"},
|
||||
{"Estimated Strategy Capacity", "$70000.00"},
|
||||
{"Estimated Strategy Capacity", "$69000.00"},
|
||||
{"Lowest Capacity Asset", "GOOCV W78ZERHAOVVQ|GOOCV VP83T1ZUHROL"},
|
||||
{"Portfolio Turnover", "30.35%"},
|
||||
{"OrderListHash", "615c795b0c450cb8e4c3cba803ebb180"}
|
||||
|
||||
@@ -331,7 +331,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 471135;
|
||||
public long DataPoints => 15023;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 4490;
|
||||
public override long DataPoints => 2298;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 4490;
|
||||
public override long DataPoints => 2298;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 463141;
|
||||
public long DataPoints => 7029;
|
||||
|
||||
/// </summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 5280;
|
||||
public long DataPoints => 2862;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -37,9 +37,9 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
|
||||
var equity = AddEquity("GOOG");
|
||||
|
||||
_optionSymbol = OptionChainProvider.GetOptionContractList(equity.Symbol, Time)
|
||||
.OrderBy(symbol => symbol.ID.StrikePrice)
|
||||
.ThenByDescending(symbol => symbol.ID.Date)
|
||||
_optionSymbol = OptionChain(equity.Symbol)
|
||||
.OrderBy(x => x.ID.StrikePrice)
|
||||
.ThenByDescending(x => x.ID.Date)
|
||||
.First(optionContract => optionContract.ID.OptionRight == OptionRight.Call);
|
||||
var option = AddOptionContract(_optionSymbol);
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -51,10 +51,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
|
||||
if (_addOption)
|
||||
{
|
||||
var contracts = OptionChainProvider.GetOptionContractList(_spx, Time);
|
||||
contracts = contracts.Where(x =>
|
||||
x.ID.OptionRight == OptionRight.Put &&
|
||||
x.ID.Date.Date == new DateTime(2021, 1, 15));
|
||||
var contracts = OptionChain(_spx).Where(x => x.ID.OptionRight == OptionRight.Put && x.ID.Date.Date == new DateTime(2021, 1, 15));
|
||||
|
||||
var option = AddIndexOptionContract(contracts.First(), Resolution.Minute);
|
||||
_optionExpiry = option.Expiry;
|
||||
@@ -128,7 +125,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all time slices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 1839;
|
||||
public long DataPoints => 1461;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
var _twxOption = AddOption("TWX", Resolution.Minute);
|
||||
_exchange = _twxOption.Exchange;
|
||||
_twxOption.SetFilter((x) => x
|
||||
.Contracts(c => c.Where(s => _contracts.Contains(s.Value))));
|
||||
.Contracts(c => c.Where(s => _contracts.Contains(s.Symbol.Value))));
|
||||
SetBenchmark(t => 1);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 1291113;
|
||||
public long DataPoints => 70553;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -136,10 +136,10 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Tracking Error", "0.456"},
|
||||
{"Treynor Ratio", "0"},
|
||||
{"Total Fees", "$2650.41"},
|
||||
{"Estimated Strategy Capacity", "$30000.00"},
|
||||
{"Estimated Strategy Capacity", "$29000.00"},
|
||||
{"Lowest Capacity Asset", "BTCUSD 2XR"},
|
||||
{"Portfolio Turnover", "46.79%"},
|
||||
{"OrderListHash", "864a3590199bfde14bed81bfbb8fcf70"}
|
||||
{"OrderListHash", "70610cb67cc63d197e22ca71180b2df2"}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,10 +58,10 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
Resolution.Minute).Symbol;
|
||||
|
||||
// Select a future option expiring ITM, and adds it to the algorithm.
|
||||
var esOptions = OptionChainProvider.GetOptionContractList(es20m20, Time)
|
||||
.Concat(OptionChainProvider.GetOptionContractList(es20h20, Time))
|
||||
.Where(x => x.ID.StrikePrice == 3200m && x.ID.OptionRight == OptionRight.Call)
|
||||
.Select(x => AddFutureOptionContract(x, Resolution.Minute).Symbol)
|
||||
var esOptions = OptionChain(es20m20)
|
||||
.Concat(OptionChain(es20h20))
|
||||
.Where(contractData => contractData.ID.StrikePrice == 3200m && contractData.ID.OptionRight == OptionRight.Call)
|
||||
.Select(contractData => AddFutureOptionContract(contractData, Resolution.Minute).Symbol)
|
||||
.ToList();
|
||||
|
||||
var expectedContracts = new[]
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
Resolution.Minute).Symbol;
|
||||
|
||||
// Select a future option expiring ITM, and adds it to the algorithm.
|
||||
_esOption = AddFutureOptionContract(OptionChainProvider.GetOptionContractList(_es19m20, Time)
|
||||
_esOption = AddFutureOptionContract(OptionChain(_es19m20)
|
||||
.Where(x => x.ID.StrikePrice <= 3200m && x.ID.OptionRight == OptionRight.Call)
|
||||
.OrderByDescending(x => x.ID.StrikePrice)
|
||||
.Take(1)
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
TimeSpan.FromMinutes(1));
|
||||
|
||||
// Select a future option expiring ITM, and adds it to the algorithm.
|
||||
_esOption = AddFutureOptionContract(OptionChainProvider.GetOptionContractList(_es19m20.Symbol, new DateTime(2020, 1, 5))
|
||||
_esOption = AddFutureOptionContract(OptionChain(_es19m20.Symbol)
|
||||
.Where(x => x.ID.StrikePrice <= 3200m && x.ID.OptionRight == OptionRight.Call)
|
||||
.OrderByDescending(x => x.ID.StrikePrice)
|
||||
.Take(1)
|
||||
|
||||
@@ -59,9 +59,9 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
Resolution.Minute).Symbol;
|
||||
|
||||
// Select a future option call expiring OTM, and adds it to the algorithm.
|
||||
_esOption = AddFutureOptionContract(OptionChainProvider.GetOptionContractList(_es19m20, Time)
|
||||
.Where(x => x.ID.StrikePrice >= 3300m && x.ID.OptionRight == OptionRight.Call)
|
||||
.OrderBy(x => x.ID.StrikePrice)
|
||||
_esOption = AddFutureOptionContract(OptionChain(_es19m20)
|
||||
.Where(contractData => contractData.ID.StrikePrice >= 3300m && contractData.ID.OptionRight == OptionRight.Call)
|
||||
.OrderBy(contractData => contractData.ID.StrikePrice)
|
||||
.Take(1)
|
||||
.Single(), Resolution.Minute).Symbol;
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
Resolution).Symbol;
|
||||
|
||||
// Attempt to fetch a specific future option contract
|
||||
DcOption = OptionChainProvider.GetOptionContractList(dc, Time)
|
||||
DcOption = OptionChain(dc)
|
||||
.Where(x => x.ID.StrikePrice == 17m && x.ID.OptionRight == OptionRight.Call)
|
||||
.Select(x => AddFutureOptionContract(x, Resolution).Symbol)
|
||||
.FirstOrDefault();
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{
|
||||
public class FutureOptionIndicatorsRegressionAlgorithm : OptionIndicatorsRegressionAlgorithm
|
||||
{
|
||||
protected override string ExpectedGreeks { get; set; } = "Implied Volatility: 0.14316,Delta: 0.55278,Gamma: 0.00156,Vega: 5.60955,Theta: -0.64434,Rho: -0.0084";
|
||||
protected override string ExpectedGreeks { get; set; } = "Implied Volatility: 0.14008,Delta: 0.63466,Gamma: 0.00209,Vega: 5.61442,Theta: -0.48254,Rho: 0.03098";
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -32,7 +32,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
var underlying = AddFutureContract(QuantConnect.Symbol.CreateFuture(Futures.Indices.SP500EMini, Market.CME, new DateTime(2020, 3, 20)),
|
||||
Resolution.Minute).Symbol;
|
||||
|
||||
var option = AddFutureOptionContract(OptionChainProvider.GetOptionContractList(underlying, Time)
|
||||
var option = AddFutureOptionContract(OptionChain(underlying)
|
||||
.Where(x => x.ID.StrikePrice <= 3200m && x.ID.OptionRight == OptionRight.Call)
|
||||
.OrderByDescending(x => x.ID.StrikePrice)
|
||||
.Take(1)
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
Resolution.Minute).Symbol;
|
||||
|
||||
// Select a future option expiring ITM, and adds it to the algorithm.
|
||||
_esOption = AddFutureOptionContract(OptionChainProvider.GetOptionContractList(_es19m20, Time)
|
||||
_esOption = AddFutureOptionContract(OptionChain(_es19m20)
|
||||
.Where(x => x.ID.StrikePrice >= 3300m && x.ID.OptionRight == OptionRight.Put)
|
||||
.OrderBy(x => x.ID.StrikePrice)
|
||||
.Take(1)
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
Resolution.Minute).Symbol;
|
||||
|
||||
// Select a future option expiring ITM, and adds it to the algorithm.
|
||||
_esOption = AddFutureOptionContract(OptionChainProvider.GetOptionContractList(_es19m20, Time)
|
||||
_esOption = AddFutureOptionContract(OptionChain(_es19m20)
|
||||
.Where(x => x.ID.StrikePrice <= 3150m && x.ID.OptionRight == OptionRight.Put)
|
||||
.OrderByDescending(x => x.ID.StrikePrice)
|
||||
.Take(1)
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
Resolution.Minute).Symbol;
|
||||
|
||||
// Select a future option expiring ITM, and adds it to the algorithm.
|
||||
_esOption = AddFutureOptionContract(OptionChainProvider.GetOptionContractList(_es19m20, Time)
|
||||
_esOption = AddFutureOptionContract(OptionChain(_es19m20)
|
||||
.Where(x => x.ID.StrikePrice <= 3100m && x.ID.OptionRight == OptionRight.Call)
|
||||
.OrderByDescending(x => x.ID.StrikePrice)
|
||||
.Take(1)
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
Resolution.Minute).Symbol;
|
||||
|
||||
// Select a future option expiring ITM, and adds it to the algorithm.
|
||||
_esOption = AddFutureOptionContract(OptionChainProvider.GetOptionContractList(_es19m20, Time)
|
||||
_esOption = AddFutureOptionContract(OptionChain(_es19m20)
|
||||
.Where(x => x.ID.StrikePrice >= 3400m && x.ID.OptionRight == OptionRight.Call)
|
||||
.OrderBy(x => x.ID.StrikePrice)
|
||||
.Take(1)
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
Resolution.Minute).Symbol;
|
||||
|
||||
// Select a future option expiring ITM, and adds it to the algorithm.
|
||||
_esOption = AddFutureOptionContract(OptionChainProvider.GetOptionContractList(_es19m20, Time)
|
||||
_esOption = AddFutureOptionContract(OptionChain(_es19m20)
|
||||
.Where(x => x.ID.StrikePrice <= 3400m && x.ID.OptionRight == OptionRight.Put)
|
||||
.OrderByDescending(x => x.ID.StrikePrice)
|
||||
.Take(1)
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
Resolution.Minute).Symbol;
|
||||
|
||||
// Select a future option expiring ITM, and adds it to the algorithm.
|
||||
_esOption = AddFutureOptionContract(OptionChainProvider.GetOptionContractList(_es19m20, Time)
|
||||
_esOption = AddFutureOptionContract(OptionChain(_es19m20)
|
||||
.Where(x => x.ID.StrikePrice <= 3000m && x.ID.OptionRight == OptionRight.Put)
|
||||
.OrderByDescending(x => x.ID.StrikePrice)
|
||||
.Take(1)
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 1475;
|
||||
public long DataPoints => 1483;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
var spx = AddIndex("SPX", Resolution.Minute).Symbol;
|
||||
|
||||
// Select a index option expiring ITM, and adds it to the algorithm.
|
||||
var spxOptions = OptionChainProvider.GetOptionContractList(spx, Time)
|
||||
var spxOptions = OptionChain(spx)
|
||||
.Where(x => (x.ID.StrikePrice == 3700m || x.ID.StrikePrice == 3800m) && x.ID.OptionRight == OptionRight.Call && x.ID.Date.Year == 2021 && x.ID.Date.Month == 1)
|
||||
.Select(x => AddIndexOptionContract(x, Resolution.Minute).Symbol)
|
||||
.OrderBy(x => x.ID.StrikePrice)
|
||||
@@ -123,7 +123,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -40,6 +40,11 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// </summary>
|
||||
public override long DataPoints => 194;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public override int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
|
||||
/// </summary>
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
_spx = AddIndex("SPX", Resolution).Symbol;
|
||||
|
||||
// Select an index option expiring ITM, and adds it to the algorithm.
|
||||
_spxOption = AddIndexOptionContract(OptionChainProvider.GetOptionContractList(_spx, Time)
|
||||
_spxOption = AddIndexOptionContract(OptionChain(_spx)
|
||||
.Where(x => x.ID.StrikePrice <= 3200m && x.ID.OptionRight == OptionRight.Call && x.ID.Date.Year == 2021 && x.ID.Date.Month == 1)
|
||||
.OrderByDescending(x => x.ID.StrikePrice)
|
||||
.Take(1)
|
||||
@@ -175,7 +175,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public virtual int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
_spx = spx.Symbol;
|
||||
|
||||
// Select an index option expiring ITM, and adds it to the algorithm.
|
||||
_spxOption = AddIndexOptionContract(OptionChainProvider.GetOptionContractList(_spx, Time)
|
||||
_spxOption = AddIndexOptionContract(OptionChain(_spx)
|
||||
.Where(x => x.ID.StrikePrice <= 3200m && x.ID.OptionRight == OptionRight.Call && x.ID.Date.Year == 2021 && x.ID.Date.Month == 1)
|
||||
.OrderByDescending(x => x.ID.StrikePrice)
|
||||
.Take(1)
|
||||
@@ -161,7 +161,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -40,6 +40,11 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// </summary>
|
||||
public override long DataPoints => 184;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public override int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
|
||||
/// </summary>
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
_spx = AddIndex("SPX", Resolution).Symbol;
|
||||
|
||||
// Select a index option call expiring OTM, and adds it to the algorithm.
|
||||
_spxOption = AddIndexOptionContract(OptionChainProvider.GetOptionContractList(_spx, Time)
|
||||
_spxOption = AddIndexOptionContract(OptionChain(_spx)
|
||||
.Where(x => x.ID.StrikePrice >= 4250m && x.ID.OptionRight == OptionRight.Call && x.ID.Date.Year == 2021 && x.ID.Date.Month == 1)
|
||||
.OrderBy(x => x.ID.StrikePrice)
|
||||
.Take(1)
|
||||
@@ -183,7 +183,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public virtual int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{
|
||||
public class IndexOptionIndicatorsRegressionAlgorithm : OptionIndicatorsRegressionAlgorithm
|
||||
{
|
||||
protected override string ExpectedGreeks { get; set; } = "Implied Volatility: 0.18072,Delta: 0.1897,Gamma: 0.00246,Vega: 1.7607,Theta: -1.43923,Rho: 0.01673";
|
||||
protected override string ExpectedGreeks { get; set; } = "Implied Volatility: 0.17702,Delta: 0.19195,Gamma: 0.00247,Vega: 1.69043,Theta: -1.41571,Rho: 0.01686";
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
_spx = AddIndex("SPX", Resolution.Minute).Symbol;
|
||||
|
||||
// Select a index option expiring ITM, and adds it to the algorithm.
|
||||
_spxOption = AddIndexOptionContract(OptionChainProvider.GetOptionContractList(_spx, Time)
|
||||
_spxOption = AddIndexOptionContract(OptionChain(_spx)
|
||||
.Where(x => x.ID.StrikePrice >= 4200m && x.ID.OptionRight == OptionRight.Put && x.ID.Date.Year == 2021 && x.ID.Date.Month == 1)
|
||||
.OrderBy(x => x.ID.StrikePrice)
|
||||
.Take(1)
|
||||
@@ -190,7 +190,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
_spx = AddIndex("SPX", Resolution.Minute).Symbol;
|
||||
|
||||
// Select a index option expiring ITM, and adds it to the algorithm.
|
||||
_spxOption = AddIndexOptionContract(OptionChainProvider.GetOptionContractList(_spx, Time)
|
||||
_spxOption = AddIndexOptionContract(OptionChain(_spx)
|
||||
.Where(x => x.ID.StrikePrice <= 3200m && x.ID.OptionRight == OptionRight.Put && x.ID.Date.Year == 2021 && x.ID.Date.Month == 1)
|
||||
.OrderByDescending(x => x.ID.StrikePrice)
|
||||
.Take(1)
|
||||
@@ -174,7 +174,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 160;
|
||||
public long DataPoints => 106;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -111,31 +111,31 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{
|
||||
{"Total Orders", "4"},
|
||||
{"Average Win", "0%"},
|
||||
{"Average Loss", "-20.28%"},
|
||||
{"Average Loss", "-20.04%"},
|
||||
{"Compounding Annual Return", "79228162514264337593543950335%"},
|
||||
{"Drawdown", "2.100%"},
|
||||
{"Expectancy", "-0.5"},
|
||||
{"Start Equity", "100000"},
|
||||
{"End Equity", "273533.3"},
|
||||
{"Net Profit", "173.533%"},
|
||||
{"Sharpe Ratio", "6.71649879978702E+27"},
|
||||
{"End Equity", "274018.3"},
|
||||
{"Net Profit", "174.018%"},
|
||||
{"Sharpe Ratio", "6.74816637965336E+27"},
|
||||
{"Sortino Ratio", "0"},
|
||||
{"Probabilistic Sharpe Ratio", "95.428%"},
|
||||
{"Loss Rate", "50%"},
|
||||
{"Win Rate", "50%"},
|
||||
{"Profit-Loss Ratio", "0"},
|
||||
{"Alpha", "7.922816251426434E+28"},
|
||||
{"Beta", "4.588"},
|
||||
{"Annual Standard Deviation", "11.796"},
|
||||
{"Annual Variance", "139.147"},
|
||||
{"Information Ratio", "6.718097080548688E+27"},
|
||||
{"Tracking Error", "11.793"},
|
||||
{"Treynor Ratio", "1.726981543228595E+28"},
|
||||
{"Beta", "4.566"},
|
||||
{"Annual Standard Deviation", "11.741"},
|
||||
{"Annual Variance", "137.844"},
|
||||
{"Information Ratio", "6.749778840887739E+27"},
|
||||
{"Tracking Error", "11.738"},
|
||||
{"Treynor Ratio", "1.7351225556608623E+28"},
|
||||
{"Total Fees", "$0.00"},
|
||||
{"Estimated Strategy Capacity", "$8000.00"},
|
||||
{"Estimated Strategy Capacity", "$7000.00"},
|
||||
{"Lowest Capacity Asset", "NQX 31M220FF62ZSE|NDX 31"},
|
||||
{"Portfolio Turnover", "6.51%"},
|
||||
{"OrderListHash", "1d60b5da574b3e9bc78335b4af3aa772"}
|
||||
{"Portfolio Turnover", "6.40%"},
|
||||
{"OrderListHash", "ec6881b180c68e6c7a48f6596c73e83d"}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,9 +60,9 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
_spx = AddIndex("SPX", Resolution.Minute).Symbol;
|
||||
|
||||
// Select a index option expiring ITM, and adds it to the algorithm.
|
||||
_esOption = AddIndexOptionContract(OptionChainProvider.GetOptionContractList(_spx, Time)
|
||||
.Where(x => x.ID.StrikePrice <= 3200m && x.ID.OptionRight == OptionRight.Call && x.ID.Date.Year == 2021 && x.ID.Date.Month == 1)
|
||||
.OrderByDescending(x => x.ID.StrikePrice)
|
||||
_esOption = AddIndexOptionContract(OptionChain(_spx)
|
||||
.Where(contractData => contractData.ID.StrikePrice <= 3200m && contractData.ID.OptionRight == OptionRight.Call && contractData.ID.Date.Year == 2021 && contractData.ID.Date.Month == 1)
|
||||
.OrderByDescending(contractData => contractData.ID.StrikePrice)
|
||||
.Take(1)
|
||||
.Single(), Resolution.Minute).Symbol;
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
_spx = AddIndex("SPX", Resolution.Minute).Symbol;
|
||||
|
||||
// Select a index option expiring ITM, and adds it to the algorithm.
|
||||
_spxOption = AddIndexOptionContract(OptionChainProvider.GetOptionContractList(_spx, Time)
|
||||
_spxOption = AddIndexOptionContract(OptionChain(_spx)
|
||||
.Where(x => x.ID.StrikePrice >= 4250m && x.ID.OptionRight == OptionRight.Call && x.ID.Date.Year == 2021 && x.ID.Date.Month == 1)
|
||||
.OrderBy(x => x.ID.StrikePrice)
|
||||
.Take(1)
|
||||
@@ -168,7 +168,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -59,9 +59,9 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
_spx = AddIndex("SPX", Resolution.Minute).Symbol;
|
||||
|
||||
// Select a index option expiring ITM, and adds it to the algorithm.
|
||||
_spxOption = AddIndexOptionContract(OptionChainProvider.GetOptionContractList(_spx, Time)
|
||||
.Where(x => x.ID.StrikePrice <= 4200m && x.ID.OptionRight == OptionRight.Put && x.ID.Date.Year == 2021 && x.ID.Date.Month == 1)
|
||||
.OrderByDescending(x => x.ID.StrikePrice)
|
||||
_spxOption = AddIndexOptionContract(OptionChain(_spx)
|
||||
.Where(contractData => contractData.ID.StrikePrice <= 4200m && contractData.ID.OptionRight == OptionRight.Put && contractData.ID.Date.Year == 2021 && contractData.ID.Date.Month == 1)
|
||||
.OrderByDescending(contractData => contractData.ID.StrikePrice)
|
||||
.Take(1)
|
||||
.Single(), Resolution.Minute).Symbol;
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
_spx = AddIndex("SPX", Resolution.Minute).Symbol;
|
||||
|
||||
// Select a index option expiring ITM, and adds it to the algorithm.
|
||||
_spxOption = AddIndexOptionContract(OptionChainProvider.GetOptionContractList(_spx, Time)
|
||||
_spxOption = AddIndexOptionContract(OptionChain(_spx)
|
||||
.Where(x => x.ID.StrikePrice <= 3200m && x.ID.OptionRight == OptionRight.Put && x.ID.Date.Year == 2021 && x.ID.Date.Month == 1)
|
||||
.OrderByDescending(x => x.ID.StrikePrice)
|
||||
.Take(1)
|
||||
@@ -167,7 +167,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 70;
|
||||
public int AlgorithmHistoryDataPoints => 69;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -128,7 +128,6 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
if (_futureContract == null)
|
||||
{
|
||||
_futureContract = futureChain.TradeBars.Values.FirstOrDefault().Symbol;
|
||||
return;
|
||||
}
|
||||
|
||||
if (futureChain.TradeBars.TryGetValue(_futureContract, out var value))
|
||||
@@ -153,23 +152,24 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
throw new RegressionTestException("At least one trade bar should have been found, but none was found");
|
||||
}
|
||||
|
||||
var backtestDays = (EndDate - StartDate).Days;
|
||||
var futureIndicator = new Identity("");
|
||||
var futureVolumeHistory = IndicatorHistory(futureIndicator, _futureContract, 200, Resolution.Daily, Field.Volume);
|
||||
var futureVolumeHistory = IndicatorHistory(futureIndicator, _futureContract, backtestDays, Resolution.Daily, Field.Volume);
|
||||
if (Math.Abs(futureVolumeHistory.Current.Select(x => x.Value).Where(x => x != 0).Average() - _futurePoints.Average()) > 0.001m)
|
||||
{
|
||||
throw new Exception("No history indicator future data point was found using Field.Volume selector!");
|
||||
throw new RegressionTestException($"No history indicator future data point was found using Field.Volume selector for {_futureContract}!");
|
||||
}
|
||||
|
||||
var volumeHistory = IndicatorHistory(_tradebarIndicatorHistory, _aapl, 109, Resolution.Daily, Field.Volume);
|
||||
if (Math.Abs(volumeHistory.Current.Select(x => x.Value).Average() - _aaplPoints.Average()) > 0.001m)
|
||||
{
|
||||
throw new Exception("No history indicator data point was found using Field.Volume selector!");
|
||||
throw new RegressionTestException($"No history indicator data point was found using Field.Volume selector for {_aapl}!");
|
||||
}
|
||||
|
||||
var bidCloseHistory = IndicatorHistory(_quotebarIndicatorHistory, _eurusd, 132, Resolution.Daily, Field.BidClose);
|
||||
if (Math.Abs(bidCloseHistory.Current.Select(x => x.Value).Average() - _eurusdPoints.Average()) > 0.001m)
|
||||
{
|
||||
throw new Exception("No history indicator data point was found using Field.BidClose selector!");
|
||||
throw new RegressionTestException($"No history indicator data point was found using Field.BidClose selector for {_eurusd}!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,12 +186,12 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 5983802;
|
||||
public long DataPoints => 1575423;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 354;
|
||||
public int AlgorithmHistoryDataPoints => 351;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
|
||||
_stock = AddEquity("GOOG").Symbol;
|
||||
|
||||
var contracts = OptionChainProvider.GetOptionContractList(_stock, UtcTime).ToList();
|
||||
var contracts = OptionChain(_stock).ToList();
|
||||
_option = contracts
|
||||
.Where(c => c.ID.OptionRight == OptionRight.Put)
|
||||
.OrderBy(c => c.ID.Date)
|
||||
@@ -176,7 +176,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all time slices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 1960;
|
||||
public long DataPoints => 1108;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 4490;
|
||||
public override long DataPoints => 2298;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 25;
|
||||
public int AlgorithmHistoryDataPoints => 7;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 522277;
|
||||
public long DataPoints => 20263;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 4490;
|
||||
public override long DataPoints => 2298;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 4490;
|
||||
public override long DataPoints => 2298;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 4490;
|
||||
public override long DataPoints => 2298;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 4490;
|
||||
public override long DataPoints => 2298;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 4490;
|
||||
public override long DataPoints => 2298;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 4490;
|
||||
public override long DataPoints => 2298;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 4490;
|
||||
public override long DataPoints => 2298;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 4490;
|
||||
public override long DataPoints => 2298;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 471124;
|
||||
public long DataPoints => 15012;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -171,7 +171,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Tracking Error", "0"},
|
||||
{"Treynor Ratio", "0"},
|
||||
{"Total Fees", "$9.10"},
|
||||
{"Estimated Strategy Capacity", "$1800000.00"},
|
||||
{"Estimated Strategy Capacity", "$2600000.00"},
|
||||
{"Lowest Capacity Asset", "GOOCV 30AKMEIPOSS1Y|GOOCV VP83T1ZUHROL"},
|
||||
{"Portfolio Turnover", "7.50%"},
|
||||
{"OrderListHash", "70487a4231ef2237ca24642be28652c4"}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using QuantConnect.Interfaces;
|
||||
using QuantConnect.Data.UniverseSelection;
|
||||
@@ -52,58 +51,45 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
|
||||
public override void OnSecuritiesChanged(SecurityChanges changes)
|
||||
{
|
||||
if (++_securitiesChangedCount == 1)
|
||||
{
|
||||
// This is the underlying security addition
|
||||
if (changes.AddedSecurities.Count != 1 || changes.RemovedSecurities.Count != 0)
|
||||
{
|
||||
throw new RegressionTestException("Unexpected security changes count: " +
|
||||
"on the first OnSecuritiesChanged callback, we expect only the underlying to be added.");
|
||||
}
|
||||
|
||||
if (changes.AddedSecurities[0].Symbol != _optionSymbol.Underlying)
|
||||
{
|
||||
throw new RegressionTestException("Unexpected security added: " +
|
||||
"on the first OnSecuritiesChanged callback, we expect only the underlying to be added.");
|
||||
}
|
||||
}
|
||||
else if (_securitiesChangedCount < 4)
|
||||
if (++_securitiesChangedCount < 3)
|
||||
{
|
||||
// This is the universe selection, which we expect to happen twice, on market open of each day
|
||||
|
||||
// Check the time
|
||||
var option = Securities[_optionSymbol];
|
||||
var exchangeHours = option.Exchange.Hours;
|
||||
var marketOpen = exchangeHours.GetNextMarketOpen(Time.Date, false);
|
||||
if (Time.AddMinutes(-1) != marketOpen)
|
||||
if (_securitiesChangedCount == 1)
|
||||
{
|
||||
throw new RegressionTestException($"Unexpected security changes time. Current time {Time}. Expected time: {marketOpen.AddMinutes(1)}");
|
||||
var underlying = changes.AddedSecurities.Where(security => security.Symbol == _optionSymbol.Underlying).SingleOrDefault();
|
||||
if (underlying == null)
|
||||
{
|
||||
throw new RegressionTestException("Unexpected security changes: on the first OnSecuritiesChanged callback, we expect the underlying to be added.");
|
||||
}
|
||||
}
|
||||
|
||||
// Check the changes
|
||||
if (changes.AddedSecurities.Count == 0)
|
||||
if (changes.AddedSecurities.Count <= 1)
|
||||
{
|
||||
throw new RegressionTestException("Unexpected security changes count: " +
|
||||
"on second and third OnSecuritiesChanged callbacks we expect options to be added");
|
||||
"on first and second OnSecuritiesChanged callbacks we expect options to be added");
|
||||
}
|
||||
|
||||
if (changes.AddedSecurities.Any(security => !security.Symbol.HasCanonical() || security.Symbol.Canonical != _optionSymbol))
|
||||
if (changes.AddedSecurities.Where(security => security.Symbol != _optionSymbol.Underlying)
|
||||
.Any(security => !security.Symbol.HasCanonical() || security.Symbol.Canonical != _optionSymbol))
|
||||
{
|
||||
throw new RegressionTestException("Unexpected security added: " +
|
||||
$"on second and third OnSecuritiesChanged callbacks we expect only {UnderlyingTicker} options to be added");
|
||||
$"on first and second OnSecuritiesChanged callbacks we expect only {UnderlyingTicker} options to be added");
|
||||
}
|
||||
|
||||
if (_securitiesChangedCount == 3)
|
||||
if (_securitiesChangedCount == 2)
|
||||
{
|
||||
// The options added the previous day should be removed
|
||||
if (changes.RemovedSecurities.Count != _previouslyAddedOptionsCount)
|
||||
{
|
||||
throw new RegressionTestException("Unexpected security changes count: " +
|
||||
"on the third OnSecuritiesChanged callback we expect the previous day selection to be removed.");
|
||||
"on the second OnSecuritiesChanged callback we expect the previous day selection to be removed.");
|
||||
}
|
||||
}
|
||||
|
||||
_previouslyAddedOptionsCount = changes.AddedSecurities.Count;
|
||||
// Subtract 1 to account for the underlying
|
||||
_previouslyAddedOptionsCount = changes.AddedSecurities.Count - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -113,7 +99,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
|
||||
public override void OnEndOfAlgorithm()
|
||||
{
|
||||
if (_securitiesChangedCount != 3)
|
||||
if (_securitiesChangedCount != 2)
|
||||
{
|
||||
throw new RegressionTestException($"Unexpected number of calls to OnSecuritiesChanged: {_securitiesChangedCount}. " +
|
||||
"We expect only 3 OnSecuritiesChanged callbacks for this algorithm");
|
||||
@@ -133,7 +119,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 1814313;
|
||||
public long DataPoints => 55702;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 471135;
|
||||
public long DataPoints => 15023;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Tracking Error", "0"},
|
||||
{"Treynor Ratio", "0"},
|
||||
{"Total Fees", "$11.50"},
|
||||
{"Estimated Strategy Capacity", "$8800000.00"},
|
||||
{"Estimated Strategy Capacity", "$13000000.00"},
|
||||
{"Lowest Capacity Asset", "GOOCV VP83T1ZUHROL"},
|
||||
{"Portfolio Turnover", "7580.62%"},
|
||||
{"OrderListHash", "5d8c976a405e1e5d1b19af0d1cdbf05d"}
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public virtual long DataPoints => 471135;
|
||||
public virtual long DataPoints => 15023;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -159,7 +159,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Tracking Error", "0"},
|
||||
{"Treynor Ratio", "0"},
|
||||
{"Total Fees", "$11.50"},
|
||||
{"Estimated Strategy Capacity", "$8800000.00"},
|
||||
{"Estimated Strategy Capacity", "$13000000.00"},
|
||||
{"Lowest Capacity Asset", "GOOCV VP83T1ZUHROL"},
|
||||
{"Portfolio Turnover", "7580.62%"},
|
||||
{"OrderListHash", "ea13456d0c97785f9f2fc12842831990"}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
SetCash(100000);
|
||||
Stock = AddEquity("GOOG", Resolution.Minute);
|
||||
|
||||
var contracts = OptionChainProvider.GetOptionContractList(Stock.Symbol, UtcTime).ToList();
|
||||
var contracts = OptionChain(Stock.Symbol).ToList();
|
||||
|
||||
PutOptionSymbol = contracts
|
||||
.Where(c => c.ID.OptionRight == OptionRight.Put)
|
||||
@@ -97,7 +97,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
|
||||
_goog = AddEquity("GOOG", Resolution.Minute);
|
||||
|
||||
var contracts = OptionChainProvider.GetOptionContractList(_goog.Symbol, UtcTime).ToList();
|
||||
var contracts = OptionChain(_goog.Symbol).ToList();
|
||||
|
||||
_googCall600Symbol = contracts
|
||||
.Where(c => c.ID.OptionRight == OptionRight.Call)
|
||||
@@ -271,7 +271,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 470437;
|
||||
public long DataPoints => 14325;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
127
Algorithm.CSharp/OptionChainFullDataRegressionAlgorithm.cs
Normal file
127
Algorithm.CSharp/OptionChainFullDataRegressionAlgorithm.cs
Normal file
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* 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.Linq;
|
||||
using QuantConnect.Data;
|
||||
using QuantConnect.Interfaces;
|
||||
using QuantConnect.Securities;
|
||||
|
||||
namespace QuantConnect.Algorithm.CSharp
|
||||
{
|
||||
/// <summary>
|
||||
/// Regression algorithm illustrating the usage of the <see cref="QCAlgorithm.OptionChain(Symbol)"/> method
|
||||
/// to get an option chain, which contains additional data besides the symbols, including prices, implied volatility and greeks.
|
||||
/// It also shows how this data can be used to filter the contracts based on certain criteria.
|
||||
/// </summary>
|
||||
public class OptionChainFullDataRegressionAlgorithm : QCAlgorithm, IRegressionAlgorithmDefinition
|
||||
{
|
||||
private Symbol _optionContract;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
SetStartDate(2015, 12, 24);
|
||||
SetEndDate(2015, 12, 24);
|
||||
SetCash(100000);
|
||||
|
||||
var goog = AddEquity("GOOG").Symbol;
|
||||
|
||||
_optionContract = OptionChain(goog)
|
||||
// Get contracts expiring within 10 days, with an implied volatility greater than 0.5 and a delta less than 0.5
|
||||
.Where(contractData => contractData.ID.Date - Time <= TimeSpan.FromDays(10) &&
|
||||
contractData.ImpliedVolatility > 0.5m &&
|
||||
contractData.Greeks.Delta < 0.5m)
|
||||
// Get the contract with the latest expiration date
|
||||
.OrderByDescending(x => x.ID.Date)
|
||||
.First();
|
||||
|
||||
AddOptionContract(_optionContract);
|
||||
}
|
||||
|
||||
public override void OnData(Slice slice)
|
||||
{
|
||||
// Do some trading with the selected contract for sample purposes
|
||||
if (!Portfolio.Invested)
|
||||
{
|
||||
MarketOrder(_optionContract, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Liquidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <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 virtual List<Language> Languages { get; } = new() { Language.CSharp, Language.Python };
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 1057;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
/// </summary>
|
||||
public AlgorithmStatus AlgorithmStatus => AlgorithmStatus.Completed;
|
||||
|
||||
/// <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 Orders", "210"},
|
||||
{"Average Win", "0%"},
|
||||
{"Average Loss", "0%"},
|
||||
{"Compounding Annual Return", "0%"},
|
||||
{"Drawdown", "0%"},
|
||||
{"Expectancy", "0"},
|
||||
{"Start Equity", "100000"},
|
||||
{"End Equity", "96041"},
|
||||
{"Net Profit", "0%"},
|
||||
{"Sharpe Ratio", "0"},
|
||||
{"Sortino Ratio", "0"},
|
||||
{"Probabilistic Sharpe Ratio", "0%"},
|
||||
{"Loss Rate", "0%"},
|
||||
{"Win Rate", "0%"},
|
||||
{"Profit-Loss Ratio", "0"},
|
||||
{"Alpha", "0"},
|
||||
{"Beta", "0"},
|
||||
{"Annual Standard Deviation", "0"},
|
||||
{"Annual Variance", "0"},
|
||||
{"Information Ratio", "0"},
|
||||
{"Tracking Error", "0"},
|
||||
{"Treynor Ratio", "0"},
|
||||
{"Total Fees", "$209.00"},
|
||||
{"Estimated Strategy Capacity", "$0"},
|
||||
{"Lowest Capacity Asset", "GOOCV W6U7PD1F2WYU|GOOCV VP83T1ZUHROL"},
|
||||
{"Portfolio Turnover", "85.46%"},
|
||||
{"OrderListHash", "a7ab1a9e64fe9ba76ea33a40a78a4e3b"}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
/// </summary>
|
||||
public int AlgorithmHistoryDataPoints => 0;
|
||||
public int AlgorithmHistoryDataPoints => 1;
|
||||
|
||||
/// <summary>
|
||||
/// Final status of the algorithm
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
|
||||
protected override OptionFilterUniverse Filter(OptionFilterUniverse filter)
|
||||
{
|
||||
return filter.BackMonth().Contracts(filter.Take(15));
|
||||
return filter.BackMonth().Contracts(contracts => contracts.Take(15));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 112808126;
|
||||
public long DataPoints => 2155693;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -33,8 +33,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
private bool _firstOnDataCallDone;
|
||||
private int _securityChangesCallCount;
|
||||
|
||||
private DateTime _selectionTimeUtc;
|
||||
|
||||
private bool _firstSelectionDone;
|
||||
private int _selectedOptionsCount;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -49,9 +48,14 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
|
||||
option.SetFilter(universe =>
|
||||
{
|
||||
if (_selectionTimeUtc == DateTime.MinValue)
|
||||
if (!_firstSelectionDone)
|
||||
{
|
||||
_selectionTimeUtc = universe.LocalTime.ConvertToUtc(option.Exchange.TimeZone);
|
||||
_firstSelectionDone = true;
|
||||
|
||||
if (universe.LocalTime.ConvertTo(option.Exchange.TimeZone, TimeZone) != StartDate)
|
||||
{
|
||||
throw new Exception("Option chain universe selection time was not the expected start date");
|
||||
}
|
||||
|
||||
if (_firstOnDataCallDone)
|
||||
{
|
||||
@@ -74,6 +78,11 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
|
||||
public override void OnData(Slice slice)
|
||||
{
|
||||
if (!IsMarketOpen(_optionSymbol.Underlying))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_firstOnDataCallDone)
|
||||
{
|
||||
_firstOnDataCallDone = true;
|
||||
@@ -92,51 +101,31 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
|
||||
public override void OnSecuritiesChanged(SecurityChanges changes)
|
||||
{
|
||||
Log($"{Time} :: {changes}");
|
||||
Debug($"{Time} :: {changes}");
|
||||
_securityChangesCallCount++;
|
||||
|
||||
if (_securityChangesCallCount <= 2 && _firstOnDataCallDone)
|
||||
{
|
||||
throw new RegressionTestException("Expected 2 OnSecuritiesChanged calls (Underlying addition + Options additions) " +
|
||||
"before the first data is sent to the algorithm");
|
||||
}
|
||||
|
||||
if (_securityChangesCallCount == 1)
|
||||
{
|
||||
// The first time, only the underlying should have been added
|
||||
if (changes.AddedSecurities.Count != 1 || changes.RemovedSecurities.Count != 0)
|
||||
if (changes.RemovedSecurities.Count != 0)
|
||||
{
|
||||
throw new RegressionTestException($"Unexpected securities changes on first OnSecuritiesChanged event. " +
|
||||
$"Expected one security added and none removed but got {changes.AddedSecurities.Count} securities added " +
|
||||
$"and {changes.RemovedSecurities.Count} removed.");
|
||||
$"Expected no removed securities but got {changes.RemovedSecurities.Count}.");
|
||||
}
|
||||
|
||||
var addedSecuritySymbol = changes.AddedSecurities.Single().Symbol;
|
||||
var addedSecuritySymbol = changes.AddedSecurities.SingleOrDefault(x => x.Symbol == _optionSymbol.Underlying).Symbol;
|
||||
if (addedSecuritySymbol != _optionSymbol.Underlying)
|
||||
{
|
||||
throw new RegressionTestException($"Expected to find {_optionSymbol.Underlying} in first OnSecuritiesChanged event, " +
|
||||
$"but found {addedSecuritySymbol}");
|
||||
}
|
||||
}
|
||||
else if (_securityChangesCallCount == 2)
|
||||
{
|
||||
var expectedSelectionTime = StartDate.Add(Securities[_optionSymbol].Resolution.ToTimeSpan());
|
||||
|
||||
if (_selectionTimeUtc == DateTime.MinValue)
|
||||
{
|
||||
throw new RegressionTestException("Option chain universe selection time was not set");
|
||||
throw new RegressionTestException($"Expected to find {_optionSymbol.Underlying} in first OnSecuritiesChanged event");
|
||||
}
|
||||
|
||||
if (changes.AddedSecurities.Count != _selectedOptionsCount || changes.RemovedSecurities.Count != 0)
|
||||
var addedOptions = changes.AddedSecurities
|
||||
.Where(x => x.Symbol.SecurityType == SecurityType.Option && x.Symbol.Canonical == _optionSymbol)
|
||||
.ToList();
|
||||
if (addedOptions.Count != _selectedOptionsCount || addedOptions.Count != changes.AddedSecurities.Count - 1)
|
||||
{
|
||||
throw new RegressionTestException($"Unexpected securities changes on second OnSecuritiesChanged event. " +
|
||||
$"Expected {_selectedOptionsCount} options added and none removed but got {changes.AddedSecurities.Count} " +
|
||||
$"securities added and {changes.RemovedSecurities.Count} removed.");
|
||||
}
|
||||
|
||||
if (!changes.AddedSecurities.All(x => x.Type.IsOption() && !x.Symbol.IsCanonical() && x.Symbol.Canonical == _optionSymbol))
|
||||
{
|
||||
throw new RegressionTestException($"Expected to find a multiple option contracts");
|
||||
throw new RegressionTestException($"Expected {_selectedOptionsCount} options to be added in the first OnSecuritiesChanged event, " +
|
||||
$"but found {addedOptions.Count}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,9 +137,9 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
throw new RegressionTestException("OnData was never called");
|
||||
}
|
||||
|
||||
if (_securityChangesCallCount < 2)
|
||||
if (_securityChangesCallCount != 1)
|
||||
{
|
||||
throw new RegressionTestException("OnSecuritiesChanged was not called at least twice");
|
||||
throw new RegressionTestException($"Expected OnSecuritiesChanged to be called once, but was actually called {_securityChangesCallCount} times");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +156,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 470437;
|
||||
public long DataPoints => 14325;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
private int _optionCount;
|
||||
private Symbol _lastEquityAdded;
|
||||
private Symbol _aapl;
|
||||
private int _onSecuritiesChangedCallCount;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -62,7 +63,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
}
|
||||
return universe.IncludeWeeklys()
|
||||
.BackMonth() // back month so that they don't get removed because of being delisted
|
||||
.Contracts(universe.Take(5));
|
||||
.Contracts(contracts => contracts.Take(5));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -100,9 +101,10 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
public override void OnSecuritiesChanged(SecurityChanges changes)
|
||||
{
|
||||
Debug($"{GetStatusLog()}. CHANGES {changes}");
|
||||
_onSecuritiesChangedCallCount++;
|
||||
if (Time.Day == 6)
|
||||
{
|
||||
if (Time.Hour != 0 && Time.Hour != 9)
|
||||
if (Time.Hour != 0)
|
||||
{
|
||||
throw new RegressionTestException($"Unexpected SecurityChanges time: {Time} {changes}");
|
||||
}
|
||||
@@ -112,7 +114,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
throw new RegressionTestException($"Unexpected removals: {changes}");
|
||||
}
|
||||
|
||||
if (Time.Hour == 0)
|
||||
if (_onSecuritiesChangedCallCount == 1)
|
||||
{
|
||||
// first we expect the equity to get Added
|
||||
if (changes.AddedSecurities.Count != 1 || changes.AddedSecurities[0].Symbol != _aapl)
|
||||
@@ -137,12 +139,9 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
throw new RegressionTestException($"Unexpected SecurityChanges time: {Time} {changes}");
|
||||
}
|
||||
|
||||
if (changes.AddedSecurities.Count != 0)
|
||||
{
|
||||
throw new RegressionTestException($"Unexpected additions: {changes}");
|
||||
}
|
||||
// Options can be selected/deselected on this day, but the equity should be removed
|
||||
|
||||
if (changes.RemovedSecurities.Count != 1 || changes.RemovedSecurities[0].Symbol != _aapl)
|
||||
if (changes.RemovedSecurities.Count == 0 || !changes.RemovedSecurities.Any(x => x.Symbol == _aapl))
|
||||
{
|
||||
throw new RegressionTestException($"Unexpected SecurityChanges: {changes}");
|
||||
}
|
||||
@@ -205,7 +204,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 921994;
|
||||
public long DataPoints => 17966;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 3541240;
|
||||
public long DataPoints => 19701;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -115,7 +115,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Total Orders", "1"},
|
||||
{"Average Win", "0%"},
|
||||
{"Average Loss", "0%"},
|
||||
{"Compounding Annual Return", "0.562%"},
|
||||
{"Compounding Annual Return", "0.524%"},
|
||||
{"Drawdown", "0.000%"},
|
||||
{"Expectancy", "0"},
|
||||
{"Start Equity", "100000"},
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public long DataPoints => 1033404;
|
||||
public long DataPoints => 49264;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 471135;
|
||||
public override long DataPoints => 15023;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 471135;
|
||||
public override long DataPoints => 15023;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -119,7 +119,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Tracking Error", "0"},
|
||||
{"Treynor Ratio", "0"},
|
||||
{"Total Fees", "$6.50"},
|
||||
{"Estimated Strategy Capacity", "$5500000.00"},
|
||||
{"Estimated Strategy Capacity", "$5400000.00"},
|
||||
{"Lowest Capacity Asset", "GOOCV WBGM95TAH2LI|GOOCV VP83T1ZUHROL"},
|
||||
{"Portfolio Turnover", "28.44%"},
|
||||
{"OrderListHash", "e9104f749ad7055346b26e6db3bdb437"}
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 471135;
|
||||
public override long DataPoints => 15023;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -118,7 +118,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Tracking Error", "0"},
|
||||
{"Treynor Ratio", "0"},
|
||||
{"Total Fees", "$7.15"},
|
||||
{"Estimated Strategy Capacity", "$33000000.00"},
|
||||
{"Estimated Strategy Capacity", "$45000000.00"},
|
||||
{"Lowest Capacity Asset", "GOOCV WBGM95TAH2LI|GOOCV VP83T1ZUHROL"},
|
||||
{"Portfolio Turnover", "6.17%"},
|
||||
{"OrderListHash", "8f1288896dafb2856b6045f8930e86a6"}
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 471135;
|
||||
public override long DataPoints => 15023;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
@@ -120,7 +120,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
{"Tracking Error", "0"},
|
||||
{"Treynor Ratio", "0"},
|
||||
{"Total Fees", "$9.75"},
|
||||
{"Estimated Strategy Capacity", "$1200000.00"},
|
||||
{"Estimated Strategy Capacity", "$1100000.00"},
|
||||
{"Lowest Capacity Asset", "GOOCV 306CZL2DIL4G6|GOOCV VP83T1ZUHROL"},
|
||||
{"Portfolio Turnover", "9.45%"},
|
||||
{"OrderListHash", "64e3480ee2ece70a3bb24bef3e7ecdd6"}
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 471135;
|
||||
public override long DataPoints => 15023;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace QuantConnect.Algorithm.CSharp
|
||||
/// <summary>
|
||||
/// Data Points count of all timeslices of algorithm
|
||||
/// </summary>
|
||||
public override long DataPoints => 471135;
|
||||
public override long DataPoints => 15023;
|
||||
|
||||
/// <summary>
|
||||
/// Data Points count of the algorithm history
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user