bundles/data_portal: fixes spot price scaling

This commit is contained in:
Conner Fromknecht
2017-07-26 03:11:37 -07:00
parent 363e65099b
commit 327d22207c
3 changed files with 2 additions and 11 deletions
-4
View File
@@ -431,7 +431,6 @@ class TradingAlgorithm(object):
If get_loader is None, constructs an ExplodingPipelineEngine
"""
print 'using all_dates for {}'.format(data_frequency)
if get_loader is not None:
if data_frequency == 'daily':
all_dates = self.trading_calendar.all_sessions
@@ -445,9 +444,6 @@ class TradingAlgorithm(object):
'data frequency: {}'.format(data_frequency)
)
print 'first_dates:', all_dates[:10]
print 'last_dates:', all_dates[:-10]
self.engine = SimplePipelineEngine(
get_loader,
all_dates,
+1 -6
View File
@@ -289,7 +289,7 @@ class DataPortal(object):
self._daily_aggregator = DailyHistoryAggregator(
self.trading_calendar.schedule.market_open,
_dispatch_minute_reader,
_dispatch_session_reader,
self.trading_calendar
)
self._history_loader = DailyHistoryLoader(
@@ -689,11 +689,9 @@ class DataPortal(object):
if pd.isnull(query_dt):
# no last traded dt, bail
print 'ffill, no dt {} for, {}'.format(query_dt, column)
if column == 'volume':
return 0
else:
print 'ffill, no dt, field == nan'
return np.nan
else:
# If not forward filling, we just want dt.
@@ -702,17 +700,14 @@ class DataPortal(object):
try:
result = reader.get_value(asset.sid, query_dt, column)
except NoDataOnDate:
print 'no data for {} on date {}'.format(column, query_dt)
if column == 'volume':
return 0
else:
return np.nan
if not ffill or (dt == query_dt) or (dt.date() == query_dt.date()):
#print 'already have data'
return result
#print 'adjusting..'
# the value we found came from a different day, so we have to adjust
# the data if there are any adjustments on that day barrier
return self.get_adjusted_value(
+1 -1
View File
@@ -763,7 +763,7 @@ class BcolzDailyBarReader(SessionBarReader):
if price == 0:
return nan
else:
return price * 0.001
return price * 0.000001
else:
return price