2

I am trying out tiingo API and made the following call:

headers = {
    'Content-Type': 'application/json'
}
requestResponse = requests.get("https://api.tiingo.com/tiingo/daily/aapl/prices?startDate=2019-01-01&endDate=2021-06-26&token=bcf142701e620cf52e79a7238d60da5c3f0a21dc", headers=headers)
aapl = pd.DataFrame(requestResponse.json())

Next, I plotted the "close" data:

enter image description here

This doesn't look at all like the graph of AAPL (source tradingview):

enter image description here

What am I missing here?

4
  • 2
    I’m voting to close this question because it relates more to programming than a personal finance issue.
    – RiverNet
    Commented Jun 27, 2021 at 19:04
  • 1
    I disagree. The programming side here is clear and straightforward. The problem is due to knowledge gaps on the financial side.
    – Dror
    Commented Jun 28, 2021 at 7:44
  • this is not a programming forum, and he's asking why his code isn't generating the same graph plot as the sample. What exactly does that have to do with personal finance? My vote to close stands.
    – RiverNet
    Commented Jun 28, 2021 at 11:46
  • 3
    @RiverNet the reason that he isn't seeing the same AAPL graph is that the data he is using is unadjusted and there has been a stock split so the programming has nothing to do with it. The graph is correct, the data he is using is wrong for personal finance reasons
    – MD-Tech
    Commented Jun 28, 2021 at 13:34

1 Answer 1

4

Stock price charts are usually adjusted for corporate actions which affect the price like splits and reverse splits.

There was a 4-1 stock split by Apple on Aug 31, 2020

The Board of Directors has also approved a four-for-one stock split to make the stock more accessible to a broader base of investors. Each Apple shareholder of record at the close of business on August 24, 2020 will receive three additional shares for every share held on the record date, and trading will begin on a split-adjusted basis on August 31, 2020.

I would also check if your X-axis label isn't shifted by one position given the drop appears 3 or 4 months early.

Not the answer you're looking for? Browse other questions tagged .