Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.
cory olson edited this page Sep 1, 2020 · 2 revisions

Findata-avn

Findata-avn is a wrapper client for the Alpha Vantage API. The goal is a 1:1 pairing for full coverage of the API

Development Notes/Warning

Testing is thin at the moment. I've found some inconsistencies in the data which makes it difficult to map the data to objects in Crystal. For example - Alpha Vantage returns keys and values in the responses as Strings rather than conforming to a specific type allowed in JSON. Because everything is a String, you run into cases where some responses might be "0" but later switches to "none"

As of this writing: https://www.alphavantage.co/query?function=INCOME_STATEMENT&symbol=IBM&apikey=demo produces a response that contains Annual Reports. For example, in the response object, you have an entry like:

"fiscalDateEnding": "2019-03-31" includes a key/value pair of "effectOfAccountingCharges": "None",

But then you get:

"fiscalDateEnding": "2018-12-31" includes a key/value pair of "effectOfAccountingCharges": "0",

There's probably a specific reason for this - but from a data perspective, it makes it difficult to know whether you should expect an Integer, Float or String in a given response (for type conversion). It could mean there were no accounting changes in the first example. In the second case it could mean there were accounting charges but the effect was 0.

Since documentation is sparse on the responses, it would probably be better normalized if AlphaVantage explicitly used the available data types in JSON. If my guess above is correct, it would be better to have effectOfAccountingCharges always be 0 as the default and use a boolean value to flag whether there were changes. Or, if there were no accounting changes, send a null value (because it can be checked).

If anything, Crystal has taught me to be paranoid about type consistency - having an expectation of data and consistency reduces bugs. Trying to integrate inconsistent data (or data where there's no clear, documented expectation) is difficult.

Clone this wiki locally