Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Python and floating point

    General Discussion
    2
    3
    1150
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • RandyT
      RandyT last edited by

      Ran across this bit of code today in QSTrader. https://github.com/mhallsmoore/qstrader/blob/master/qstrader/price_parser.py

      MHM is going to an incredible amount of effort there to avoid floating point arithmetic. I'm curious if anyone here thinks this is really necessary with our current toolset?

      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        That module is only a trick which works until precision x (for x number of decimals)

        No floating point uncertainty would require the use of Binary Coded Decimals (python has a built-in module) which is certain going to kill any performance.

        The output of indicators of the indicators developed for backtrader was checked down to the 4th decimal against the output of two commercial platforms (this also revealed flaws in the implementation of some indicators in those platforms, sometimes for example as to what the initial conditions have to fulfill)

        1 Reply Last reply Reply Quote 0
        • RandyT
          RandyT last edited by

          Thank you. Good to know.

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
          $(document).ready(function () { app.coldLoad(); }); }