Skip to content

Commit

Permalink
Rename: several command (#416)
Browse files Browse the repository at this point in the history
* rename: data-provider and data-feed

* rename: data-provider in tests

* typo: change words order
feat: add missed words in help of historical-provider param

* feat: update README
  • Loading branch information
Romazes authored Feb 7, 2024
1 parent bab821e commit d1034be
Show file tree
Hide file tree
Showing 15 changed files with 89 additions and 89 deletions.
42 changes: 21 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ Options:
-d, --detach Run the backtest in a detached Docker container and return immediately
--debug [pycharm|ptvsd|vsdbg|rider|local-platform]
Enable a certain debugging method (see --help for more information)
--data-provider [IQFeed|Polygon|IEX|AlphaVantage|QuantConnect|Local|Terminal Link]
Update the Lean configuration file to retrieve data from the given provider
--data-provider-historical [IQFeed|Polygon|IEX|AlphaVantage|QuantConnect|Local|Terminal Link]
Update the Lean configuration file to retrieve data from the given historical provider
--iqfeed-iqconnect TEXT The path to the IQConnect binary
--iqfeed-username TEXT Your IQFeed username
--iqfeed-password TEXT Your IQFeed password
Expand All @@ -170,9 +170,9 @@ Options:
--terminal-link-openfigi-api-key TEXT
The Open FIGI API key to use for mapping options
--download-data Update the Lean configuration file to download data from the QuantConnect API, alias
for --data-provider QuantConnect
for --data-provider-historical QuantConnect
--data-purchase-limit INTEGER The maximum amount of QCC to spend on downloading data during the backtest when using
QuantConnect as data provider
QuantConnect as historical data provider
--release Compile C# projects in release configuration instead of debug
--image TEXT The LEAN engine image to use (defaults to quantconnect/lean:latest)
--python-venv TEXT The path of the python virtual environment to be used
Expand Down Expand Up @@ -1043,15 +1043,15 @@ Usage: lean live deploy [OPTIONS] PROJECT
If PROJECT is a directory, the algorithm in the main.py or Main.cs file inside it will be executed.
If PROJECT is a file, the algorithm in the specified file will be executed.
By default an interactive wizard is shown letting you configure the brokerage and data feed to use. If --environment,
--brokerage or --data-feed are given the command runs in non-interactive mode. In this mode the CLI does not prompt
for input.
By default an interactive wizard is shown letting you configure the brokerage and live data provider to use. If
--environment, --brokerage or --data-provider-live are given the command runs in non-interactive mode. In this mode
the CLI does not prompt for input.
If --environment is given it must be the name of a live environment in the Lean configuration.
If --brokerage and --data-feed are given, the options specific to the given brokerage/data feed must also be given.
The Lean config is used as fallback when a brokerage/data feed-specific option hasn't been passed in. If a required
option is not given and cannot be found in the Lean config the command aborts.
If --brokerage and --data-provider-live are given, the options specific to the given brokerage/live data provider must
also be given. The Lean config is used as fallback when a brokerage/live data provider-specific option hasn't been
passed in. If a required option is not given and cannot be found in the Lean config the command aborts.
By default the official LEAN engine image is used. You can override this using the --image option. Alternatively you
can set the default engine image for all commands using `lean config set engine-image <image>`.
Expand All @@ -1062,10 +1062,10 @@ Options:
-d, --detach Run the live deployment in a detached Docker container and return immediately
--brokerage [Paper Trading|Interactive Brokers|Tradier|Oanda|Bitfinex|Coinbase Advanced Trade|Binance|Zerodha|Samco|Terminal Link|Trading Technologies|Kraken|TDAmeritrade|Bybit]
The brokerage to use
--data-feed [Interactive Brokers|Tradier|Oanda|Bitfinex|Coinbase Advanced Trade|Binance|Zerodha|Samco|Terminal Link|Kraken|TDAmeritrade|IQFeed|Polygon|IEX|Custom data only|Bybit]
The data feed to use
--data-provider [IQFeed|Polygon|IEX|AlphaVantage|QuantConnect|Local]
Update the Lean configuration file to retrieve data from the given provider
--data-provider-live [Interactive Brokers|Tradier|Oanda|Bitfinex|Coinbase Advanced Trade|Binance|Zerodha|Samco|Terminal Link|Kraken|TDAmeritrade|IQFeed|Polygon|IEX|Custom data only|Bybit]
The live data provider to use
--data-provider-historical [IQFeed|Polygon|IEX|AlphaVantage|QuantConnect|Local]
Update the Lean configuration file to retrieve data from the given historical provider
--ib-user-name TEXT Your Interactive Brokers username
--ib-account TEXT Your Interactive Brokers account id
--ib-password TEXT Your Interactive Brokers password
Expand Down Expand Up @@ -1466,10 +1466,10 @@ Options:
--parameter <TEXT FLOAT FLOAT FLOAT>...
The 'parameter min max step' pairs configuring the parameters to optimize
--constraint TEXT The 'statistic operator value' pairs configuring the constraints of the optimization
--data-provider [IQFeed|Polygon|IEX|AlphaVantage|QuantConnect|Local|Terminal Link]
Update the Lean configuration file to retrieve data from the given provider
--data-provider-historical [IQFeed|Polygon|IEX|AlphaVantage|QuantConnect|Local|Terminal Link]
Update the Lean configuration file to retrieve data from the given historical provider
--download-data Update the Lean configuration file to download data from the QuantConnect API, alias
for --data-provider QuantConnect
for --data-provider-historical QuantConnect
--release Compile C# projects in release configuration instead of debug
--image TEXT The LEAN engine image to use (defaults to quantconnect/lean:latest)
--update Pull the LEAN engine image before running the optimizer
Expand Down Expand Up @@ -1606,8 +1606,8 @@ Usage: lean research [OPTIONS] PROJECT
Options:
--port INTEGER The port to run Jupyter Lab on (defaults to 8888)
--data-provider [IQFeed|Polygon|IEX|AlphaVantage|QuantConnect|Local|Terminal Link]
Update the Lean configuration file to retrieve data from the given provider
--data-provider-historical [IQFeed|Polygon|IEX|AlphaVantage|QuantConnect|Local|Terminal Link]
Update the Lean configuration file to retrieve data from the given historical provider
--iqfeed-iqconnect TEXT The path to the IQConnect binary
--iqfeed-username TEXT Your IQFeed username
--iqfeed-password TEXT Your IQFeed password
Expand All @@ -1633,9 +1633,9 @@ Options:
--terminal-link-openfigi-api-key TEXT
The Open FIGI API key to use for mapping options
--download-data Update the Lean configuration file to download data from the QuantConnect API, alias
for --data-provider QuantConnect
for --data-provider-historical QuantConnect
--data-purchase-limit INTEGER The maximum amount of QCC to spend on downloading data during the research session
when using QuantConnect as data provider
when using QuantConnect as historical data provider
-d, --detach Run Jupyter Lab in a detached Docker container and return immediately
--no-open Don't open the Jupyter Lab environment in the browser after starting it
--image TEXT The LEAN research image to use (defaults to quantconnect/research:latest)
Expand Down
16 changes: 8 additions & 8 deletions lean/commands/backtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,18 +251,18 @@ def _select_organization() -> QCMinimalOrganization:
@option("--debug",
type=Choice(["pycharm", "ptvsd", "vsdbg", "rider", "local-platform"], case_sensitive=False),
help="Enable a certain debugging method (see --help for more information)")
@option("--data-provider",
@option("--data-provider-historical",
type=Choice([dp.get_name() for dp in all_data_providers], case_sensitive=False),
default="Local",
help="Update the Lean configuration file to retrieve data from the given provider")
help="Update the Lean configuration file to retrieve data from the given historical provider")
@options_from_json(get_configs_for_options("backtest"))
@option("--download-data",
is_flag=True,
default=False,
help="Update the Lean configuration file to download data from the QuantConnect API, alias for --data-provider QuantConnect")
help="Update the Lean configuration file to download data from the QuantConnect API, alias for --data-provider-historical QuantConnect")
@option("--data-purchase-limit",
type=int,
help="The maximum amount of QCC to spend on downloading data during the backtest when using QuantConnect as data provider")
help="The maximum amount of QCC to spend on downloading data during the backtest when using QuantConnect as historical data provider")
@option("--release",
is_flag=True,
default=False,
Expand Down Expand Up @@ -301,7 +301,7 @@ def backtest(project: Path,
output: Optional[Path],
detach: bool,
debug: Optional[str],
data_provider: Optional[str],
data_provider_historical: Optional[str],
download_data: bool,
data_purchase_limit: Optional[int],
release: bool,
Expand Down Expand Up @@ -363,12 +363,12 @@ def backtest(project: Path,
lean_config = lean_config_manager.get_complete_lean_config("backtesting", algorithm_file, debugging_method)

if download_data:
data_provider = QuantConnectDataProvider.get_name()
data_provider_historical = QuantConnectDataProvider.get_name()

organization_id = container.organization_manager.try_get_working_organization_id()

if data_provider is not None:
data_provider_configurer: DataProvider = get_and_build_module(data_provider, all_data_providers, kwargs, logger)
if data_provider_historical is not None:
data_provider_configurer: DataProvider = get_and_build_module(data_provider_historical, all_data_providers, kwargs, logger)
data_provider_configurer.ensure_module_installed(organization_id)
data_provider_configurer.configure(lean_config, "backtesting")

Expand Down
8 changes: 4 additions & 4 deletions lean/commands/cloud/live/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ def _configure_brokerage(lean_config: Dict[str, Any], logger: Logger, user_provi
hide_input=not show_secrets)

def _configure_data_feed(brokerage: CloudBrokerage, logger: Logger) -> None:
"""Configures the data feed to use based on the brokerage given.
"""Configures the live data provider to use based on the brokerage given.
:param brokerage: the cloud brokerage
:param logger: the logger to use
"""
if len(cloud_brokerage_data_feeds[brokerage]) != 0:
data_feed_selected = logger.prompt_list("Select a data feed", [
data_feed_selected = logger.prompt_list("Select a live data provider", [
Option(id=data_feed, label=data_feed) for data_feed in cloud_brokerage_data_feeds[brokerage]
], multiple=False)
data_feed_property_name = [name for name in brokerage.get_required_properties([InternalInputUserInput]) if ("data-feed" in name)]
Expand Down Expand Up @@ -265,7 +265,7 @@ def deploy(project: str,
ensure_options(essential_properties)
essential_properties_value = {brokerage_instance.convert_variable_to_lean_key(prop) : kwargs[prop] for prop in essential_properties}
brokerage_instance.update_configs(essential_properties_value)
# now required properties can be fetched as per data provider from essential properties
# now required properties can be fetched as per historical data provider from essential properties
required_properties = [brokerage_instance.convert_lean_key_to_variable(prop) for prop in brokerage_instance.get_required_properties([InternalInputUserInput])]
ensure_options(required_properties)
required_properties_value = {brokerage_instance.convert_variable_to_lean_key(prop) : kwargs[prop] for prop in required_properties}
Expand Down Expand Up @@ -340,7 +340,7 @@ def deploy(project: str,
logger.info(f"Environment: {brokerage_settings['environment'].title()}")
logger.info(f"Server name: {live_node.name}")
logger.info(f"Server type: {live_node.sku}")
logger.info(f"Data provider: {price_data_handler.replace('Handler', '')}")
logger.info(f"Live data provider: {price_data_handler.replace('Handler', '')}")
logger.info(f"LEAN version: {cloud_project.leanVersionId}")
logger.info(f"Order event notifications: {'Yes' if notify_order_events else 'No'}")
logger.info(f"Insight notifications: {'Yes' if notify_insights else 'No'}")
Expand Down
36 changes: 18 additions & 18 deletions lean/commands/live/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def _configure_lean_config_interactively(lean_config: Dict[str, Any],

brokerage.build(lean_config, logger, properties, hide_input=not show_secrets).configure(lean_config, environment_name)

data_feeds = logger.prompt_list("Select a data feed", [
data_feeds = logger.prompt_list("Select a live data provider", [
Option(id=data_feed, label=data_feed.get_name()) for data_feed in local_brokerage_data_feeds[brokerage]
], multiple= True)
for data_feed in data_feeds:
Expand Down Expand Up @@ -228,14 +228,14 @@ def _get_default_value(key: str) -> Optional[Any]:
@option("--brokerage",
type=Choice([b.get_name() for b in all_local_brokerages], case_sensitive=False),
help="The brokerage to use")
@option("--data-feed",
@option("--data-provider-live",
type=Choice([d.get_name() for d in all_local_data_feeds], case_sensitive=False),
multiple=True,
help="The data feed to use")
@option("--data-provider",
help="The live data provider to use")
@option("--data-provider-historical",
type=Choice([dp.get_name() for dp in all_data_providers if dp._id != "TerminalLinkBrokerage"], case_sensitive=False),
default="Local",
help="Update the Lean configuration file to retrieve data from the given provider")
help="Update the Lean configuration file to retrieve data from the given historical provider")
@options_from_json(get_configs_for_options("live-local"))
@option("--release",
is_flag=True,
Expand Down Expand Up @@ -282,8 +282,8 @@ def deploy(project: Path,
output: Optional[Path],
detach: bool,
brokerage: Optional[str],
data_feed: Optional[str],
data_provider: Optional[str],
data_provider_live: Optional[str],
data_provider_historical: Optional[str],
release: bool,
image: Optional[str],
python_venv: Optional[str],
Expand All @@ -302,14 +302,14 @@ def deploy(project: Path,
If PROJECT is a directory, the algorithm in the main.py or Main.cs file inside it will be executed.
If PROJECT is a file, the algorithm in the specified file will be executed.
By default an interactive wizard is shown letting you configure the brokerage and data feed to use.
If --environment, --brokerage or --data-feed are given the command runs in non-interactive mode.
By default an interactive wizard is shown letting you configure the brokerage and live data provider to use.
If --environment, --brokerage or --data-provider-live are given the command runs in non-interactive mode.
In this mode the CLI does not prompt for input.
If --environment is given it must be the name of a live environment in the Lean configuration.
If --brokerage and --data-feed are given, the options specific to the given brokerage/data feed must also be given.
The Lean config is used as fallback when a brokerage/data feed-specific option hasn't been passed in.
If --brokerage and --data-provider-live are given, the options specific to the given brokerage/live data provider must also be given.
The Lean config is used as fallback when a brokerage/live data provider-specific option hasn't been passed in.
If a required option is not given and cannot be found in the Lean config the command aborts.
By default the official LEAN engine image is used.
Expand All @@ -333,8 +333,8 @@ def deploy(project: Path,

lean_config_manager = container.lean_config_manager

if environment is not None and (brokerage is not None or len(data_feed) > 0):
raise RuntimeError("--environment and --brokerage + --data-feed are mutually exclusive")
if environment is not None and (brokerage is not None or len(data_provider_live) > 0):
raise RuntimeError("--environment and --brokerage + --data-provider-live are mutually exclusive")

if environment is not None:
environment_name = environment
Expand Down Expand Up @@ -385,7 +385,7 @@ def deploy(project: Path,
[update_essential_properties_available([brokerage_configurer], kwargs)]
[update_essential_properties_available(data_feed_configurers, kwargs)]

elif brokerage is not None or len(data_feed) > 0:
elif brokerage is not None or len(data_provider_live) > 0:
ensure_options(["brokerage", "data_feed"])

environment_name = "lean-cli"
Expand All @@ -398,7 +398,7 @@ def deploy(project: Path,
[brokerage_configurer] = [get_and_build_module(brokerage, all_local_brokerages, kwargs, logger)]
brokerage_configurer.configure(lean_config, environment_name)

for df in data_feed:
for df in data_provider_live:
[data_feed_configurer] = [get_and_build_module(df, all_local_data_feeds, kwargs, logger)]
data_feed_configurer.configure(lean_config, environment_name)

Expand All @@ -407,8 +407,8 @@ def deploy(project: Path,
lean_config = lean_config_manager.get_complete_lean_config(environment_name, algorithm_file, None)
_configure_lean_config_interactively(lean_config, environment_name, kwargs, show_secrets=show_secrets)

if data_provider is not None:
[data_provider_configurer] = [get_and_build_module(data_provider, all_data_providers, kwargs, logger)]
if data_provider_historical is not None:
[data_provider_configurer] = [get_and_build_module(data_provider_historical, all_data_providers, kwargs, logger)]
data_provider_configurer.configure(lean_config, environment_name)

if "environments" not in lean_config or environment_name not in lean_config["environments"]:
Expand Down Expand Up @@ -444,7 +444,7 @@ def deploy(project: Path,
cash_balance_option, holdings_option, last_cash, last_holdings = get_last_portfolio_cash_holdings(container.api_client, env_brokerage,
project_config.get("cloud-id", None), project)

if environment is None and brokerage is None and len(data_feed) == 0: # condition for using interactive panel
if environment is None and brokerage is None and len(data_provider_live) == 0: # condition for using interactive panel
if cash_balance_option != LiveInitialStateInput.NotSupported:
live_cash_balance = _configure_initial_cash_interactively(logger, cash_balance_option, last_cash)

Expand Down
Loading

0 comments on commit d1034be

Please sign in to comment.