Skip to content
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

BUG: Fixed daily price ffill using today's close #2074

Merged
merged 3 commits into from
Jan 9, 2018
Merged

Conversation

richafrank
Copy link
Member

when we haven't seen any minute volume yet today

@richafrank
Copy link
Member Author

richafrank commented Jan 4, 2018

Will look into the py3 failures.

-edit- Fixed.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.06%) to 87.514% when pulling 9ea3ef9 on history-1d-ffill into 503fd34 on master.

# volume in today's minute bars yet, we need to use the
# previous day's ffilled daily price. Using today's daily price
# could yield a value from later today.
history_start -= pd.Timedelta(days=1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this isn't a trading calendar day?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the most recent close as of the weekend is the same as the most recent close as of Friday, I didn't bother to figure out which trading calendar to use here, especially if there are multiple assets. Do you think this breaks under certain conditions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it breaks here.

Where it would be relevant is if we had a calendar with a session spanning multiple days, but in practice, I do not think we have that concern.

@coveralls
Copy link

coveralls commented Jan 4, 2018

Coverage Status

Coverage increased (+0.002%) to 87.579% when pulling db36fa9 on history-1d-ffill into 503fd34 on master.

@coveralls
Copy link

coveralls commented Jan 4, 2018

Coverage Status

Coverage increased (+0.002%) to 87.579% when pulling 1c8e0ae on history-1d-ffill into 503fd34 on master.

self.assertEqual(len(window), bar_count)

if not day_idx and idx + 1 < 10:
self.assertTrue(np.isnan(window[-1]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't block on it, but I would recommend picking a few specific times and expected values, crafted to test each condition we expect. That would 1) speed up the test time 2) make the narrative of what is being tested and why more clear.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seconded 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! Updated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. In most cases I'd recommend the specific Timestamps, i.e. hardcoding pd.Timestamp('2017-01-09 10:44'); however since this test is iterating over multiple days, I agree with using the index to select the time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, in this case, I saw the important information as being the open or close or the temporal relationship to the open, etc, as opposed to exact times, so I represented them that way.

Copy link
Contributor

@ehebert ehebert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Contributor

@yankees714 yankees714 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

self.assertEqual(len(window), bar_count)

if not day_idx and idx + 1 < 10:
self.assertTrue(np.isnan(window[-1]))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seconded 👍

@coveralls
Copy link

coveralls commented Jan 8, 2018

Coverage Status

Coverage increased (+0.002%) to 87.579% when pulling 10ddc82 on history-1d-ffill into 503fd34 on master.

@richafrank richafrank merged commit 6ffd06b into master Jan 9, 2018
@richafrank richafrank deleted the history-1d-ffill branch January 9, 2018 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants