Get Back Adjusted Historical Data for Amibroker using Python and Tiingo api

In this post I will share a quick way for Amibroker users to update quotes using split and dividend back adjusted data from a fairly new provider, Tiingo.com. Although we do run our investment strategies on our very own QuantTrader, we use various other tools to analyse markets, including Amibroker.

The problem: Where to download dividend adjusted data

Many Amibroker users build strategies that rely on dividend adjusted historical data. At this moment it is difficult to find similar data since Yahoo, as well as many other sources, do not back-adjust prices to include dividends. A solution is to use free (or rather donation-based) EOD data from Tiingo.com.

What happened to the free Yahoo finance historical data?

Yahoo! finance has changed their Yahoo Finance API and the way the data is delivered. This has disrupted the workflow of many self-directed investors that use Excel or Google sheets to track their holdings. It has also created problems for users of financial software that use Yahoo’s service.

The service has not been discontinued. Rather, it has been changed. You can still retrieve stock, ETF, mutual funds and currency historical data. From what we can see so far, the data is in json format, adjusted for splits but not for dividends, although the dividend information is provided in the data and can be retrieved (as of 6/3/2017).

If you use Amibroker, you can use the updated Amiquote to retrieve data using the new Yahoo API. It will not be dividend-adjusted (just try to download a bond ETF like “TLT”). If you want to continue an existing workflow of dividend-adjusted data, you can try this solution.

You will need:

  1. Amibroker.
  2. A free account at Tiingo.com to get a Token #
  3. A way to run the following Python script.

Tingo API  docs for daily prices: https://api.tiingo.com/docs/tiingo/daily

 


Invest in one of our Top Strategies, register for our free one month trial

NameCAGR 1y ▼
Universal Investment Strategy 3x Leverage44.3%
Crypto & Leveraged Top 2 Strategy33.2%
Maximum Yield Strategy31.7%
Universal Investment Strategy 2x Leverage25.7%
Leveraged Gold-Currency Strategy25.2%

9 thoughts on “Get Back Adjusted Historical Data for Amibroker using Python and Tiingo api”

  1. I posted this once, but it seems to have gotten lost:

    The xltraders Yahoo group has also been discussing this (I imagine there are discussions all over the web). Randy Harmelink, who posts frequently there, says this about the new data feed: “Unfortunately, it’s in JSON format, so needs to be extracted piece by piece. Since they’re currently not adjusted for dividends, I’m doing that myself, since the data is already available there.”

    I looked at Tiingo, but they don’t seem to have historical data, which I use. Someone on xltraders suggested intrinio.com, and I also found eoddata.com. Both offer free data, but the latter charges for more than 30 days of historical.

    Intrinio seems promising–they have a limit of 500 free data points per day, including historical. It works a little differently–you have to sign up for a free account and login when you want to download. They have an Excel Add-in, but it only works with Excel 2010 and later, so I have to update my Excel, which won’t happen till next week.

    You can take a look at their available functions here:

    http://docs.intrinio.com/excel-addin#intrinio-excel-functions

    and their dividend functions here:

    http://blog.intrinio.com/how-can-i-see-a-companys-dividend/?utm_source=Intercom&utm_medium=Support&utm_campaign=Intercom%20How%20can%20I%20see%20a%20company%27s%20dividend%3F

    With the Yahoo APIs, I had an Excel whiz from upwork.com, Eugeniu A, do some custom work to create an Excel downloader for daily, historical, and dividends. I posted it at xltraders, but obviously it’s now useless. I’ll get it modified for the new data source and will again post it at xltraders if anyone wants it, probably within the next couple of weeks. And if anyone needs custom Excel programming, I can recommend Eugeniu highly–he lives in Moldova, does great work, speaks excellent English, and has very reasonable prices. https://www.upwork.com/ab/profiles/search/details/~01c9afeb30d4c02e9b/profile

  2. After looking into Tiingo a little further, you’re right, it is a better deal. Intrinio’s Excel add-in is convenient, but they provide only 500 free data points per day, and unless you have more than a few tickers, it would require some juggling to avoid exceeding that–maybe daily and dividends one day and historical prices the next. Even then, you have to pare down your data set to minimize the number of points requested. (They offer unlimited data for $40 a month.)

    Tiingo has a much higher cap, and it’s monthly rather than daily. The average user probably wouldn’t exceed it. They ask for a $7/month donation, but it’s not required and even so, is very reasonable compared to what other sites charge. It’s possible to get daily, historical, and dividends in two calls, according to the page you linked above:

    Daily: https://api.tiingo.com/tiingo/daily//prices

    Historical (including dividends–“divCash”): https://api.tiingo.com/tiingo/daily//prices?startDate=2016-1-1&endDate=2017-1-1

    Then the file needs to be parsed to extract the data. (A free account is necessary for these to work.)

    I’m having my Excel downloader updated to use these and will post it on XL Traders when it’s ready.

    Thanks again, Vangelis–this is a really good source.

    Mark

  3. Hi Mark. Glad you found this useful. I myself have to give credit to LI users Alberto Magnani and Peter V as they pointed out Tiingo (see forum). I like it when we all share and benefit from each other’s research.

  4. Thanks Vangelis for the credit but Alberto was really the first mentioning Tiingo. I took a deep dive to minutely compare all publicly available eod data sources as suggested by many frustrated Yahoo users and Tiingo quickly came floating on top. After having used Tiingo data intensively for a couple of months now, I can truly say that data quality is their highest priority, technically implemented by using redundancy in their data sources. A week ago my software flagged an (one datapoint!) outlier in the AAPL history, I contacted Tiingo in their (US) early morning and they cured it within 5 minutes, with apologies and explanation how that happened. That is amazing good service. Looking forward to their projected coverage of EU equity and ETF data.

Leave a Comment