Skip to content

Commit

Permalink
ENH: [WIP] Allow non US assets to be ingested
Browse files Browse the repository at this point in the history
Fix quantopian#2434

Pending testing. Still work in progress.
  • Loading branch information
willianpaixao committed Mar 25, 2020
1 parent d57b41a commit e7a5656
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions zipline/data/bundles/csvdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from logbook import Logger, StreamHandler
from numpy import empty
from pandas import DataFrame, read_csv, Index, Timedelta, NaT
from trading_calendars import register_calendar_alias

from zipline.utils.cli import maybe_show_progress

Expand Down Expand Up @@ -152,13 +151,13 @@ def csvdir_bundle(environ,
writer = daily_bar_writer

writer.write(_pricing_iter(ddir, symbols, metadata,
divs_splits, show_progress),
divs_splits, show_progress),
show_progress=show_progress)

# Hardcode the exchange to "CSVDIR" for all assets and (elsewhere)
# register "CSVDIR" to resolve to the NYSE calendar, because these
# are all equities and thus can use the NYSE calendar.
metadata['exchange'] = "CSVDIR"
if 'CSVDIR_EXCHANGE' in environ:
metadata['exchange'] = environ.get('CSVDIR_EXCHANGE')
else:
metadata['exchange'] = "XNYS"

asset_db_writer.write(equities=metadata)

Expand Down Expand Up @@ -222,6 +221,3 @@ def _pricing_iter(csvdir, symbols, metadata, divs_splits, show_progress):
divs_splits['divs'] = divs.append(div)

yield sid, dfr


register_calendar_alias("CSVDIR", "NYSE")

0 comments on commit e7a5656

Please sign in to comment.