-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
MAINT: Pass asset instead of sid to dispatch reader. #2114
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -96,7 +96,7 @@ def get_rolls(self, root_symbol, start, end, offset): | |
else: | ||
first = front | ||
first_contract = oc.sid_to_contract[first] | ||
rolls = [((first_contract >> offset).contract.sid, None)] | ||
rolls = [((first_contract >> offset).contract, None)] | ||
tc = self.trading_calendar | ||
sessions = tc.sessions_in_range(tc.minute_to_session_label(start), | ||
tc.minute_to_session_label(end)) | ||
|
@@ -115,7 +115,7 @@ def get_rolls(self, root_symbol, start, end, offset): | |
session = sessions[-1] | ||
|
||
while session > start and curr is not None: | ||
front = curr.contract.sid | ||
front = curr.contract | ||
back = rolls[0][0] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at the uses of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Related to that, any concerns that |
||
prev_c = curr.prev | ||
while session > start: | ||
|
@@ -127,7 +127,7 @@ def get_rolls(self, root_symbol, start, end, offset): | |
# TODO: Instead of listing each contract with its roll date | ||
# as tuples, create a series which maps every day to the | ||
# active contract on that day. | ||
rolls.insert(0, ((curr >> offset).contract.sid, session)) | ||
rolls.insert(0, ((curr >> offset).contract, session)) | ||
break | ||
session = prev | ||
curr = curr.prev | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -221,14 +221,14 @@ def _get_adjustments_in_range(self, cf, dts, field): | |
adjs = {} | ||
|
||
for front, back in sliding_window(2, rolls): | ||
front_sid, roll_dt = front | ||
back_sid = back[0] | ||
front_contract, roll_dt = front | ||
back_contract = back[0] | ||
dt = tc.previous_session_label(roll_dt) | ||
if self._frequency == 'minute': | ||
dt = tc.open_and_close_for_session(dt)[1] | ||
roll_dt = tc.open_and_close_for_session(roll_dt)[0] | ||
partitions.append((front_sid, | ||
back_sid, | ||
partitions.append((front_contract, | ||
back_contract, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we remove the calls to |
||
dt, | ||
roll_dt)) | ||
for partition in partitions: | ||
|
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.
Thinking about the change in return value of this function (
get_rolls
),rolls
above?VolumeRollFinder.get_contract_center
thinks it's still getting sids and callsretrieve_asset
on them.sid
toasset
in the unpacking of rolls from the call sites in[ContinuousFutureMinuteBarReader|ContinuousFutureSessionBarReader].load_raw_arrays
like you did inhistory_loader.py
below ?