62d63010ab
Python Virtual Environments / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
* Convert daily resolution market orders to MarketOnClose/MarketOnOpen A market order placed intraday (e.g. through a scheduled event) on an asset subscribed only at daily resolution has no fresh intraday price to fill against, so it was filling at the stale previous daily close. This is common when mixing daily resolution assets with minute resolution assets or intraday scheduled events. QCAlgorithm.MarketOrder now converts these orders so they fill at a real daily open/close instead of the stale previous close: - market closed (any resolution): MarketOnOpen, as before - market open, daily-only subscription: MarketOnClose (today's close), or MarketOnOpen (next open) when already within the MarketOnClose submission buffer near the close Assets with intraday data are left untouched, and the conversion is only applied in backtesting; in live trading an open-market market order fills at the real current price. Adds DailyResolutionMarketOrderConversionRegressionAlgorithm covering the MarketOnClose and MarketOnOpen conversion paths plus a minute resolution asset that is correctly left as a regular market order. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Minor fix * Reword conversion warning: "current market price" instead of "real current price" Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Update regression stats affected by daily market order conversion Daily-resolution market orders placed intraday are now converted to MarketOnClose/MarketOnOpen so they fill at a real daily open/close instead of the stale previous close. This shifts the affected fills: - IndexOptionCall{ITM,OTM}ExpiryDaily: the SPX option entry, placed one minute after the open, now fills at the daily close. Same economics, one extra data point and a new order list hash. - AllShortableSymbols (C# + Python): an intraday order's type changed from Market to a converted order; identical End Equity, new hash. - ResolutionSwitchingAlgorithm sampling test: the RemoveSecurity liquidation (fired at 15:50) previously filled at the stale previous close; it now converts, shifting the equity/performance samples. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Revert expected data point count change --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
84 lines
3.2 KiB
C#
84 lines
3.2 KiB
C#
/*
|
|
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
|
|
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
using System.Collections.Generic;
|
|
|
|
namespace QuantConnect.Algorithm.CSharp
|
|
{
|
|
/// <summary>
|
|
/// This regression algorithm tests In The Money (ITM) index option expiry for calls using daily resolution.
|
|
/// </summary>
|
|
public class IndexOptionCallITMExpiryDailyRegressionAlgorithm : IndexOptionCallITMExpiryRegressionAlgorithm
|
|
{
|
|
protected override Resolution Resolution => Resolution.Daily;
|
|
|
|
public override void Initialize()
|
|
{
|
|
Settings.DailyPreciseEndTime = true;
|
|
base.Initialize();
|
|
}
|
|
|
|
/// <summary>
|
|
/// This is used by the regression test system to indicate which languages this algorithm is written in.
|
|
/// </summary>
|
|
public override List<Language> Languages { get; } = new() { Language.CSharp };
|
|
|
|
/// <summary>
|
|
/// Data Points count of all timeslices of algorithm
|
|
/// </summary>
|
|
public override long DataPoints => 196;
|
|
|
|
/// <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>
|
|
public override Dictionary<string, string> ExpectedStatistics => new Dictionary<string, string>
|
|
{
|
|
{"Total Orders", "2"},
|
|
{"Average Win", "10.27%"},
|
|
{"Average Loss", "0%"},
|
|
{"Compounding Annual Return", "301.565%"},
|
|
{"Drawdown", "0.300%"},
|
|
{"Expectancy", "0"},
|
|
{"Start Equity", "100000"},
|
|
{"End Equity", "110274"},
|
|
{"Net Profit", "10.274%"},
|
|
{"Sharpe Ratio", "5.291"},
|
|
{"Sortino Ratio", "384.846"},
|
|
{"Probabilistic Sharpe Ratio", "88.621%"},
|
|
{"Loss Rate", "0%"},
|
|
{"Win Rate", "100%"},
|
|
{"Profit-Loss Ratio", "0"},
|
|
{"Alpha", "1.833"},
|
|
{"Beta", "-0.228"},
|
|
{"Annual Standard Deviation", "0.345"},
|
|
{"Annual Variance", "0.119"},
|
|
{"Information Ratio", "4.653"},
|
|
{"Tracking Error", "0.383"},
|
|
{"Treynor Ratio", "-7.99"},
|
|
{"Total Fees", "$0.00"},
|
|
{"Estimated Strategy Capacity", "$0"},
|
|
{"Lowest Capacity Asset", "SPX XL80P3GHIA9A|SPX 31"},
|
|
{"Portfolio Turnover", "1.90%"},
|
|
{"Drawdown Recovery", "9"},
|
|
{"OrderListHash", "b2fd77dc3263ae6b61f9940fc2370235"}
|
|
};
|
|
}
|
|
}
|