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

refactor / adapts Avellaneda config map for pydantic #96

Conversation

petioptrv
Copy link

Before submitting this PR, please make sure:

  • Your code builds clean without any errors or warnings
  • You are using approved title ("feat/", "fix/", "docs/", "refactor/")

A description of the changes proposed in the pull request:
This PR introduces a proof of concept for the new approach to defining config maps using pydantic.

It adopts @aarmoa's suggestion to use nested models to address the config variables' interdependencies problem.

Tests performed by the developer:
Tests cover the new functionalities introduced in the proof of concept, plus the functionality already previously covered by existing test.

This PR assumes that the model instance will be directly passed to the strategy, so it does not include a test to flatten the model dictionary in preparation for the current approach to the init_params function (config vars passed in as kwargs).

Tips for QA testing:
N/A

[ch21823]

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.
@shortcut-integration
Copy link

This pull request has been linked to Shortcut Story #21823: Create Avellaneda configuration schema.

@petioptrv petioptrv self-assigned this Feb 18, 2022
hummingbot/client/config/config_data_types.py Show resolved Hide resolved
hummingbot/client/config/config_data_types.py Outdated Show resolved Hide resolved
hummingbot/client/config/config_helpers.py Outdated Show resolved Hide resolved
setup/environment-linux-aarch64.yml Outdated Show resolved Hide resolved
Comment on lines 21 to 24
class ExecutionTimeframe(str, ClientConfigEnum):
infinite = "infinite"
from_date_to_date = "from_date_to_date"
daily_between_times = "daily_between_times"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this enum required? Wouldn't it be better to have the a class variable "description" or "title" in each of the model classes to store the string?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've replaced the enum for a dictionary as suggested below

@dennisocana dennisocana changed the title (refactor) Adapts Avellaneda config map for pydantic. refactor / adapts Avellaneda config map for pydantic Feb 21, 2022
Copy link

@aarmoa aarmoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a question to one of the previous comments and one more requested change to add a new line at the end of one file.

Co-authored-by: Abel Armoa <30988000+aarmoa@users.noreply.github.com>
@petioptrv
Copy link
Author

I've added a small cleanup commit that I noticed while taking another look at the class

Copy link

@aarmoa aarmoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All changes look good to me now. I think we should create a big feature PR with all changes related to the configuration update before sending the new functionality to the Foundation.

petioptrv and others added 7 commits March 4, 2022 10:53
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>
@petioptrv petioptrv changed the base branch from development to feat/config_management_refactoring March 4, 2022 03:54
…ydantic' into refactor/avellaneda_config_map_pydantic
@petioptrv petioptrv merged commit 63a59db into feat/config_management_refactoring Mar 4, 2022
@petioptrv petioptrv deleted the refactor/avellaneda_config_map_pydantic branch May 13, 2022 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants