backtrader.bokeh.app module¶
Bokeh Application Core Classes
Provides integration between Backtrader and Bokeh
- class backtrader.bokeh.app.FigurePage[源代码]¶
基类:
objectFigure Page
Manages a group of related charts and data sources.
- __init__(strategy=None)[源代码]¶
Initialize a FigurePage.
- 参数:
strategy -- Strategy instance associated with this figure page.
- class backtrader.bokeh.app.Figure[源代码]¶
基类:
objectSingle Figure
Wraps a Bokeh figure.
- class backtrader.bokeh.app.BacktraderBokeh[源代码]¶
基类:
objectBacktrader Bokeh Application
Provides the following features: - Create and manage figure pages - Generate Bokeh models - Data processing and formatting
- 参数:
style -- Chart style, 'bar' or 'candle'
scheme -- Theme instance
use_default_tabs -- Whether to use default tabs
filter -- Data filter configuration
示例
app = BacktraderBokeh(style='candle', scheme=Blackly()) figid, figurepage = app.create_figurepage(strategy) panels = app.generate_model_panels()
- params = (('style', 'bar'), ('scheme', None), ('use_default_tabs', True), ('filter', None))¶
- __init__(**kwargs)[源代码]¶
Initialize BacktraderBokeh application.
- 参数:
**kwargs -- Keyword arguments for configuration: - style: Chart style ('bar' or 'candle') - scheme: Theme instance for styling - use_default_tabs: Whether to use default tabs - filter: Data filter configuration
- create_figurepage(strategy, filldata=True)[源代码]¶
Create a figure page.
- 参数:
strategy -- Strategy instance
filldata -- Whether to fill data
- 返回:
(figid, figurepage)
- 返回类型:
- get_figurepage(figid)[源代码]¶
Get figure page.
- 参数:
figid -- Figure page ID
- 返回:
FigurePage instance or None
- get_last_idx(figid)[源代码]¶
Get last data index of figure page.
- 参数:
figid -- Figure page ID
- 返回:
Last index
- 返回类型:
- generate_data(figid=None, start=None, end=None, back=None, preserveidx=False, fill_gaps=False)[源代码]¶
Generate chart data.
- 参数:
figid -- Figure page ID
start -- Start index
end -- End index
back -- Number of bars to look back
preserveidx -- Whether to preserve original index
fill_gaps -- Whether to fill gaps
- 返回:
pandas.DataFrame