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/

    Number of digits after the comma

    General Code/Help
    2
    4
    50
    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.
    • Y
      YELNAr last edited by

      How to get 6 values after the comma:
      output only 2 digits

      2019-07-15, Close, EUR.USD 1.13
      2019-07-15, Close, EUR.GBP 0.9
      
      1 Reply Last reply Reply Quote 0
      • A
        ab_trader last edited by

        Find %.2f in your script and replace it with %.6f.

        1 Reply Last reply Reply Quote 1
        • Y
          YELNAr last edited by

          In my case when I parse data from CSV, the real data is 1.12694, while in output is 1.13.
          Maybe I should change smth in this code

              
              def read_data(file_name):    
                  datapath = os.path.abspath(os.getcwd() + '/' + file_name)
                  return bt.feeds.YahooFinanceCSVData(
                          dataname=datapath,
                          # Do not pass values before this date
                          #fromdate=datetime.datetime(2018, 1, 1),
                          # Do not pass values before this date
                          #todate=datetime.datetime(2019, 1, 1),
                          # Do not pass values after this date
                          reverse=False)
              
          
          1 Reply Last reply Reply Quote 0
          • Y
            YELNAr last edited by

            I solved this problem, thanks

            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(); }); }