It appears that QC stores fundamentals in `data\equity\{country}\fundamental\{fine | coarse}\{symbol}\{YYYYMMDD}.zip\{symbol}.json` with a specific JSON structure (Morningstar?). I've searched around and I don't believe there's a way of downloading fundamental data through Lean's CLI, but I can download them through my own means using IBKR's API through ib_insync. However it downloads in an XML format (Wall Street Events Horizon Calendar? Reuters? I don't know for sure where IB sources fundamentals from but I've read both). Even if I can get the data, it seems it only goes back a couple of years for the stock I'm interested in.  I really just need to download a few stocks' worth of fundamentals in order to do local machine learning research.

I want to use QC's existing API for managing the retrieval of fundamental data (qb.GetFundamental for example) so that I don't need to change my script when it comes time to backtest/go live. In that respect I need to be able to save the fundamental data in Lean's expected format. Does anyone have a solution to my problem?

Author