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

Epic/config management refactoring #5428

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
196 commits
Select commit Hold shift + click to select a range
ed33eb4
(refactor) Adapts Avellaneda config map for pydantic.
petioptrv Feb 18, 2022
d39995a
(fix) addresses a potential problem in parsing sub-models.
petioptrv Feb 18, 2022
dca2f69
(cleanup) Edited misleading comment
petioptrv Feb 18, 2022
f2124a7
Merge branch 'development' into refactor/avellaneda_config_map_pydantic
petioptrv Feb 18, 2022
e795c30
Update hummingbot/client/config/config_data_types.py
petioptrv Feb 22, 2022
2913ded
(fix) Addresses @aarmoa's PR comments
petioptrv Feb 22, 2022
7342751
Merge remote-tracking branch 'origin/refactor/avellaneda_config_map_p…
petioptrv Feb 22, 2022
ad111a7
(cleanup) Adds clarification comments to client-specific validations
petioptrv Feb 22, 2022
a15f757
Merge branch 'development' into refactor/avellaneda_config_map_pydantic
petioptrv Feb 22, 2022
f85e949
Update test/hummingbot/strategy/avellaneda_market_making/test_config.yml
petioptrv Feb 23, 2022
65b0bd7
(cleanup) Makes sub-model validators a bit more precise.
petioptrv Feb 23, 2022
344a187
Merge remote-tracking branch 'origin/refactor/avellaneda_config_map_p…
petioptrv Feb 23, 2022
e652242
(cleanup) Adds the last prompt functions as class methods to the conf…
petioptrv Feb 24, 2022
832153c
(refactor) Adapts Avellaneda config map for pydantic.
petioptrv Feb 18, 2022
c2c42e2
(fix) addresses a potential problem in parsing sub-models.
petioptrv Feb 18, 2022
71cf8db
(cleanup) Edited misleading comment
petioptrv Feb 18, 2022
d1314cb
(fix) Addresses @aarmoa's PR comments
petioptrv Feb 22, 2022
8b71afe
Update hummingbot/client/config/config_data_types.py
petioptrv Feb 22, 2022
c5301d1
(cleanup) Adds clarification comments to client-specific validations
petioptrv Feb 22, 2022
9c25a74
(cleanup) Makes sub-model validators a bit more precise.
petioptrv Feb 23, 2022
f71994a
Update test/hummingbot/strategy/avellaneda_market_making/test_config.yml
petioptrv Feb 23, 2022
0e83f33
(cleanup) Adds the last prompt functions as class methods to the conf…
petioptrv Feb 24, 2022
8e7e7ea
Merge remote-tracking branch 'origin/refactor/avellaneda_config_map_p…
petioptrv Mar 4, 2022
63a59db
Merge pull request #96 from CoinAlpha/refactor/avellaneda_config_map_…
petioptrv Mar 4, 2022
92ff8c8
(feat) add functions to load pydantic configs in config_helpers.py
Mar 7, 2022
36df306
(refactor) Adapts the create command to work with the new pydantic co…
petioptrv Mar 11, 2022
572ea2b
(refactor) Adapts the config command to work with the new pydantic co…
petioptrv Mar 21, 2022
2feed79
(fix) Fixes the paper-trade and multiple-exchange-status-printout iss…
petioptrv Mar 22, 2022
c7be742
Update hummingbot/client/command/config_command.py
petioptrv Mar 23, 2022
2d0cb71
Update hummingbot/client/command/create_command.py
petioptrv Mar 23, 2022
e138933
Update hummingbot/client/command/status_command.py
petioptrv Mar 23, 2022
b417433
Update hummingbot/client/command/status_command.py
petioptrv Mar 23, 2022
b568339
Update hummingbot/strategy/avellaneda_market_making/start.py
petioptrv Mar 23, 2022
bffd78b
Update test/hummingbot/strategy/avellaneda_market_making/test_avellan…
petioptrv Mar 23, 2022
a3c5639
Update test/hummingbot/strategy/avellaneda_market_making/test_avellan…
petioptrv Mar 23, 2022
f1fcf3b
(fix) Addresses @aarmoa's PR comments.
petioptrv Mar 23, 2022
2dd2405
Merge remote-tracking branch 'origin/refactor/adapt_create_and_config…
petioptrv Mar 23, 2022
ecd8e7b
Merge pull request #155 from CoinAlpha/refactor/adapt_create_and_conf…
petioptrv Mar 25, 2022
0c17402
Merge branch 'feat/config_management_refactoring' into feat/import_co…
petioptrv Mar 31, 2022
e9f489d
Merge branch 'feat/config_management_refactoring' into feat/import_co…
petioptrv Mar 31, 2022
ee5fb8b
(feat) Allows the import command to handle pydantic-based configs.
petioptrv Apr 1, 2022
254379e
(fix) Ensures that AMM config can convert between modes successfully.
petioptrv Apr 4, 2022
6d337f1
(fix) Fixes failure to cancel the strategy creation process.
petioptrv Apr 5, 2022
f5c405d
Update hummingbot/client/command/config_command.py
petioptrv Apr 6, 2022
5531684
Update hummingbot/client/command/create_command.py
petioptrv Apr 6, 2022
53fde5c
Update hummingbot/client/config/config_data_types.py
petioptrv Apr 6, 2022
7db80ee
Update hummingbot/client/config/config_helpers.py
petioptrv Apr 6, 2022
89f9063
Update hummingbot/client/config/config_helpers.py
petioptrv Apr 6, 2022
7eaea15
Update test/hummingbot/client/command/test_import_command.py
petioptrv Apr 6, 2022
58ec95e
Update test/hummingbot/client/command/test_import_command.py
petioptrv Apr 6, 2022
9f6794c
Update test/hummingbot/client/command/test_import_command.py
petioptrv Apr 6, 2022
a8c0545
Update test/hummingbot/client/config/test_config_data_types.py
petioptrv Apr 6, 2022
279e5c5
Update test/hummingbot/client/config/test_config_helpers.py
petioptrv Apr 6, 2022
8cecbbf
(cleanup) Addresses @aarmoa's PR comments.
petioptrv Apr 6, 2022
d1a40e6
Merge remote-tracking branch 'origin/feat/import_command_works_with_p…
petioptrv Apr 6, 2022
7159e22
Attempting to add isort hook
petioptrv Apr 6, 2022
2b0e132
Revert "Attempting to add isort hook"
petioptrv Apr 6, 2022
b03598e
Update hummingbot/client/config/config_data_types.py
petioptrv Apr 7, 2022
4b531e0
Merge pull request #188 from CoinAlpha/feat/import_command_works_with…
petioptrv Apr 7, 2022
7c4b6e7
Merge branch 'development' into feat/config_management_refactoring
petioptrv Apr 14, 2022
e5bf76e
(fix) Fixes failing test case
petioptrv Apr 15, 2022
07bb3b6
Merge branch 'development' into feat/config_management_refactoring
petioptrv Apr 27, 2022
e2d6af6
(cleanup) Reverts the env name
petioptrv Apr 28, 2022
b1148ee
(feat) Refactor secure configs stroing
petioptrv May 4, 2022
5b61de7
(feat) Better migration process
petioptrv May 4, 2022
68828bc
(fix) Fixing QA-flagged issues
petioptrv May 5, 2022
6f8acff
(fix) Additional fixes
petioptrv May 6, 2022
77cf7e4
(fix) Fixes password check
petioptrv May 6, 2022
357e131
(fix) Fixes folder creation in docker container
petioptrv May 6, 2022
0ee9d64
(fix) Fixes QA-raised issues
petioptrv May 10, 2022
877b186
(refactor) base trailing indicator - sampling & pr buffer length hand…
May 10, 2022
3284e78
(refactor) ring buffer length setting
May 10, 2022
3a3d0c8
(refactor) trading intensity sampling length setting
May 10, 2022
e8e7130
(refactor) avellaneda - settings from config map
May 10, 2022
5ea01c7
(refactor) tests
May 10, 2022
5f6face
(fix) Fixes further issues with quick_start.py
petioptrv May 10, 2022
85d433c
(fix) execution timeframe mode parameter exception handling
May 11, 2022
5d3a064
(fix) handing orders config re-instantiation
May 11, 2022
761deb2
(fix) Fixing missing sub-folder on container create
petioptrv May 11, 2022
6cc4808
Update hummingbot/strategy/avellaneda_market_making/avellaneda_market…
mhrvth May 12, 2022
e3d90dd
Update hummingbot/strategy/avellaneda_market_making/avellaneda_market…
mhrvth May 12, 2022
b2b78eb
Update hummingbot/strategy/avellaneda_market_making/avellaneda_market…
mhrvth May 12, 2022
09142fa
(fix) ring buffer - sampling length, processing length variables removed
May 12, 2022
6671c3d
(refactor) warning silent
May 12, 2022
c3d3d94
(fix) conditional execution state __eq__ added
May 12, 2022
8d35f39
(fix) Fixes Kraken configs migration
petioptrv May 13, 2022
f06d07d
(fix) Removes check for secure param on migration
petioptrv May 13, 2022
4fc73ee
(refactor) setters removed
May 13, 2022
9cc40b2
Update test/hummingbot/strategy/avellaneda_market_making/test_avellan…
mhrvth May 13, 2022
911fe2c
(fix) Fixing a typo in the install script
petioptrv May 13, 2022
31c6213
Merge branch 'development' into refactor/avellaneda_settings_from_con…
May 13, 2022
a6a35f1
Merging development.
petioptrv May 13, 2022
d324c25
Merging development.
petioptrv May 16, 2022
b966c88
(fix) Fixing loading encrypted configs that are not supposed to secret
petioptrv May 16, 2022
0feb9e2
(cleanup) Adding config title to connector configs
petioptrv May 16, 2022
4991a30
(fix) Removing the migration functions from coverage reports
petioptrv May 16, 2022
a3e2a7c
Merge remote-tracking branch 'origin/epic/config_management_refactori…
petioptrv May 16, 2022
5313962
Merge branch 'feat/storing_secure_configs' into feat/migrate_global_c…
petioptrv May 16, 2022
bf75a5a
Merge branch 'epic/config_management_refactoring' into refactor/avell…
May 16, 2022
e4ba35f
(refactor) formatting
May 16, 2022
55bee8c
(refactor) formatting
May 16, 2022
e787e5c
(refactor) formatting
May 16, 2022
d2da015
(refactor) formatting
May 16, 2022
2f14238
Merge pull request #234 from CoinAlpha/refactor/avellaneda_settings_f…
mhrvth May 16, 2022
ebb8e53
Merge branch 'epic/config_management_refactoring' into feat/storing_s…
petioptrv May 16, 2022
7461aa6
(fix) Moving mock paper trade exchange in a module
petioptrv May 17, 2022
b4e613e
(fix) Addressing the issue of strategies not migrating
petioptrv May 18, 2022
1619fba
Update hummingbot/connector/derivative/binance_perpetual/binance_perp…
petioptrv May 18, 2022
017d1e8
Update hummingbot/client/config/conf_migration.py
petioptrv May 18, 2022
9f286e3
(fix) Addresses @aarmoa's PR comments
petioptrv May 18, 2022
aa8ecf2
Merge remote-tracking branch 'origin/feat/storing_secure_configs' int…
petioptrv May 18, 2022
5cc7881
Merge branch 'feat/storing_secure_configs' into feat/migrate_global_c…
petioptrv May 18, 2022
5f7a91b
(refactor) config map
May 18, 2022
ad4456d
(feat) refactoring
May 18, 2022
287eb28
(feat) fix
May 18, 2022
686ac6b
(feat) fix
May 18, 2022
d8f05b9
(feat) refactor
May 18, 2022
f2a2fbb
(feat) tests
May 19, 2022
e8200ad
(feat) refactor
May 19, 2022
f572aa5
(feat) removed XEMM from test
May 19, 2022
1b067c5
(fix) Reverting previous changes to connect command
petioptrv May 19, 2022
8e0d4ba
(feat) descriptions
May 19, 2022
3991509
Update hummingbot/client/config/config_data_types.py
mhrvth May 19, 2022
1b68a12
Update hummingbot/client/config/config_data_types.py
mhrvth May 19, 2022
c824fd8
Update hummingbot/strategy/cross_exchange_market_making/cross_exchang…
mhrvth May 19, 2022
0f153a8
Merge branch 'feat/xemm_config_map' of https://github.com/CoinAlpha/h…
May 19, 2022
c230e6d
(refactor) Refactors connect command to simplify the code
petioptrv May 20, 2022
d70e606
Merge branch 'feat/storing_secure_configs' into feat/migrate_global_c…
petioptrv May 20, 2022
66f9abf
Merge pull request #229 from CoinAlpha/feat/storing_secure_configs
petioptrv May 20, 2022
c0407ab
Merge remote-tracking branch 'origin/epic/config_management_refactori…
petioptrv May 20, 2022
a5dc6d1
(fix) create command
May 20, 2022
9096f07
(fix) avellaneda
May 20, 2022
ef51651
(fix) OOP submodels & tests
May 20, 2022
88fc62e
(feat) config template yml deleted
May 20, 2022
1bd670a
Merge branch 'epic/config_management_refactoring' into feat/xemm_conf…
May 20, 2022
696b67f
(feat) validate_decimal()
May 20, 2022
31b76f9
(feat) config map pydantic tests
May 20, 2022
7ec1c00
(feat) config map pydantic tests
May 20, 2022
ee8e5f3
(feat) test yml
May 20, 2022
3594501
(refactor) Completed implementation - no debugging, no testing
petioptrv May 23, 2022
7fe3b80
Update hummingbot/strategy/cross_exchange_market_making/cross_exchang…
mhrvth May 23, 2022
0626eb1
Update hummingbot/strategy/cross_exchange_market_making/cross_exchang…
mhrvth May 23, 2022
74dc84e
Update hummingbot/strategy/cross_exchange_market_making/cross_exchang…
mhrvth May 23, 2022
f846b7c
Update hummingbot/strategy/cross_exchange_market_making/cross_exchang…
mhrvth May 23, 2022
276a85f
Update hummingbot/strategy/cross_exchange_market_making/cross_exchang…
mhrvth May 23, 2022
3bd6b41
(feat) fix
May 23, 2022
741f029
(feat) migration script
May 23, 2022
a4b6b89
(fix) Fixing bugs
petioptrv May 23, 2022
b8f0428
(fix) Fixing more bugs
petioptrv May 23, 2022
962bcc7
(feat) migration script improvements
May 23, 2022
664fea8
(feat) migration script refactor
May 24, 2022
cb35681
(feat) remove double logging
May 24, 2022
eba99d4
Update hummingbot/client/config/conf_migration.py
mhrvth May 24, 2022
e5133d2
(feat) improvements
May 24, 2022
edd7860
Merge pull request #240 from CoinAlpha/feat/xemm_config_map
mhrvth May 25, 2022
30753ab
Merge branch 'development' of https://github.com/CoinAlpha/hummingbot…
petioptrv May 31, 2022
a6e4da6
(feat) Fix all failing unit tests after refactoring to transfor clien…
aarmoa May 31, 2022
1ca80ed
Merge branch 'epic/config_management_refactoring' of https://github.c…
petioptrv Jun 1, 2022
4d46754
(fix) Introduces several fixes following the merge
petioptrv Jun 2, 2022
5532150
(fix) Introduces several fixes following the merge
petioptrv Jun 2, 2022
21c6bca
(fix) Fixes failing tests
petioptrv Jun 2, 2022
de031dd
(feat) Adds a migration step for AMM
petioptrv Jun 2, 2022
42cde15
(fix) Disables strategy configuration while the strategy is running
petioptrv Jun 2, 2022
e6a47bc
Merge branch 'development' into epic/config_management_refactoring
petioptrv Jun 3, 2022
2afc210
(fix) Fixes failing tests after the merge
petioptrv Jun 3, 2022
ffa4b1b
Merge branch 'epic/config_management_refactoring' into feat/migrate_g…
petioptrv Jun 3, 2022
8df8987
(fix) Fixes failing tests after the merge
petioptrv Jun 3, 2022
4b44998
Merge branch 'feat/migrate_global_config_to_pydantic' into feat/amm_m…
petioptrv Jun 3, 2022
be9e9b7
(fix) Addresses all QA comments
petioptrv Jun 3, 2022
8a6a7a9
(fix) Fixes quickstart file
petioptrv Jun 3, 2022
62b9092
Merge branch 'feat/migrate_global_config_to_pydantic' into feat/amm_m…
petioptrv Jun 3, 2022
b2f3991
(fix) Bug fix for the `gateway create` command
petioptrv Jun 8, 2022
08e343f
(fix) Fixes the migration of celo configs
petioptrv Jun 8, 2022
203d8a0
Merge branch 'feat/migrate_global_config_to_pydantic' into feat/amm_m…
petioptrv Jun 9, 2022
b409311
Merge pull request #252 from CoinAlpha/feat/amm_migration_script
petioptrv Jun 9, 2022
8a5011e
Update hummingbot/client/command/balance_command.py
petioptrv Jun 10, 2022
d2e6b66
(fix) Addresses @aarmoa's PR comments
petioptrv Jun 10, 2022
e3a59ae
(fix) Quick bug fix for Celo connect command
petioptrv Jun 10, 2022
3c37e5b
Merge pull request #251 from CoinAlpha/feat/migrate_global_config_to_…
petioptrv Jun 13, 2022
7f1eac2
Merge branch 'development' into epic/config_management_refactoring
petioptrv Jun 13, 2022
1edc110
(fix) Fixes `celo_address` not being properly migrated
petioptrv Jun 14, 2022
d9edf3b
(fix) Fixes kill switch and scripts bugs
petioptrv Jun 15, 2022
3b95dec
Merge branch 'development' of https://github.com/CoinAlpha/hummingbot…
petioptrv Jun 22, 2022
abbbdce
Merge branch 'development' into epic/config_management_refactoring
petioptrv Jun 22, 2022
7a52c44
Merge branch 'development' of https://github.com/CoinAlpha/hummingbot…
petioptrv Jun 22, 2022
e6f7500
(fix) Test case fix
petioptrv Jun 22, 2022
892e32f
(fix) Test case fix
petioptrv Jun 22, 2022
820d080
(fix) Adds the docker conf copy step to the arm dockerfile
petioptrv Jun 23, 2022
ae62b8c
(fix) If there are no config keys, don't traverse in `settings`
petioptrv Jun 27, 2022
95f9356
(cleanup) Adds friendlier outputs
petioptrv Jun 28, 2022
c048e5f
(fix) Bug fix.
petioptrv Jun 28, 2022
863b7f4
(cleanup) Adds precision to the treatment of default values
petioptrv Jun 28, 2022
580ef26
(fix) Fixes the config default handling
petioptrv Jun 28, 2022
38fbbd8
(fix) Fixes issues with the connector settings class
petioptrv Jun 29, 2022
bd9e62f
Merge branch 'development' into epic/config_management_refactoring
petioptrv Jun 29, 2022
d62db0e
Merge branch 'development' into epic/config_management_refactoring
JeremyKono Jun 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ omit =
hummingbot/core/gateway/*
hummingbot/core/management/*
hummingbot/client/config/config_helpers.py
hummingbot/client/config/conf_migration.py
hummingbot/client/config/security.py
hummingbot/client/hummingbot_application.py
hummingbot/client/command/*
Expand Down Expand Up @@ -37,6 +38,7 @@ omit =
hummingbot/core/utils/wallet_setup.py
hummingbot/connector/mock*
hummingbot/strategy/aroon_oscillator*
hummingbot/strategy/*/start.py
hummingbot/strategy/dev*
hummingbot/strategy/hedge*
hummingbot/user/user_balances.py
Expand Down
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/conf
/data
/logs
/build
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,6 @@ coverage.xml

# Debug console
.debug_console_ssh_host_key

# password file
.password_verification
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ VOLUME /conf /logs /data /pmm_scripts /scripts \
COPY --chown=hummingbot:hummingbot pmm_scripts/ pmm_scripts/
# Pre-populate scripts/ volume with default scripts
COPY --chown=hummingbot:hummingbot scripts/ scripts/
# Copy the conf folder structure
COPY --chown=hummingbot:hummingbot conf/ conf/

# Install packages required in runtime
RUN apt-get update && \
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile.arm
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ VOLUME /conf /logs /data /pmm_scripts /scripts \

# Pre-populate pmm_scripts/ volume with default pmm_scripts
COPY --chown=hummingbot:hummingbot pmm_scripts/ pmm_scripts/

# Pre-populate scripts/ volume with default scripts
COPY --chown=hummingbot:hummingbot scripts/ scripts/
# Copy the conf folder structure
COPY --chown=hummingbot:hummingbot conf/ conf/

# Install packages required in runtime
RUN apt-get update && \
Expand Down
13 changes: 13 additions & 0 deletions bin/conf_migration_script.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import argparse

import path_util # noqa: F401

from hummingbot.client.config.conf_migration import migrate_configs
from hummingbot.client.config.config_crypt import ETHKeyFileSecretManger

if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Migrate the HummingBot confs")
parser.add_argument("password", type=str, help="Required to migrate all encrypted configs.")
args = parser.parse_args()
secrets_manager_ = ETHKeyFileSecretManger(args.password)
migrate_configs(secrets_manager_)
39 changes: 21 additions & 18 deletions bin/hummingbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@

from bin.docker_connection import fork_and_start
from hummingbot import chdir_to_data_directory, init_logging
from hummingbot.client.config.config_helpers import create_yml_files, read_system_configs_from_yml, write_config_to_yml
from hummingbot.client.config.global_config_map import global_config_map
from hummingbot.client.config.config_crypt import ETHKeyFileSecretManger
from hummingbot.client.config.config_helpers import (
ClientConfigAdapter,
create_yml_files_legacy,
load_client_config_map_from_file,
write_config_to_yml,
)
from hummingbot.client.hummingbot_application import HummingbotApplication
from hummingbot.client.settings import AllConnectorSettings
from hummingbot.client.ui import login_prompt
Expand All @@ -35,31 +40,28 @@ def hummingbot_app(self) -> HummingbotApplication:

async def ui_start_handler(self):
hb: HummingbotApplication = self.hummingbot_app
if hb.strategy_config_map is not None:
write_config_to_yml(hb.strategy_config_map, hb.strategy_file_name, hb.client_config_map)
hb.start(self._hb_ref.client_config_map.log_level)

if hb.strategy_file_name is not None and hb.strategy_name is not None:
await write_config_to_yml(hb.strategy_name, hb.strategy_file_name)
hb.start(global_config_map.get("log_level").value)


async def main_async():
await create_yml_files()
async def main_async(client_config_map: ClientConfigAdapter):
await create_yml_files_legacy()

# This init_logging() call is important, to skip over the missing config warnings.
init_logging("hummingbot_logs.yml")

await read_system_configs_from_yml()
init_logging("hummingbot_logs.yml", client_config_map)

AllConnectorSettings.initialize_paper_trade_settings(global_config_map.get("paper_trade_exchanges").value)
AllConnectorSettings.initialize_paper_trade_settings(client_config_map.paper_trade.paper_trade_exchanges)

hb = HummingbotApplication.main_application()
hb = HummingbotApplication.main_application(client_config_map)

# The listener needs to have a named variable for keeping reference, since the event listener system
# uses weak references to remove unneeded listeners.
start_listener: UIStartListener = UIStartListener(hb)
hb.app.add_listener(HummingbotUIEvent.Start, start_listener)

tasks: List[Coroutine] = [hb.run(), start_existing_gateway_container()]
if global_config_map.get("debug_console").value:
tasks: List[Coroutine] = [hb.run(), start_existing_gateway_container(client_config_map)]
if client_config_map.debug_console:
if not hasattr(__builtins__, "help"):
import _sitebuiltins
__builtins__.help = _sitebuiltins._Helper()
Expand All @@ -72,10 +74,11 @@ async def main_async():

def main():
chdir_to_data_directory()
secrets_manager_cls = ETHKeyFileSecretManger
ev_loop: asyncio.AbstractEventLoop = asyncio.get_event_loop()
ev_loop.run_until_complete(read_system_configs_from_yml())
if login_prompt(style=load_style()):
ev_loop.run_until_complete(main_async())
client_config_map = load_client_config_map_from_file()
if login_prompt(secrets_manager_cls, style=load_style(client_config_map)):
ev_loop.run_until_complete(main_async(client_config_map))


if __name__ == "__main__":
Expand Down
57 changes: 34 additions & 23 deletions bin/hummingbot_quickstart.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@
from bin.docker_connection import fork_and_start
from bin.hummingbot import UIStartListener, detect_available_port
from hummingbot import init_logging
from hummingbot.client.config.config_crypt import BaseSecretsManager, ETHKeyFileSecretManger
from hummingbot.client.config.config_data_types import BaseStrategyConfigMap
from hummingbot.client.config.config_helpers import (
all_configs_complete,
create_yml_files,
create_yml_files_legacy,
load_client_config_map_from_file,
load_strategy_config_map_from_file,
read_system_configs_from_yml,
update_strategy_config_map_from_file,
)
from hummingbot.client.config.global_config_map import global_config_map
from hummingbot.client.config.security import Security
from hummingbot.client.hummingbot_application import HummingbotApplication
from hummingbot.client.settings import CONF_FILE_PATH, AllConnectorSettings
from hummingbot.client.settings import STRATEGIES_CONF_DIR_PATH, AllConnectorSettings
from hummingbot.client.ui import login_prompt
from hummingbot.client.ui.style import load_style
from hummingbot.core.event.events import HummingbotUIEvent
Expand Down Expand Up @@ -71,46 +73,51 @@ def autofix_permissions(user_group_spec: str):
os.setuid(uid)


async def quick_start(args: argparse.Namespace):
async def quick_start(args: argparse.Namespace, secrets_manager: BaseSecretsManager):
config_file_name = args.config_file_name
password = args.config_password
client_config = load_client_config_map_from_file()

if args.auto_set_permissions is not None:
autofix_permissions(args.auto_set_permissions)

if password is not None and not Security.login(password):
if not Security.login(secrets_manager):
logging.getLogger().error("Invalid password.")
return

await Security.wait_til_decryption_done()
await create_yml_files()
init_logging("hummingbot_logs.yml")
await create_yml_files_legacy()
init_logging("hummingbot_logs.yml", client_config)
await read_system_configs_from_yml()

AllConnectorSettings.initialize_paper_trade_settings(global_config_map.get("paper_trade_exchanges").value)
AllConnectorSettings.initialize_paper_trade_settings(client_config.paper_trade.paper_trade_exchanges)

hb = HummingbotApplication.main_application()
# Todo: validate strategy and config_file_name before assinging

strategy_config = None
if config_file_name is not None:
hb.strategy_file_name = config_file_name
hb.strategy_name = await update_strategy_config_map_from_file(os.path.join(CONF_FILE_PATH, config_file_name))

# To ensure quickstart runs with the default value of False for kill_switch_enabled if not present
if not global_config_map.get("kill_switch_enabled"):
global_config_map.get("kill_switch_enabled").value = False

if hb.strategy_name and hb.strategy_file_name:
if not all_configs_complete(hb.strategy_name):
strategy_config = await load_strategy_config_map_from_file(
STRATEGIES_CONF_DIR_PATH / config_file_name
)
hb.strategy_name = (
strategy_config.strategy
if isinstance(strategy_config, BaseStrategyConfigMap)
else strategy_config.get("strategy").value
)
hb.strategy_config_map = strategy_config

if strategy_config is not None:
if not all_configs_complete(strategy_config, hb.client_config_map):
hb.status()

# The listener needs to have a named variable for keeping reference, since the event listener system
# uses weak references to remove unneeded listeners.
start_listener: UIStartListener = UIStartListener(hb)
hb.app.add_listener(HummingbotUIEvent.Start, start_listener)

tasks: List[Coroutine] = [hb.run(), start_existing_gateway_container()]
if global_config_map.get("debug_console").value:
tasks: List[Coroutine] = [hb.run(), start_existing_gateway_container(client_config)]
if client_config.debug_console:
management_port: int = detect_available_port(8211)
tasks.append(start_management_console(locals(), host="localhost", port=management_port))

Expand All @@ -129,12 +136,16 @@ def main():
args.config_password = os.environ["CONFIG_PASSWORD"]

# If no password is given from the command line, prompt for one.
asyncio.get_event_loop().run_until_complete(read_system_configs_from_yml())
secrets_manager_cls = ETHKeyFileSecretManger
client_config_map = load_client_config_map_from_file()
if args.config_password is None:
if not login_prompt(style=load_style()):
secrets_manager = login_prompt(secrets_manager_cls, style=load_style(client_config_map))
if not secrets_manager:
return
else:
secrets_manager = secrets_manager_cls(args.config_password)

asyncio.get_event_loop().run_until_complete(quick_start(args))
asyncio.get_event_loop().run_until_complete(quick_start(args, secrets_manager))


if __name__ == "__main__":
Expand Down
2 changes: 2 additions & 0 deletions conf/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.password_verification
*.yml
6 changes: 0 additions & 6 deletions conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import logging as _logging
import os

from hummingbot.client.config.global_config_map import connector_keys

_logger = _logging.getLogger(__name__)

master_host = "***REMOVED***"
Expand Down Expand Up @@ -39,10 +37,6 @@
# whether to enable api mocking in unit test cases
mock_api_enabled = os.getenv("MOCK_API_ENABLED")

# ALL TEST KEYS
for key in connector_keys().keys():
locals()[key] = os.getenv(key.upper())

"""
# AscendEX Tests
ascend_ex_api_key = os.getenv("ASCEND_EX_KEY")
Expand Down
1 change: 1 addition & 0 deletions conf/connectors/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.yml
1 change: 1 addition & 0 deletions conf/connectors/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.yml
Empty file added conf/connectors/__init__.py
Empty file.
1 change: 1 addition & 0 deletions conf/strategies/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.yml
1 change: 1 addition & 0 deletions conf/strategies/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.yml
Empty file added conf/strategies/__init__.py
Empty file.
42 changes: 19 additions & 23 deletions hummingbot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
import sys
from concurrent.futures import ThreadPoolExecutor
from os import listdir, path
from typing import List, Optional
from pathlib import Path
from typing import TYPE_CHECKING, List, Optional

from hummingbot.logger.struct_logger import StructLogger, StructLogRecord

if TYPE_CHECKING:
from hummingbot.client.config.config_helpers import ClientConfigAdapter as _ClientConfigAdapter

STRUCT_LOGGER_SET = False
DEV_STRATEGY_PREFIX = "dev"
_prefix_path = None
Expand All @@ -20,9 +24,9 @@
_cert_path = None


def root_path() -> str:
from os.path import realpath, join
return realpath(join(__file__, "../../"))
def root_path() -> Path:
from os.path import join, realpath
return Path(realpath(join(__file__, "../../")))


def get_executor() -> ThreadPoolExecutor:
Expand All @@ -35,26 +39,20 @@ def get_executor() -> ThreadPoolExecutor:
def prefix_path() -> str:
global _prefix_path
if _prefix_path is None:
from os.path import (
realpath,
join
)
from os.path import join, realpath
_prefix_path = realpath(join(__file__, "../../"))
return _prefix_path


def set_prefix_path(path: str):
def set_prefix_path(p: str):
global _prefix_path
_prefix_path = path
_prefix_path = p


def data_path() -> str:
global _data_path
if _data_path is None:
from os.path import (
realpath,
join
)
from os.path import join, realpath
_data_path = realpath(join(prefix_path(), "data"))

import os
Expand Down Expand Up @@ -97,8 +95,9 @@ def chdir_to_data_directory():
# Do nothing.
return

import appdirs
import os

import appdirs
app_data_dir: str = appdirs.user_data_dir("Hummingbot", "hummingbot.io")
os.makedirs(os.path.join(app_data_dir, "logs"), 0o711, exist_ok=True)
os.makedirs(os.path.join(app_data_dir, "conf"), 0o711, exist_ok=True)
Expand All @@ -110,20 +109,18 @@ def chdir_to_data_directory():


def init_logging(conf_filename: str,
client_config_map: "_ClientConfigAdapter",
override_log_level: Optional[str] = None,
strategy_file_path: str = "hummingbot"):
import io
import logging.config
from os.path import join
import pandas as pd
from typing import Dict

import pandas as pd
from ruamel.yaml import YAML

from hummingbot.client.config.global_config_map import global_config_map
from hummingbot.logger.struct_logger import (
StructLogRecord,
StructLogger
)
from hummingbot.logger.struct_logger import StructLogger, StructLogRecord
global STRUCT_LOGGER_SET
if not STRUCT_LOGGER_SET:
logging.setLogRecordFactory(StructLogRecord)
Expand All @@ -144,8 +141,7 @@ def init_logging(conf_filename: str,
config_dict: Dict = yaml_parser.load(io_stream)
if override_log_level is not None and "loggers" in config_dict:
for logger in config_dict["loggers"]:
if global_config_map["logger_override_whitelist"].value and \
logger in global_config_map["logger_override_whitelist"].value:
if logger in client_config_map.logger_override_whitelist:
config_dict["loggers"][logger]["level"] = override_log_level
logging.config.dictConfig(config_dict)

Expand Down