ENH: Make reader.get_value raise NoDataOnDate if the date is not in the calendar.

DataPortal now catches the NoDataOnDate exception and returns nan for
OHLC and 0 for V.

Price is still forward filled, unchanged.
This commit is contained in:
Jean Bredeche
2016-09-14 22:21:43 -04:00
parent 5e52d29e88
commit ae0d41af6f
8 changed files with 96 additions and 35 deletions
+7 -1
View File
@@ -17,7 +17,7 @@ from six import with_metaclass
class NoDataOnDate(Exception):
"""
Raised when a spot price can be found for the sid and date.
Raised when a spot price cannot be found for the sid and date.
"""
pass
@@ -106,6 +106,12 @@ class BarReader(with_metaclass(ABCMeta, object)):
value : float|int
The value at the given coordinates, ``float`` for OHLC, ``int``
for 'volume'.
Raises
------
NoDataOnDate
If the given dt is not a valid market minute (in minute mode) or
session (in daily mode) according to this reader's tradingcalendar.
"""
pass