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



  • 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



  • @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.



  • @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
    


  • 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)


Log in to reply
 

});