Skip to content

Commit

Permalink
Merge pull request #1093 from quantopian/finish-dividends-in-pipeline
Browse files Browse the repository at this point in the history
MAINT: add dividends datasets to inits
  • Loading branch information
Maya Tydykov committed Mar 29, 2016
2 parents 6a24731 + d7a012a commit 3b71111
Show file tree
Hide file tree
Showing 12 changed files with 69 additions and 16 deletions.
18 changes: 18 additions & 0 deletions docs/source/whatsnew/0.8.5.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,30 @@ Enhancements
blaze-based implementations can be found in
:mod:`zipline.pipeline.loaders.blaze.buyback_auth`. (:issue:`1022`).

* Added new datasets
:class:`~zipline.pipeline.data.dividends.DividendsByExDate`,
:class:`~zipline.pipeline.data.dividends.DividendsByPayDate`, and
:class:`~zipline.pipeline.data.dividends.DividendsByAnnouncementDate`
for use in the Pipeline API. These datasets provide an abstract interface for
adding dividends data organized by ex date, pay date, and announcement date,
respectively, to a new algorithm. pandas-based reference implementations for
these datasets can be found in :mod:`zipline.pipeline.loaders.dividends`, and
experimental blaze-based implementations can be found in
:mod:`zipline.pipeline.loaders.blaze.dividends`. (:issue:`1093`).

* Added new built-in factors,
:class:`zipline.pipeline.factors.BusinessDaysSinceCashBuybackAuth` and
:class:`zipline.pipeline.factors.BusinessDaysSinceShareBuybackAuth`. These
factors use the new ``CashBuybackAuthorizations`` and
``ShareBuybackAuthorizations`` datasets, respectively. (:issue:`1022`).

* Added new built-in factors,
:class:`zipline.pipeline.factors.BusinessDaysSinceDividendAnnouncement`,
:class:`zipline.pipeline.factors.BusinessDaysUntilNextExDate`, and
:class:`zipline.pipeline.factors.BusinessDaysSincePreviousExDate`. These
factors use the new ``DividendsByAnnouncementDate` and ``DividendsByExDate``
datasets, respectively. (:issue:`1093`).

* Implemented :class:`zipline.pipeline.Classifier`, a new core pipeline API
term representing grouping keys. Classifiers are primarily used by passing
them as the ``groupby`` parameter to factor normalization methods.
Expand Down
8 changes: 8 additions & 0 deletions zipline/pipeline/data/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
from .buyback_auth import CashBuybackAuthorizations, ShareBuybackAuthorizations
from .dividends import (
DividendsByAnnouncementDate,
DividendsByExDate,
DividendsByPayDate,
)
from .earnings import EarningsCalendar
from .equity_pricing import USEquityPricing
from .dataset import DataSet, Column, BoundColumn
Expand All @@ -8,6 +13,9 @@
'CashBuybackAuthorizations',
'Column',
'DataSet',
'DividendsByAnnouncementDate',
'DividendsByExDate',
'DividendsByPayDate',
'EarningsCalendar',
'ShareBuybackAuthorizations',
'USEquityPricing',
Expand Down
6 changes: 6 additions & 0 deletions zipline/pipeline/factors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
)
from .events import (
BusinessDaysSinceCashBuybackAuth,
BusinessDaysSinceDividendAnnouncement,
BusinessDaysUntilNextExDate,
BusinessDaysSincePreviousExDate,
BusinessDaysUntilNextEarnings,
BusinessDaysSincePreviousEarnings,
BusinessDaysSinceShareBuybackAuth,
Expand All @@ -25,6 +28,9 @@

__all__ = [
'BusinessDaysSinceCashBuybackAuth',
'BusinessDaysSinceDividendAnnouncement',
'BusinessDaysUntilNextExDate',
'BusinessDaysSincePreviousExDate',
'BusinessDaysUntilNextEarnings',
'BusinessDaysSincePreviousEarnings',
'BusinessDaysSinceShareBuybackAuth',
Expand Down
10 changes: 4 additions & 6 deletions zipline/pipeline/factors/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@
announcements, acquisitions, dividends, etc.).
"""
from numpy import newaxis
from zipline.pipeline.data.buyback_auth import (
from ..data import (
CashBuybackAuthorizations,
ShareBuybackAuthorizations
)
from zipline.pipeline.data.dividends import (
ShareBuybackAuthorizations,
DividendsByAnnouncementDate,
DividendsByExDate
DividendsByExDate,
EarningsCalendar
)
from zipline.pipeline.data.earnings import EarningsCalendar
from zipline.utils.numpy_utils import (
NaTD,
busday_count_mask_NaT,
Expand Down
14 changes: 14 additions & 0 deletions zipline/pipeline/loaders/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
from .earnings import EarningsCalendarLoader
from .buyback_auth import (
CashBuybackAuthorizationsLoader,
ShareBuybackAuthorizationsLoader
)
from .dividends import (
DividendsByAnnouncementDateLoader,
DividendsByExDateLoader,
DividendsByPayDateLoader,
)
from .equity_pricing_loader import USEquityPricingLoader

__all__ = [
'CashBuybackAuthorizationsLoader',
'DividendsByAnnouncementDateLoader',
'DividendsByExDateLoader',
'DividendsByPayDateLoader',
'EarningsCalendarLoader',
'ShareBuybackAuthorizationsLoader',
'USEquityPricingLoader',
]
9 changes: 8 additions & 1 deletion zipline/pipeline/loaders/blaze/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@
from_blaze,
global_loader,
)

from .dividends import (
BlazeDividendsByAnnouncementDateLoader,
BlazeDividendsByExDateLoader,
BlazeDividendsByPayDateLoader
)
from .earnings import (
BlazeEarningsCalendarLoader,
)

__all__ = (
'BlazeCashBuybackAuthorizationsLoader',
'BlazeDividendsByAnnouncementDateLoader',
'BlazeDividendsByExDateLoader',
'BlazeDividendsByPayDateLoader',
'BlazeEarningsCalendarLoader',
'BlazeLoader',
'BlazeShareBuybackAuthorizationsLoader',
Expand Down
8 changes: 5 additions & 3 deletions zipline/pipeline/loaders/blaze/buyback_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
CASH_FIELD_NAME,
SHARE_COUNT_FIELD_NAME
)
from zipline.pipeline.data import (CashBuybackAuthorizations,
ShareBuybackAuthorizations)
from zipline.pipeline.loaders.buyback_auth import (
from zipline.pipeline.data import (
CashBuybackAuthorizations,
ShareBuybackAuthorizations
)
from zipline.pipeline.loaders import (
CashBuybackAuthorizationsLoader,
ShareBuybackAuthorizationsLoader,
)
Expand Down
4 changes: 2 additions & 2 deletions zipline/pipeline/loaders/blaze/dividends.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
SID_FIELD_NAME,
TS_FIELD_NAME,
)
from zipline.pipeline.data.dividends import (
from zipline.pipeline.data import (
DividendsByExDate,
DividendsByAnnouncementDate,
DividendsByPayDate
)
from zipline.pipeline.loaders.dividends import (
from zipline.pipeline.loaders import (
DividendsByAnnouncementDateLoader,
DividendsByPayDateLoader,
DividendsByExDateLoader
Expand Down
2 changes: 1 addition & 1 deletion zipline/pipeline/loaders/blaze/earnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
TS_FIELD_NAME,
)
from zipline.pipeline.data import EarningsCalendar
from zipline.pipeline.loaders.earnings import EarningsCalendarLoader
from zipline.pipeline.loaders import EarningsCalendarLoader
from .events import BlazeEventsLoader


Expand Down
2 changes: 1 addition & 1 deletion zipline/pipeline/loaders/buyback_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Reference implementation for buyback auth loaders.
"""

from ..data.buyback_auth import (
from ..data import (
CashBuybackAuthorizations,
ShareBuybackAuthorizations
)
Expand Down
2 changes: 1 addition & 1 deletion zipline/pipeline/loaders/dividends.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
ANNOUNCEMENT_FIELD_NAME
)
from zipline.pipeline.loaders.events import EventsLoader
from zipline.pipeline.data.dividends import (
from ..data import (
DividendsByExDate,
DividendsByAnnouncementDate,
DividendsByPayDate
Expand Down
2 changes: 1 addition & 1 deletion zipline/pipeline/loaders/earnings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Reference implementation for EarningsCalendar loaders.
"""

from ..data.earnings import EarningsCalendar
from ..data import EarningsCalendar
from .events import EventsLoader
from zipline.pipeline.common import ANNOUNCEMENT_FIELD_NAME
from zipline.utils.memoize import lazyval
Expand Down

0 comments on commit 3b71111

Please sign in to comment.