Transformation from datetime(float) to datetime type?
Alicc last edited by
Seems the datetime in OrderData is of float type. Just want to know how to change float type to regular datetime type, Thanks~
vladisld last edited by
Backtrader uses the floating point datetime representation internally, both for line series (data feeds, indicators and so on) and orders.
This is similar to the way the datetime is used in matplotlib. See https://matplotlib.org/_modules/matplotlib/dates.html for more info.
The float based datetime could be easily converted to python datetime by using
num2date()function (see dateintern.py module). Alternatively for data feeds, one may use the
data.num2date()to directly get the python datetime for current data feed bar.