(feat) Add external:: prefix support for strategy name to load external strategies #6595
+70
−13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before submitting this PR, please make sure:
A description of the changes proposed in the pull request:
A bit of context. I have been using Hummingbot for the past 2 years. I developed custom strategies located in the hummingbot/strategy folder. I recently rebased my changes on top of development to use new features, such as the dashboard, and also to be able to contribute back to the upstream project (this one).
Now the issue is that for contributing back to the project, I can't have my private functions in my fork of Hummingbot, since I want to keep it private. So what I'm proposing here is a way to restructure strategies from:
into
In essence, this allows decoupling and removing my strategy files from the main hummingbot repo; allowing me to store it in another, private git repository.
I have arbitrarily chosen
external::
as the prefix to the strategy name. I decided to keep this relatively simple and work around the condition that the strategy name must be a string. The PR only modifies the paths and imports required to load a strategy. When theexternal::
prefix is used, what follows is actually a relative path to the folder containing the strategy files (config map, start.py, etc). For example, I can have a strategy config file such asTo point to my strategy folder as in the example above.
I am open to suggestions, or even alternative ways to achieve the same result. Note that I don't want to use the "scripts" construct to run my strategy, it is written using the old way!
Tests performed by the developer:
Tips for QA testing: