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/

    stock close are not the correct

    General Discussion
    3
    4
    121
    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
      yanke_zulu last edited by

      Hello
      I am using backtrader historical data, but close price does not match wit the yahoo and tradingview close price, what I am missing
      symbol = "AAPL"
      data = DataFactory(dataname=symbol, historical=True, fromdate=datetime(
      2020, 7, 1), timeframe=bt.TimeFrame.Days)
      datafeed
      2020-10-28, Close, 111.15
      2020-10-29, Close, 114.52
      2020-10-30, Close, 108.90
      2020-11-02, Close, 108.77

      yahoo
      Nov 02, 2020 109.11 110.67 107.32 108.07 108.07 101,087,769
      Oct 30, 2020 111.06 111.99 107.72 108.86 108.86 190,272,600

      1 Reply Last reply Reply Quote 0
      • A
        ab_trader last edited by

        @yanke_zulu said in stock close are not the correct:

        I am using backtrader historical data

        bt doesn't have its own historical data. what broker implementation do you use?

        as a guess - yahoo adjusted prices are used in bt by default settings. broker you used can have non-adjusted prices.

        • If my answer helped, hit reputation up arrow at lower right corner of the post.
        • Python Debugging With Pdb
        • New to python and bt - check this out
        run-out 1 Reply Last reply Reply Quote 1
        • run-out
          run-out @ab_trader last edited by

          @ab_trader said in stock close are not the correct:

          as a guess - yahoo adjusted prices are used in bt by default settings. broker you used can have non-adjusted prices.

          The adj close shouldn't be off by so much at such an early date. I double checked on yahoo finance and they are not. I cannot replicate the op error. @yanke_zulu will need to dig into the supplier of the data.

                      Close  Adj Close
          Date                        
          2020-10-28 111.20     111.20
          2020-10-29 115.32     115.32
          2020-10-30 108.86     108.86
          2020-11-02 108.77     108.77
          

          RunBacktest.com

          1 Reply Last reply Reply Quote 0
          • Y
            yanke_zulu last edited by

            I was using the standard script for sample strategy, like below
            if not ALPACA_PAPER:
            broker = store.getbroker() # or just alpaca_backtrader_api.AlpacaBroker()
            cerebro.setbroker(broker)

            DataFactory = store.getdata # or use alpaca_backtrader_api.AlpacaData
            data = DataFactory(dataname=symbol, historical=True, fromdate=datetime(2020, 10, 1), timeframe=bt.TimeFrame.Days)

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors