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/

    Is an excuted price the following opening price?

    General Code/Help
    2
    6
    1198
    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.
    • N
      nullpy last edited by

      Hello. I'm working on Quickstart manual. The manual says that when the broker executes an order, it uses the opening price of the next bar.

      orcl-1995-2014
      Date,      Open, High, Low,  Close,  Volume, Adj Close
      2000-12-20,28.06,29.81,27.50,28.50,54440500, 26.88
      2000-12-21,27.81,30.25,27.31,29.50,46719700, 27.82
      2000-12-22,30.38,31.98,30.00,31.88,35568200, 30.06
      2000-12-26,31.50,32.19,30.00,30.94,20589500, 29.17
      2000-12-27,30.38,31.06,29.38,30.69,26437500, 28.94
      2000-12-28,30.56,31.62,30.38,31.06,25053600, 29.29
      2000-12-29,30.88,31.31,28.69,29.06,31702200, 27.41
      

      So, in my understanding, if an order is created on 20 Dec from the data above, the following execution price should be 27.81 on 21 Dec, however, this is the result:

      2000-12-20, Close, 26.88
      2000-12-20, BUY CREATE, 26.88
      2000-12-21, BUY EXECUTED, 26.23  -> ???
      2000-12-21, Close, 27.82
      2000-12-22, Close, 30.06
      2000-12-26, Close, 29.17
      2000-12-27, Close, 28.94
      2000-12-28, Close, 29.29
      2000-12-29, Close, 27.41
      2000-12-29, SELL CREATE, 27.41
      

      Please point me out my misunderstandings.

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

        @nullpy said in Is an excuted price the following opening price?:

        orcl-1995-2014
        Date,      Open, High, Low,  Close,  Volume, Adj Close
        2000-12-20,28.06,29.81,27.50,28.50,54440500, 26.88
        2000-12-21,27.81,30.25,27.31,29.50,46719700, 27.82
        2000-12-22,30.38,31.98,30.00,31.88,35568200, 30.06
        2000-12-26,31.50,32.19,30.00,30.94,20589500, 29.17
        2000-12-27,30.38,31.06,29.38,30.69,26437500, 28.94
        2000-12-28,30.56,31.62,30.38,31.06,25053600, 29.29
        2000-12-29,30.88,31.31,28.69,29.06,31702200, 27.41
        

        Those are raw unadjusted prices (dividends and others not applied). The adjusted prices are used. Instead of using the raw data in the file, use what the data stream provides you (because it will adjust the prices)

        N 1 Reply Last reply Reply Quote 0
        • N
          nullpy @backtrader last edited by

          @backtrader
          Thank you for the answer! Could you tell me which *.py file does the work and what I should look at?

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

            feeds/yahoo.py

            Look for the use of adjclose (the already adjusted close) to adjust the other fields.

            N 1 Reply Last reply Reply Quote 0
            • N
              nullpy @backtrader last edited by

              @backtrader
              I have found the option and how it converts the other fields. I appreciate your help!

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

                It is documented: Docs - Data Feeds Reference

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