-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Epic/config management refactoring #5428
Conversation
The config map introduced in this PR is a proof of concept for the new approach to configs using pydantic. It adopts @aarmoa's suggestion to use nested models as a method of solving the interdependencies issues present with some config variables.
Co-authored-by: Abel Armoa <30988000+aarmoa@users.noreply.github.com>
…ydantic' into refactor/avellaneda_config_map_pydantic
Co-authored-by: Abel Armoa <30988000+aarmoa@users.noreply.github.com>
…ydantic' into refactor/avellaneda_config_map_pydantic
The config map introduced in this PR is a proof of concept for the new approach to configs using pydantic. It adopts @aarmoa's suggestion to use nested models as a method of solving the interdependencies issues present with some config variables.
Co-authored-by: Abel Armoa <30988000+aarmoa@users.noreply.github.com>
Co-authored-by: Abel Armoa <30988000+aarmoa@users.noreply.github.com>
…ydantic' into refactor/avellaneda_config_map_pydantic
…pydantic refactor / adapts Avellaneda config map for pydantic
…nfiguation schemas.
…nfiguration schemas.
Co-authored-by: Abel Armoa <30988000+aarmoa@users.noreply.github.com>
Co-authored-by: Abel Armoa <30988000+aarmoa@users.noreply.github.com>
@arnelhbot, generally yes, the |
- Improves the printout for one of the migration messages. - New configs now add the default as a suggestion on the prompt.
@nikspz, I have addressed both concerns in the latest commit. |
@petioptrv the file I used to reproduce that avellaneda issue. |
Thank you for that. I attempted to migrate the file with the current state of the branch and the process was successful; it was recognized as |
Here is the requested file to produce the outcome. |
This one is also currently |
commit 863b7f4 Steps:
Actual: Expected: initial Regarding |
@nikspz, to migrate the original config properly, it should be directly under |
@petioptrv Got it, and then I need to move them back to conf/strategies |
Nope, the migration process will take care of that for you. If the initial folder structure is:
after the automatic migration, that should be:
|
I have addressed those in the last commit. |
Thanks @petioptrv for the clarification. I will retest this as soon as I start my shift with a clean environment. |
I think I see what you mean here, but the printout generally does not adapt to the screen size, so I had to make it as wide as the currently existing prompts (like on the first screenshot), which I guess ended up clustering the text to the left side |
@petioptrv Steps:
Tried to check pureMM creation: Steps:
Actual: Expected: |
@nikspz, I've addressed both issues in my latest commit. |
@petioptrv Could you please resolve branch conflicts? (I think #5381 merged to development is the reason) |
@nikspz, conflicts resolved in the last commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test performed:
- Cloned feature branch successfully
- Started Client and created password
- Connected certified exchanges APIs and successful checked balance
- Verified triggered Killswitch
- Imported multiple(Avellaneda, Pure_MM, Perpetual_MM, XEMM, AMM_Arbitrage,etc.) strategies successfully
- Successfully created Avellaneda_MM and XEMM strategy with no issues
- Trades executions matched between History, CSV, and exchange trade history
- Able to generate-cert and gateway create with no issues
- Connected Infura and verified
- Connected Uniswap, Sushiswap, Pangolin and checked balance successfully
- Verified Balance_paper correctly displayed Issue 5361
- Created XEMM and AMM_Arbitrage strategy
- Tested DEX/CEX and CEX/CEX successful
- Started Client and monitored logs with no issues
- No arbitrage opportunity was verified
- History/-verbose displayed correctly
- Confirmed CSV file and txhash to match on snowtrace
- All are tested on Source AWS and Docker Build
Before submitting this PR, please make sure:
A description of the changes proposed in the pull request:
This PR lays the foundation for a refactor of the configuration management of
hummingbot
.The new approach uses
pydantic
models to define the configuration maps. Aside from built-in validation functionality, this approach also allows the automatic generation of JSON schemas which is a big first step in the direction of decoupling the bot from its interface. Another major step in that direction is significantly restricting the use of global variables when dealing with the global config map (now renamed to client config map) and theAllConnectorSettings
class.The approach to storing and retrieving secure configs has also been refactored. We no longer store secure configs in the client config map (former global config map). Those are only stored in the
Security
class (which is still unfortunately accessed globally). In addition, the secure values are no longer stored separate from non-secure configs — they are both part of the same config map and stored in the sameyaml
file.Two of the strategies,
AMM
andXEMM
, were already adapted to the new configs style. The rest remain to be adapted. To accommodate for legacy configs, some of the legacy config management code still remains. If the legacy functionality is an entire function, then the function has been renamed with a_legacy
postfix. If the legacy functionality are lines of code part of an otherwise non-refactored routine, then a comment# legacy
was added. This was done to later facilitate complete removal of legacy config code.The
Pydantic
model now allows for nested config maps. This is used for two purposes. First, it is used to provide more organizational structure as with the color map, which is now a nested sub-model of the client config map. Second, it is used to provide conditional requirements for the configurations (i.e. "fieldfoo
is required only if fieldbar
is est to the valueX
). An example of this is theAvellanedaMarketMakingConfigMap.execution_timeframe_mode
field.A legacy migration routine was included on the bot's startup, which will detect if the bot is being ran for the first time since the upgrade, and will guide the user through the migration of the refactored configs. The routine will start by creating a backup of the current state of the configs folder, and proceed from there. It will also alert the user if any config map migration failed along the way.
The folder structure of the configs has been further split into
connectors
andstrategies
for better organization.Tests performed by the developer:
Tips for QA testing:
celo
as well.