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

Fix daily bar writer #1330

Merged
merged 1 commit into from Jul 15, 2016

Conversation

Projects
None yet
3 participants
@jbredeche
Member

jbredeche commented Jul 15, 2016

Make daily bar readers take advantage of the TradingCalendar.

Make USEquityPricingLoader use the same calendar.

Both the reader and writer were updated, but the reader maintains backwards compatibility. The test examples have not had their data updated, to ensure that we can read old data.

@jbredeche

This comment has been minimized.

Member

jbredeche commented Jul 15, 2016

@@ -204,9 +189,34 @@ class BcolzDailyBarWriter(object):
'volume': float64,
}
def __init__(self, filename, sessions, calendar):
def __init__(self, filename, calendar, start_session, end_session):
"""

This comment has been minimized.

@ssanderson

ssanderson Jul 15, 2016

Member

Why did we move this docstring? The convention pretty much everywhere I've seen is to put the docs for __init__ at the top of the class.

This comment has been minimized.

@jbredeche

jbredeche Jul 15, 2016

Member

Including the parameters to __init__? Seems strange to have them separate from the method that uses them.

This comment has been minimized.

@jbredeche

jbredeche Jul 15, 2016

Member

I'll move it back.

@jbredeche jbredeche force-pushed the fix-daily-bar-writer branch from f65298d to 8308d6a Jul 15, 2016

full_table.attrs['first_row'] = first_row
full_table.attrs['last_row'] = last_row
full_table.attrs['calendar_offset'] = calendar_offset
full_table.attrs['calendar'] = sessions.asi8.tolist()
full_table.attrs['calendar_str'] = self._calendar.name

This comment has been minimized.

@ssanderson

ssanderson Jul 15, 2016

Member

I might call this 'calendar_name'?

@@ -474,7 +497,20 @@ def _table(self):
@lazyval
def _calendar(self):

This comment has been minimized.

@ssanderson

ssanderson Jul 15, 2016

Member

Should we rename this to sessions or something like it? It's confusing to have both _calendar and trading_calendar.

@@ -387,6 +402,10 @@ def spot_price(self, sid, day, colname):
def last_available_dt(self):
pass
@abstractproperty
def trading_calendar(self):

This comment has been minimized.

@ssanderson

ssanderson Jul 15, 2016

Member

Can we document what's expected to be provided by subclasses here?

This comment has been minimized.

@jbredeche

jbredeche Jul 15, 2016

Member

yup, did so

@coveralls

This comment has been minimized.

coveralls commented Jul 15, 2016

Coverage Status

Coverage increased (+0.02%) to 83.678% when pulling 8308d6a on fix-daily-bar-writer into e0f6abd on master.

Clean up daily bar reader/writer to take advantage of new trading cal…
…endar. The reader

is backwards-compatible with the previous format.

In USEquityLoader, use dailyreader's trading_calendar.

This is backwards compatible and will fall back to the NYSE calendar if
the reader doesn’t have a calendar specified.

@jbredeche jbredeche force-pushed the fix-daily-bar-writer branch from 8308d6a to 5a0f840 Jul 15, 2016

@coveralls

This comment has been minimized.

coveralls commented Jul 15, 2016

Coverage Status

Coverage increased (+0.02%) to 83.678% when pulling 5a0f840 on fix-daily-bar-writer into e0f6abd on master.

@jbredeche jbredeche merged commit 5f09203 into master Jul 15, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@jbredeche jbredeche deleted the fix-daily-bar-writer branch Jul 15, 2016

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