-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
-
Hi, I have recently downloaded backtesting.py and was using the sample sma crossover strategy provided. I am using the spyder GUI. The code ran and stats generated but the bt.plot() generate a number of errors and did not generate a chart. Several sources have pointed to compatibility issues with the Bokeh graphics library. I have uninstalled and reinstalled both Bokeh 3.2.1 and 3.1.1 versions and neither seems to work.
While the stats are nice if I cant get the graphing to work it is not much use to me. and I will need to try another backtesting library.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 4 comments 4 replies
-
@JJTittles; I can assure you that the plotting function works just fine. Here is a chart that I just ran.
Screenshot 2024年06月22日 110916
I'm running the backtesting.py library from pycharm without any problems, as well as a range of many other bokeh plots. If you'd like help getting it working, you're going to need to do better than "your thing doesn't work, so I'm throwing my toys out of the cot". If you can describe what you've tried, what you're seeing and what errors are appearing, it might be possible for others to offer their free time to assist you.
Beta Was this translation helpful? Give feedback.
All reactions
-
Beta Was this translation helpful? Give feedback.
All reactions
-
Hey @JJTittles; no worries. Writing code can be a lonely and frustrating road. I'm a complete noob, not a software eng, so I understand how you feel.
Noting the above...your error looks like its coming from Bokeh itself. If you navigate through backtesting.py to _plotting.py in your IDE, on about line 250 you'll see something like:
if is_datetime_index: fig_ohlc.xaxis.formatter = CustomJSTickFormatter( args=dict(axis=fig_ohlc.xaxis[0], formatter=DatetimeTickFormatter(days=['%d %b', '%a %d'] months=['%m/%Y', "%b'%y"]), source=source)
Bokeh now doesn't like inputs to DatetimeTickFormatter
to be a list.
Go into this line of code, comment out the list input (so you can go back) and instead write:
formatter=DatetimeTickFormatter(days='%a, %d %b', # ["%d %b', '%a %d"] months='%m/%Y'), # ["%m/%Y', "%b'%y"]
This should work for you. Let me know how you go. As a tip, I paid the 10ドル/mth for GitHub CoPilot...for someone like me who is clueless with code, its saved a lot of time. Works directly from with pycharm, or whatever IDE you use.
Beta Was this translation helpful? Give feedback.
All reactions
-
...the months
input is on a new line. I can never get markdown to show the format right.
Beta Was this translation helpful? Give feedback.
All reactions
-
Dear Rydo111,
Thanks. I struggled for hours to figure out the error....
Your tip saved me. Thanks a ton Bro.
Beta Was this translation helpful? Give feedback.
All reactions
-
Thank you Rydo111
Beta Was this translation helpful? Give feedback.
All reactions
-
Beta Was this translation helpful? Give feedback.
All reactions
-
Worked for me thanks alot
Beta Was this translation helpful? Give feedback.