backtrader.filters.calendardays module¶
Calendar Days Filter Module - Calendar day filling.
This module provides the CalendarDays filter for adding missing calendar days to trading day data.
- Classes:
CalendarDays: Fills missing calendar days.
示例
>>> data = bt.feeds.GenericCSVData(dataname='data.csv')
>>> data.addfilter(bt.filters.CalendarDays())
>>> cerebro.adddata(data)
- class backtrader.filters.calendardays.CalendarDays[源代码]¶
-
Bar Filler to add missing calendar days to trading days
Params:
fill_price (def: None):
> 0: The given value to fill 0 or None: Use the last known closing price -1: Use the midpoint of the last bar (High-Low average)
fill_vol (def: float('NaN')):
Value to use to fill the missing volume
fill_oi (def: float('NaN')):
Value to use to fill the missing Open Interest
- params = (('fill_price', None), ('fill_vol', nan), ('fill_oi', nan))¶
- ONEDAY = datetime.timedelta(days=1)¶
- lastdt = datetime.date(9999, 12, 31)¶