Skip to content

Fill Model Don't Account IOrderPropeties.OutsideRegularTradingHours #9476

Open

Description

@AlexCatarino

Expected Behavior

If the data susbcription includes extended market hours, but the order property OutsideRegularTradingHours is false, the orders can't be filled.

Actual Behavior

OutsideRegularTradingHours is not accounted for.

namespace QuantConnect.Algorithm.CSharp
{
    public class GeekyRedDogfish : QCAlgorithm
    {

        public override void Initialize()
        {
            SetStartDate(2026, 5, 5);
            SetEndDate(2026, 5, 5);
            SetCash(100000);

            AddEquity("SPY", Resolution.Minute, extendedMarketHours: true);
        }

        public override void OnData(Slice data)
        {
            foreach (var kvp in data.Bars)
            {
                var symbol = kvp.Key;
                if (Time.TimeOfDay == new TimeSpan(9, 29, 0))
                {
                    OrderProperties prop = new TradeStationOrderProperties
                    {
                        TimeInForce = TimeInForce.Day,
                        OutsideRegularTradingHours = false,
                    };
                    var stopOrder = StopMarketOrder(
                            symbol,
                            10,
                            1.0m,
                            tag: "my tag",
                            orderProperties: prop
                        );
                }
            }
        }
    }
}

Potential Solution

N/A

Checklist

  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues

Activity

  1. jaredbroad commented on Oct 28, 2026

    @jaredbroad
    Member

    Work transferred from PR #9483

    Respect outside regular hours in fill models by @aiSynergy37, branch aiSynergy37:bug-9476-respect-regular-hours, head 47d3e94a2.
    PR: #9483

    The PR is being closed to tidy up the queue; the proposed change is recorded here for review and can be reopened or re-submitted once the approach is agreed.

    Changed files (3 files, +92/-11):

    • Common/Orders/Fills/EquityFillModel.cs (+5/-5)
    • Common/Orders/Fills/FillModel.cs (+55/-6)
    • Tests/Common/Orders/Fills/EquityFillModelTests.StopMarketFill.cs (+32/-0)
    PR description

    Description

    Updates fill eligibility to respect order-level outside regular trading hours settings when the order properties expose that setting. This prevents extended-hours subscriptions from filling orders that explicitly disallow outside regular trading hours.

    The shared exchange-open helper now applies the order property override before checking market hours, and short bars no longer use the large-bar boundary fallback when the exchange is closed at the order time.

    Related Issue

    Fixes #9476

    Motivation and Context

    A stop market order submitted during pre-market data could fill when the subscription had extended market hours enabled, even if the order property set OutsideRegularTradingHours = false.

    Requires Documentation Change

    No

    How Has This Been Tested?

    • dotnet build Tests\QuantConnect.Tests.csproj --no-restore -v minimal /p:RunAnalyzers=false
    • Added a regression test covering both allowed and disallowed outside-regular-hours stop market fills.

    Types of Changes

    • Bug fix
    • Tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions