Compare commits

...

22 Commits
16609 ... 16632

Author SHA1 Message Date
Martin-Molinero
6351773a01 Option universe resolution improvements (#8324)
* Option universe improvements

- Improvement for resolution handling of option universes, affecting
  performance in live mode. Adding regression algorithm

* Minor fix for research test
2024-09-16 10:22:58 -03:00
Jhonathan Abreu
bf4b08e202 Fix: adjust option expiry reference date (#8322)
* Fix: adjust option expiry reference date

* Add universe files

* Update data and other minor changes

* Minor changes

* Add regression algorithm summary
2024-09-13 18:22:26 -04:00
Jhonathan Abreu
fa9ff399cc Euro Stoxx 50 Index and Index Futures support (#8278)
* EUREX data

EUREX data model and sample data

* Add EUREX futures expiry function and sample algorithms

* Add EuroStoxx50 futures map and factor files

* Reduce eurex data for repo

* Map eurex market to primary exchange

* Update Euro Stoxx 50 (FESX) map and factol files

* Update Euro Stoxx 50 (FESX) minute data

* Added EURSD data

* Added 2 basic FESX futures algorithms in CSharp and Python (#2)

* Add regression algorithms

* Update regression algorithms and data

* Minor change

* Cleanup

---------

Co-authored-by: paulius-an <118921953+paulius-an@users.noreply.github.com>
2024-09-12 10:00:16 -04:00
Jhonathan Abreu
16c4259342 Add QCAlgorithm.OptionChain() method to fetch option chains (#8316)
* Add new QCAlgorithm.OptionChain method to get full data option chain

* Add extension method to get canonical symbol

* Support future options in new OptionChain method

* Replace option chain provider with OptionChain method in some regression algorithms

* Add new regression algorithms for OptionChain method

* Replace option chain provider with OptionChain method in some regression algorithms

* Minor

* Cleanup

* Minor changes in regression algorithms

* Minor adjustments
2024-09-11 15:15:51 -04:00
Ricardo Andrés Marino Rojas
724d0b06a5 Add extra argument in QuantBook.UniverseHistory() for using an IDateRule (#8301)
* First draft of the solution

* Handle end date better

* Improve unit tests

* Add extra argument in missing method

* Nit change

* Nit change

* Nit change

* Undo changes to C# generic UniverseHistory()

* Address suggestions

* Improve unit test

* Add null checks

* Minor adjustment

---------

Co-authored-by: Martin Molinero <martin.molinero1@gmail.com>
2024-09-11 13:41:57 -03:00
Ricardo Andrés Marino Rojas
ba7fe05574 Add BeforeMarketOpen() and AfterMarketClose() date rules (#8311)
* First draft of the solution

* Add unit tests

* Improve unit tests

* Nit changes
2024-09-10 15:56:31 -03:00
Ricardo Andrés Marino Rojas
50437946e2 Add missing end_date in python regression algorithm (#8315) 2024-09-10 14:33:44 -03:00
Ricardo Andrés Marino Rojas
418970bb48 Add TravisExclude category to failing CI unit test (#8313) 2024-09-10 13:25:41 -03:00
Roman Yavnikov
bef045a360 Fix: Get GroupOrders ByBrokerageId (#8310)
* fix: Get GroupOrders ByBrokerageId

* test:feat: return all combo orders with the same brokerageId
2024-09-10 13:25:22 -03:00
Jhonathan Abreu
49bf436aa2 Remove Lean path info from runtime exceptions (#8309)
* Strip lean path info from runtime exceptions

* Minor fix
2024-09-09 17:54:29 -04:00
Jhonathan Abreu
e29bb2c5e0 File-based options universe (#8212)
* Initial options universe with greeks implementation

* Options universe improvements

* Address peer review

* File based options universe fixes and improvements.

- Adjust OptionUniverse start-end times and period.
- Adapt unit tests and some algorithms to pass with new options universe selection.

* Updated options regression algorithms stats for new universe data

* Updated options regression algorithms stats for new universe data

* Updated options regression algorithms stats for new universe data

* Updated options regression algorithms stats for new universe data

* Updated options regression algorithms stats for new universe data

* Option chain provider with new options universe

* Allow canonical option history requests

* Address peer review

* Address peer review

* Fix symbols parsing in OptionUniverse

* Fix universe selection subscriptions start time to not include extended market hours

* Minor changes

* Minor changes

* Peer recommended changes and fixes

* Update regression algorithm stats

* Update regression algorithms stats and minor fixes

* Fix option chain provider history request

* Round option indicators values

* Added option universe csv header property

* Update regression algorithms stats

* Update regression algorithms stats

* Data fixes and regression algos stats update

* Unit test fixes

* Minor changes

* Option chain handling in live trading data feed

* Minor changes

* Added processed data provider

* Fix thread-safety violation in Slice class

* Minor change

* Update options filter universe API to use OptionUniverse data

Add new filter methods for greeks, IV and open interest

* Option filter universe api updates

* Add OptionUniverse history regression algorithms

* Add regression algorithms for new options filter universe api methods

* Added options greeks data and updated regression algorithms

* Address peer review

* Address peer review

* Add more assertions to new options filter api regression algorithms

* Minor performance improvement.

Reduce greeks binomial model steps to 140

* Minor tests updates

* Greeks numerical models performance improvements

* Greeks numerical models performance improvements

* Revert array pool change for option pricing numerical models

* Update default dividend yield provider depending on option type

* [TEST]

* Add helper method con calculate time till expiration

* Use double in price option numerical models

* Implied volatility calculation improvements

- Adjust root finding method accuracy as a factor of the option price
- Use BSM to get a first guess

* Cleanup

* Some regression algorithms and unit tests cleanup

* Regression tests updates after rebasing from master

* Add universe files

* Self review and cleanup

* Minor regression tests updates after rebase

* Fix: set data time zone to same as exchange tz for options universes

* Minor change

* Minor change

* Fix for live trading options universe selection

* Keep underlying when aggregating collections in BaseDataCollectionAggregatorEnumerator

* Update index options regression algorithms stats

* Minor change

* Address peer review

* Memory usage improvements

* Minor build fix

* Minor changes and test fixes

* Cache symbols in OptionUniverse

* Cleanup

* Fix index option creation in OptionUniverse

* Use cached underlying SID when parsing from string

* Abstract symbols cache to BaseDataCollection

* Return actual underlying symbol when mapping decomposing ICO ticker

* Address peer review

* Minor performance improvements reduce garbage

* Limit Symbols and SIDs cache size to help with memory usage

* Minor fix in symbols and sid cache cleanup

* Build fix

* Lazily parse greeks on individual access

* Cleanup and tests

* Address peer review

* Minor greeks fix

---------

Co-authored-by: Martin Molinero <martin.molinero1@gmail.com>
2024-09-09 12:39:31 -03:00
Dennis Yemelyanov
8fcc9f7d4e fix some comments for option security types (#8304) 2024-09-09 11:37:26 -03:00
Andy Geach
5209332074 Update readme.md to remove references to Visual Studio for Mac, which has been discontinued (#8298) 2024-09-06 11:59:28 -03:00
Roman Yavnikov
adfad475cc Feature:TradeStationBrokerage: support ComboMarket && ComboLimit (#8290)
* refactor: adding OrderId in GroupOrderManger

* feat: new support of OrderTypes in TradeStationBrokerageModel
feat: unSupported OrderTypes in CanUpdateOrder's TradeStationBrokerageModel

* feat: AllOrNone property in TradeStationOrderProperties

* feat: unsupported SubmitCrossZero of Combo Order in TSBrokerageModel

* test:feat: submit / update CrossZero Combo Orders

* feat: new Message Brokerage error message
refactor: use new Message in TradeStationBrokerageModel

* feat: setter of Id in GroupOrderManager

* feat: new constructor of GroupOrderManager

* feat: develop GroupOrderCacheManager service

* fix: groupOrderManger.Id in OrderProvider

* fix: incrementOrderGroupOrderManagerID in BrokerageTransactionHandler
feat: add _groupOrderManagerId in OrderProvider

* remove: extra semicolon

* refactor: prevent increment GroupOrderID

* feat: add new Exchanges

* feat: Try Get Group Combo Orders extension

* refactor: ComboORderType in TSBrokerageModel

* remove: implementing of prop ID in GroupOrderManager

* refactor: UnsupportedCrossZeroByOrderType message

* fix: warning of UnsupportedCrossZeroByOrderType

* fix: several exchanges code based on tradier docs
https://documentation.tradier.com/brokerage-api/reference/exchanges

* feat: add missed Exchange in Global class

* refactor: possible update LimitPrice in TSBrokerageModel
test:feat: validate upddate LimitPrice of ComboLimit Order

* refactor: GroupOrderCacheManager
remove: TryGetGroupCachedOrders from extension

* refactor: exchange SPHR to MIAX_SAPPHIRE

* remove: Exchange BYX cuz It is BATS_Y

* refactor: change position of Exchange C2

* refactor: change constructor's access modifier in class Exchange
2024-09-06 10:31:14 -03:00
Martin-Molinero
21fcadf0f8 Ignore failing live future option unit test (#8300) 2024-09-05 16:42:42 -03:00
Ricardo Andrés Marino Rojas
e893e67e9b Throw exception when base currency not found (#8289)
* First draft of the solution

* The same check for crytpo is done before

* Fix failing unit tests

* Remove non perpetual crypto futures from SPDB

* Address requests

* Fix failing unit tests
2024-09-04 12:14:53 -03:00
Alexandre Catarino
3b588d04fb Adds Overload to AddIndexOption (#8291)
* Adds Overload to AddIndexOption

Simplify usage. We don't need to create/add the underlying explicitly, see AddIndexOption(string, Resolution, string, bool) overload.

* Addresses Peer-Review

- Default market is `null` instead of `Market.USA` allowing for `BrokerageModel` setup.
- `AddIndexOption` and `AddIndexOptionContract` methods now return `indexOption` objects.

* Fixes Logic Bug
2024-09-04 10:30:05 -03:00
Ricardo Andrés Marino Rojas
e81bcbb987 Improve PythonIndicator.IsReady implementation (#8287)
* First draft of the solution

* nit change

* Add improvements

* Fix failing unit tests

* Add improvements
2024-09-04 10:07:13 -03:00
Roman Yavnikov
96e91b446d Fix: #8226, update spdb binance/binanceus (#8293)
* feature: update binance spdb data

* feature: update binanceus spdb data

* test:fix: EURUSDC stable coins conversation
2024-09-04 10:05:07 -03:00
Ricardo Andrés Marino Rojas
403f0348bd Update Bybit SPDB (#8294)
* Update Bybit SPDB

* Remove trailing comma
2024-09-03 17:55:12 -03:00
Ricardo Andrés Marino Rojas
eeeb310438 Update minimum price variation of some entries of CME futures in SPDB (#8288)
* Update some entries of CME futures in SPDB

* Adjust 6B minimum price variation
2024-08-28 19:59:40 -03:00
oussamanahdi
271f0bb08e Update readme.md (#8286) 2024-08-26 19:11:04 -03:00
376 changed files with 66664 additions and 1728 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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;

View File

@@ -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)
{

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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"}
};
}
}

View File

@@ -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

View File

@@ -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"},

View 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"}
};
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -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"}

View File

@@ -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"}

View File

@@ -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

View File

@@ -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

View File

@@ -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"},

View File

@@ -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"}
};
}
}

View File

@@ -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"},

View File

@@ -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"}
};
}

View File

@@ -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

View File

@@ -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"}
};

View File

@@ -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

View File

@@ -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

View File

@@ -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"}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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[]

View File

@@ -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)

View File

@@ -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)

View File

@@ -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;

View File

@@ -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();

View File

@@ -22,7 +22,7 @@ namespace QuantConnect.Algorithm.CSharp
{
public class FutureOptionIndicatorsRegressionAlgorithm : OptionIndicatorsRegressionAlgorithm
{
protected override string ExpectedGreeks { get; set; } = "Implied Volatility: 0.14089,Delta: 0.6308,Gamma: 0.00207,Vega: 5.61431,Theta: -0.48816,Rho: 0.02962";
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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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

View File

@@ -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>

View File

@@ -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

View File

@@ -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

View File

@@ -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>

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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"}
};
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -186,7 +186,7 @@ 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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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"}

View File

@@ -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

View File

@@ -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

View File

@@ -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"}

View File

@@ -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"}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View 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"}
};
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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"},

View File

@@ -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

View File

@@ -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

View File

@@ -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"}

View File

@@ -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"}

View File

@@ -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"}

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -75,7 +75,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
@@ -115,7 +115,7 @@ namespace QuantConnect.Algorithm.CSharp
{"Tracking Error", "0"},
{"Treynor Ratio", "0"},
{"Total Fees", "$4.50"},
{"Estimated Strategy Capacity", "$5500000.00"},
{"Estimated Strategy Capacity", "$5400000.00"},
{"Lowest Capacity Asset", "GOOCV WBGM95TAH2LI|GOOCV VP83T1ZUHROL"},
{"Portfolio Turnover", "28.20%"},
{"OrderListHash", "a67da2b19b248ab78686660793ddff73"}

View File

@@ -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

Some files were not shown because too many files have changed in this diff Show More