Skip to content

Getting BokehDeprecationWarning on DatetimeFormatter running the demo in readme.md #807

@jenko

Description

@jenko

Expected Behavior

(Same as what's displayed in the readme of the backtesting repo)

Actual Behavior

BokehDeprecationWarning: Passing lists of formats for DatetimeTickFormatter scales was deprecated in Bokeh 3.0. Configure a single string format for each scale
/home/jenko/.local/lib/python3.10/site-packages/bokeh/models/formatters.py:399: UserWarning: DatetimeFormatter scales now only accept a single format. Using the first prodvided: '%d %b'
  warnings.warn(f"DatetimeFormatter scales now only accept a single format. Using the first prodvided: {fmt[0]!r} ")
BokehDeprecationWarning: Passing lists of formats for DatetimeTickFormatter scales was deprecated in Bokeh 3.0. Configure a single string format for each scale
/home/jenko/.local/lib/python3.10/site-packages/bokeh/models/formatters.py:399: UserWarning: DatetimeFormatter scales now only accept a single format. Using the first prodvided: '%m/%Y'
  warnings.warn(f"DatetimeFormatter scales now only accept a single format. Using the first prodvided: {fmt[0]!r} ")

Steps to Reproduce

  1. pip install backtesting
  2. copy code from repo readme to demo.py
  3. run code in python 3.10.6 on Ubuntu 20.04.1 LTS as "python demo.py"
from backtesting import Backtest, Strategy
from backtesting.lib import crossover

from backtesting.test import SMA, GOOG


class SmaCross(Strategy):
    def init(self):
        price = self.data.Close
        self.ma1 = self.I(SMA, price, 10)
        self.ma2 = self.I(SMA, price, 20)

    def next(self):
        if crossover(self.ma1, self.ma2):
            self.buy()
        elif crossover(self.ma2, self.ma1):
            self.sell()


bt = Backtest(GOOG, SmaCross, commission=.002,
              exclusive_orders=True)
stats = bt.run()
bt.plot()

Additional info

  • Backtesting version: 0.?.?
    pip freeze | grep -i backtesting
    Backtesting==0.3.3

This error is triggered by the line

bt.plot()

if I comment it out, there are no errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions