Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new data download command to lean-cli for data retrieval #447

Conversation

Romazes
Copy link
Contributor

@Romazes Romazes commented Apr 15, 2024

Description

This pull request introduces a new command, data download, to the lean-cli tool. This command facilitates downloading various data types such as Trade, Quote, and Open Interest from multiple Historical Data Providers like Polygon, Binance, Interactive Brokers, etc. The command supports different resolutions like tick, second, minute, hour, and day, as well as different security types depending on the support available from the Data Provider. The command invokes an executable app from Lean to perform the data download.

Related Issue

#388

Related Pull Request

Motivation and Context

The motivation behind this feature is to enhance the user experience by providing an easy-to-use command for downloading different types of data required for developing trading algorithms in Lean. By incorporating this feature into lean-cli, users can effortlessly download data and proceed with algorithm development without needing to manually handle data retrieval from various providers.

How Has This Been Tested?

This feature has been thoroughly tested to ensure its functionality and reliability:

  • Unit Tests: Created unit tests to validate the command's logic and behavior.
  • Manual Testing: Manually tested the command in both interactive and non-interactive modes to ensure it behaves as expected and handles different input scenarios correctly.
  • Local Testing with Custom Docker Images: Tested the command in a local environment using custom Docker images and the latest development version of Lean to verify its compatibility and performance.

Additional manual test cases:

Interactive Brokers [Security type: Equity]

lean data download --data-provider-historical "Interactive Brokers" --data-type Quote --resolution Daily --security-type Equity --tickers NVDA,AMD --start-date 20240303 --end-date 20240404
Result:

image

Binance [Security type: Crypto]

lean data download --data-provider-historical Binance --data-type Trade --resolution Daily --security-type Crypto --tickers BTCUSDT,ETHUSDT --start-date 20240303 --end-date 20240404
Result

image

FactSet [Security type: IndexOption]

lean data download --data-provider-historical FactSet --data-type Trade --resolution Daily --security-type IndexOption --tickers SPX --start-date 20240422 --end-date 20240423
Result:

image

Polygon [Security type: Equity]

lean data download --data-provider-historical Polygon --data-type Trade --resolution Hour --security-type Equity --tickers SOFI,TSLA,NIO --start-date 20200101 --end-date 20240404
Result:

image

IEX [Security type: Equity]

lean data download --data-provider-historical IEX --data-type Trade --resolution Hour --security-type Equity --tickers AMD --start-date 20200101 --end-date 20240404
Result: [wrong resolution]

image

IEX [Security type: Equity]

lean data download --data-provider-historical IEX --data-type Trade --resolution Daily --security-type Equity --tickers GOOGL --start-date 20100101 --end-date 20240404

Result

image

Coinbase Advanced Trade [Security type: Crypto]

pay attention --market Coinbase

lean data download --data-provider-historical "Coinbase Advanced Trade" --data-type Trade --resolution hour --security-type Crypto --tickers BTCUSD --market Coinbase --start-date 20230101 --end-date 20240404

image

Example of running

  1. Interactive Mode:
    Run ⬇ and follow the on-screen instructions to select the Data Provider, Data Type, Resolution, Security Type, tickers, start date, and end date.
lean data download
  1. Non-Interactive Mode:
    Run ⬇
 lean data download --data-provider-historical Polygon --data-type Trade --resolution Minute --ticker-security-type Equity --tickers AAPL,QQQ --start-date 20240101 --end-date 20240202

Conclusion

The main goal of this feature is to be user-friendly and assist users in downloading various data types required for creating new trading algorithms in Lean. By providing a seamless data retrieval process, users can focus more on algorithm development and less on data management.

Romazes added 30 commits April 23, 2024 21:36
remove: not used path mount
feat: const for download config key
refactor: param target_path in set up csharp options
feat: run download project
refactor: encapsulate data download data runner in tests
rename: input command market/security-type
refactor: add prompt msg helper
remove: prompt use selection method
Copy link
Member

@Martin-Molinero Martin-Molinero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍

@Martin-Molinero Martin-Molinero merged commit cf20a53 into QuantConnect:master May 1, 2024
23 checks passed
@Romazes Romazes deleted the feature-388-support-download-data-provider branch July 17, 2024 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants