QuantConnect / Lean

Lean Algorithmic Trading Engine by QuantConnect (Python, C#)
https://lean.io
Apache License 2.0
9.55k stars 3.23k forks source link

Add BeforeMarketOpen() and AfterMarketClose() date rules #8311

Closed Marinovsky closed 2 weeks ago

Marinovsky commented 2 weeks ago

Description

Add BeforeMarketOpen() and AfterMarketClose() date rules using the already implemented AfterMarketOpen() and BeforeMarketClose() date rules.

Related Issue

Closes #8106

Motivation and Context

With this change users will be able to use a date rule that fires $x$ number of minutes before the market opens or $x$ number of minutes after the market closes.

Requires Documentation Change

This change might require a change to documentation briefing the users on this new feature.

How Has This Been Tested?

I created two unit tests, one using BeforeMarketOpen() and the other AfterMarketClose(), that assert the even times created with the time rules are the expected ones.

Types of changes

Checklist: