joshuaulrich / quantmod

Quantitative Financial Modelling Framework
http://www.quantmod.com/
GNU General Public License v3.0
818 stars 224 forks source link

add support for Tiingo financial statements API #301

Open ethanbsmith opened 4 years ago

ethanbsmith commented 4 years ago

@tiingo is working on a financial statement API: https://api.tiingo.com/documentation/fundamentals

I think we should support this through the getFinancials function (which currently has no live implementations)

I'll get started on a PR, unless there are any objections

joshuaulrich commented 4 years ago

Thanks for suggesting this! I 100% agree with adding it. My only recommendation is that we wait until it's out of beta before including it in a quantmod release. Feel free to start coding and testing though!

ethanbsmith commented 3 years ago

Apologies to all. I have not had a chance to work on this and it just keeps getting bumped down in priority for me. I do hope to get to it at some point, but probably will not be for a good while longer

joshuaulrich commented 3 years ago

No need to apologize! I mentioned this in 327 because it's an example of what needs to be done for getFinancials() to start working again.

ethanbsmith commented 2 years ago

primitive baseline initial functionality. still very much a WIP. feedback welcome: https://github.com/ethanbsmith/quantmod/tree/301_tiingo_financial_statements

ethanbsmith commented 2 years ago

Hi @tiingo, we have a working version of this. is this financial statement API still considered to be beta?

ethanbsmith commented 2 years ago

ran into an issue today while and want to log it for posterity:

for Symbol SOFI, notice that items 3 is missing a cashFlow, and items 6 and 7 are missing a balanceSheet. Since the structure is irregular, you cannot use simplifyDataFrame = TRUE in jsonlite::fromJSON (which is the default).

image

joshuaulrich commented 2 years ago

Thanks for the report Ethan!

@tiingo, is this expected behavior? Would it be possible to make the JSON always have the same fields, even if they're empty/null?

ethanbsmith commented 2 years ago

fyi, already reached out to them. also, i realized the API supports CSV format, which is considerably easier to deal with

ethanbsmith commented 2 years ago

Response from tiingo: "In general, pro forma statements issued by companies (statements a company issued prior to their IPO), are often incomplete. For pro forma statements, you can expect missing balance/income/cash flow statements". in this case, SOFI listed on 2020-11-30

needed changes have been pushed: https://github.com/ethanbsmith/quantmod/blob/301_tiingo_financial_statements/R/getFinancials.R