-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implements Calendar (Weekly/Monthly) Consolidator #3022
Implements Calendar (Weekly/Monthly) Consolidator #3022
Conversation
da3d247
to
c089df8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very beautiful and complete PR; just would like to discuss/review the API to minimize confusion and duplication
@@ -88,6 +88,14 @@ def Initialize(self): | |||
self.Consolidate("SPY", Resolution.Hour, self.HourBarHandler) | |||
self.Consolidate("EURUSD", Resolution.Daily, self.DailyEurUsdBarHandler) | |||
|
|||
# API convenience method for easily receiving weekly-consolidated data | |||
self.WeeklyConsolidate("SPY", self.CalendarTradeBarHandler) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's see if we can find a way to call this without adding these period methods to the API; maybe something like:
self.Consolidate("SPY", Calendar.Monthly, self.HourBarHandler)
Or self.Consolidate("SPY", Func<>, self.HourBarHandler)
which returns the endtime of the bar.
7af1dbc
to
2777f92
Compare
Implements consolidators that group bars by a calendar unit (week or month).
Replaces Enum `CalendarType` for static class with the same name. This class defines two properties (`Weekly` and `Monthly`) that can be used to define the previous calendar date (Monday or 1st of current month) which will correspont to the `Time` of a `IBaseData` object. Refactor `PeriodCountConsolidatorBase` to define use `GetRoundedBarTime` based on a period specification that depends on the constructor overload: `integer`, `TimeSpan` or `Func<DateTime, CalendarInfo>`. The last one can be set with the `CalendarType` properties.
2777f92
to
0202df3
Compare
Implements consolidators that group bars by a calendar unit (week or month).
Related Issue
Closes #3007 #3008
Motivation and Context
Weekly and monthly consolidator can be used to create a bar with one-week and one-month duration respectively.
Requires Documentation Change
Include examples of this consolidator.
How Has This Been Tested?
Unit tests
Types of changes
Checklist:
bug-<issue#>-<description>
orfeature-<issue#>-<description>