Open Source

Using the API File Provider

How do I use the API File Provider

Ensuring a high data quality is one of the hardest parts of setting reliable backtesting. There are many challenges to ensuring your data is in the right format, free of errors or omissions and historically accurate. We've tried to address this for you by opening the LEAN Data Library and letting you download our data. LEAN data is organized into millions of tiny files which can be difficult to put into place manually, but using the API File Provider we provide a way for you to automatically install this into your LEAN project.

Currently we provide forex and cfd data for each of the major vendors we support in tick, second, minute, hour and daily resolution. To request data; go to your data library and specify what you'd like to download.

Data library collection for FXCM EURUSD data

Each data file has a unique URL to download the data for the day which will get a LEAN formatted CSV zip. By using the API File Downloader we check if you have the file in your data-folder; and if not we attempt to download it from the API. This assumes you have already added the data to your repository through the web interface.

This requires 2 key changes to the config.json file in the QuantConnect.Lean.Launcher Project:

  • Insert your job-user-id and api-access-token into the relevant config fields. You can find these on your Account page.
  • Update the data-provider configuration to refer to the APIDataProvider class. This is called QuantConnect.Lean.Engine.DataFeeds.ApiDataProvider.

Check out the video below where we guide you step by step through how to use the API Data Provider.

You can also see our Documentation and Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the tutorials: