bpsmith / tia

Toolkit for integration and analysis
BSD 3-Clause "New" or "Revised" License
404 stars 165 forks source link

Using fiscal year/quarter as time period reference instead of dates #33

Open BoonAtARJ opened 6 years ago

BoonAtARJ commented 6 years ago

How do we get historical data by using the associated fiscal year and fiscal quarter instead of start/end date?

If you pull historical fundamental data in excel you have the option of something along the lines of:

=BDH("COF US EQUITY", "ARD_OTHER_ASSETS_OTHER", "CQ3 2016", "CQ3 2016","FX=USD","Per=cq","dtfmt=p","FILING_STATUS=OR","Factor=1")

I tried to replace the start/end date with a string

resp4 = LocalTerminal.get_historical(["COF US EQUITY"], ["ARD_OTHER_ASSETS_OTHER"], start = "CQ3 2016", end = "CQ4 2016")

but this lead to a ValueError: unknown string format.

I also tried:

resp4 = LocalTerminal.get_historical(["COF US EQUITY"], ["ARD_OTHER_ASSETS_OTHER"], start = "01/01/2005", end = "01/01/2018", period = "QUARTERLY")

That returned a list of correct figures but in the date column is still the ending period's date instead of associated fiscal year and fiscal quarter. There are obviously other workarounds around this but if it can be done straight from here I'd appreciate it.

Thank you!