backtrader.filters.bsplitter module¶
Bar Splitter Filter Module - Daily bar splitting.
This module provides the DaySplitterClose filter for splitting daily bars into two parts for intraday replay simulation.
- Classes:
DaySplitterClose: Splits daily bars into OHLX and CCCC ticks.
示例
>>> data = bt.feeds.GenericCSVData(dataname='daily.csv')
>>> data.addfilter(bt.filters.DaySplitterClose())
>>> cerebro.adddata(data)
- class backtrader.filters.bsplitter.DaySplitterClose[源代码]¶
-
Splits a daily bar in two parts simulating 2 ticks which will be used to replay the data:
First tick:
OHLXThe
Closewill be replaced by the average ofOpen,HighandLowThe session opening time is used for this tick
And
Second tick:
CCCCThe Close price will be used for the four components of the price
The session closing time is used for this tick
The volume will be split amongst the 2 ticks using the parameters:
closevol(default:0.5) The value indicates which percentage, in absolute terms from 0.0 to 1.0, has to be assigned to the closing tick. The rest will be assigned to theOHLXtick.
This filter is meant to be used together with
cerebro.replaydata- params = (('closevol', 0.5),)¶
- __init__(data, **kwargs)[源代码]¶
Initialize the DaySplitterClose filter.
- 参数:
data -- The data feed to apply the filter to.
**kwargs -- Additional keyword arguments passed to parent class.
- __call__(data)[源代码]¶
Process the data feed to split daily bars.
This method is called for each bar in the data feed. It splits the daily bar into two parts - an OHLX tick and a CCCC tick - to simulate intraday trading behavior.
- 参数:
data -- The data feed containing the bar to process.
- 返回:
False if the initial tick can be further processed from stack.
- 返回类型:
- backtrader.filters.bsplitter.DaySplitter_Close¶
DaySplitterClose的别名