kernc / backtesting.py

:mag_right: :chart_with_upwards_trend: :snake: :moneybag: Backtest trading strategies in Python.
https://kernc.github.io/backtesting.py/
GNU Affero General Public License v3.0
5.55k stars 1.07k forks source link

Rounding error in RGB functionality #1164

Open Murat-U-Saglam opened 3 months ago

Murat-U-Saglam commented 3 months ago

The values before passed to Bokeh were not rounded as integers and were treated as float due to a decimal point. I have added robust checking and enforcement of ints within that function.

Bokeh RGB accepts integers, this error causes issues with serialisation as discussed in Issue

bryevdv commented 3 months ago

FYI please check this works, I am not sure calling rint will be sufficient as it still (AFAIK) generates floating point values, that just happen to be integer values. But these may render like 2., 10. etc. and I believe this will still trip up the regex based input validation. Though really I would recommend collecting the results in a tuple and actually calling int on all the components to be safest.