-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a031b02
commit 9143472
Showing
27 changed files
with
423 additions
and
790 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals. | ||
# Lean CLI v1.0. Copyright 2021 QuantConnect Corporation. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from typing import Dict, Any | ||
|
||
from lean.models.logger import Option | ||
from lean.models.json_module import JsonModule | ||
from lean.components.util.logger import Logger | ||
|
||
|
||
def interactive_data_queue_handlers_config(lean_config: Dict[str, Any], models: [JsonModule], logger: Logger, | ||
user_provided_options: Dict[str, Any], show_secrets: bool) -> [JsonModule]: | ||
"""Configures the live data provider to use. | ||
:param lean_config: the LEAN configuration that should be used | ||
:param models: the modules to choose from | ||
:param logger: the logger to use | ||
:param user_provided_options: the dictionary containing user provided options | ||
:param show_secrets: whether to show secrets on input | ||
:return: the live data providers the user configured | ||
""" | ||
data_feeds_options = [Option(id=b, label=b.get_name()) for b in models] | ||
|
||
data_feeds: [JsonModule] = logger.prompt_list("Select a live data feed", data_feeds_options, multiple=True) | ||
for data_feed in data_feeds: | ||
data_feed.interactive_config_build(lean_config, logger, user_provided_options, hide_input=not show_secrets) | ||
|
||
logger.debug(f'interactive_data_queue_handlers_config(\'{data_feed}\'): Settings: {data_feed.get_settings()}') | ||
|
||
return data_feeds | ||
|
||
|
||
def interactive_brokerage_config(lean_config: Dict[str, Any], models: [JsonModule], logger: Logger, | ||
user_provided_options: Dict[str, Any], show_secrets: bool) -> JsonModule: | ||
"""Interactively configures the brokerage to use. | ||
:param lean_config: the LEAN configuration that should be used | ||
:param models: the modules to choose from | ||
:param logger: the logger to use | ||
:param user_provided_options: the dictionary containing user provided options | ||
:param show_secrets: whether to show secrets on input | ||
:return: the brokerage the user configured | ||
""" | ||
brokerage_options = [Option(id=b, label=b.get_name()) for b in models] | ||
brokerage: JsonModule = logger.prompt_list("Select a brokerage", brokerage_options) | ||
brokerage.interactive_config_build(lean_config, logger, user_provided_options, hide_input=not show_secrets) | ||
|
||
logger.debug(f'interactive_brokerage_config(\'{brokerage}\'): Settings: {brokerage.get_settings()}') | ||
|
||
return brokerage |
Oops, something went wrong.