For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

Transformation from datetime(float) to datetime type?

  • hi all,

    Seems the datetime in OrderData is of float type. Just want to know how to change float type to regular datetime type, Thanks~

  • 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 for more info.

    The float based datetime could be easily converted to python datetime by using num2date() function (see module). Alternatively for data feeds, one may use the data.num2date() to directly get the python datetime for current data feed bar.

Log in to reply