backtrader.bokeh.live package

Live functionality module.

Provides real-time data processing and client management functionality.

class backtrader.bokeh.live.LiveClient[源代码]

基类:object

Live client.

Provides real-time plotting functionality, including: - Data filtering - Navigation controls (pause/play/forward/backward) - Data updates

doc

Bokeh document instance

model

Bokeh root model

lookback

Historical data retention

fill_gaps

Whether to fill data gaps

plotgroup

Plot group for filtering

NAV_BUTTON_WIDTH = 38
__init__(doc, app, strategy, lookback)[源代码]

Initialize live client.

参数:
  • doc -- Bokeh document instance

  • app -- BacktraderBokeh application instance

  • strategy -- Strategy instance

  • lookback -- Historical data retention

updatemodel()[源代码]

Update model.

next()[源代码]

Receive new data and update.

Called by LivePlotAnalyzer.next()

stop()[源代码]

Stop client.

class backtrader.bokeh.live.LiveDataHandler[源代码]

基类:object

Live data handler.

Responsible for receiving, storing and pushing real-time data.

_doc

Bokeh document

_app

BacktraderBokeh application

_figid

Figure page ID

_lookback

Historical data retention

_fill_gaps

Whether to fill data gaps

__init__(doc, app, figid, lookback, fill_gaps=True, timeout=1)[源代码]

Initialize data handler.

参数:
  • doc -- Bokeh document

  • app -- BacktraderBokeh application

  • figid -- Figure page ID

  • lookback -- Historical data retention

  • fill_gaps -- Whether to fill data gaps

  • timeout -- Thread timeout

get_last_idx()[源代码]

Get last data index.

返回:

Last index, returns -1 if no data

返回类型:

int

set(df)[源代码]

Set new DataFrame and push.

参数:

df -- New DataFrame

update()[源代码]

Notify that new data is available.

stop()[源代码]

Stop data handler.

Submodules