From cb284140cdaddc41cdd6916be95aebb176bfa312 Mon Sep 17 00:00:00 2001 From: Romazes Date: Thu, 2 May 2024 20:58:20 +0300 Subject: [PATCH 1/2] fix: default market in download command --- lean/commands/data/download.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lean/commands/data/download.py b/lean/commands/data/download.py index bbc24a17..7a9bf3d6 100644 --- a/lean/commands/data/download.py +++ b/lean/commands/data/download.py @@ -510,7 +510,7 @@ def _configure_date_option(date_value: str, option_id: str, option_label: str) - help="Specify the resolution of the historical data") @option("--security-type", type=Choice(QCSecurityType.get_all_members(), case_sensitive=False), help="Specify the security type of the historical data") -@option("--market", type=str, default="USA", +@option("--market", type=str, help="Specify the market name for tickers (e.g., 'USA', 'NYMEX', 'Binance')") @option("--tickers", type=str, @@ -616,6 +616,9 @@ def download(ctx: Context, "resolutions") data_provider_support_markets = _get_download_specification_from_config(data_provider_config_json, [market], "markets") + # take default market + if not data_provider_support_markets: + data_provider_support_markets = ["USA"] security_type = _get_user_input_or_prompt(security_type, data_provider_support_security_types, data_provider_historical, "Select a Ticker's security type") @@ -624,7 +627,7 @@ def download(ctx: Context, resolution = _get_user_input_or_prompt(resolution, data_provider_support_resolutions, data_provider_historical, "Select a Resolution") market = _get_user_input_or_prompt(market, data_provider_support_markets, - data_provider_historical,"Select a Market") + data_provider_historical, "Select a Market") if not tickers: tickers = ','.join(DatasetTextOption(id="id", From 7247504d1d862d8a8f16fd416054e54a0c27cef7 Mon Sep 17 00:00:00 2001 From: Romazes Date: Thu, 2 May 2024 21:16:39 +0300 Subject: [PATCH 2/2] remove: duplication of validate market name --- lean/commands/data/download.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lean/commands/data/download.py b/lean/commands/data/download.py index 7a9bf3d6..4072d5fe 100644 --- a/lean/commands/data/download.py +++ b/lean/commands/data/download.py @@ -615,10 +615,7 @@ def download(ctx: Context, QCResolution.get_all_members(), "resolutions") data_provider_support_markets = _get_download_specification_from_config(data_provider_config_json, - [market], "markets") - # take default market - if not data_provider_support_markets: - data_provider_support_markets = ["USA"] + ["USA"], "markets") security_type = _get_user_input_or_prompt(security_type, data_provider_support_security_types, data_provider_historical, "Select a Ticker's security type")