-
Notifications
You must be signed in to change notification settings - Fork 18
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
#157 - [trader] Move max tries to trader agent config class #159
#157 - [trader] Move max tries to trader agent config class #159
Conversation
pdr_backend/trader/trader_config.py
Outdated
@@ -10,4 +10,5 @@ class TraderConfig(BaseConfig): | |||
def __init__(self): | |||
super().__init__() | |||
|
|||
self.trader_min_buffer = int(getenv("TRADER_MIN_BUFFER", "60 ")) | |||
self.trader_min_buffer = int(getenv("TRADER_MIN_BUFFER", "60")) | |||
self.max_tries = int(getenv("TRADER_MAX_TRIES", "10")) |
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.
I don't understand.
Why are there two config variables being set by one envvar?
And what is "trader min buffer" anyway?
As mentioned : we don't need to have an envvar for every parameter. We should hardcode some vars in the config for now: ones that don't need much changing because they have a very good default.
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.
Thought it's better to make it an env var and give a default value. I'll hardcode it to 10.
TRADER_MIN_BUFFER: Sets a threshold (in seconds) for trade decisions. For example, if set to 180 and there's 179 seconds left, no trade. If 181, then trade.
This variable helps prevent late trades.
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.
It's not always better to make an envvar and make a default. Every envvar adds complexity because you have to document it elsewhere.
Hardcoding is fine, a good thing actually, in specially fenced locations. These are: constants.py, config classes, and "ss" (solution strategy) classes. You'll see as classes coming in when Calina updates predictoor approach 2.
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.
Btw: you need to document in the code what trader min buffer means. Just a short one liner above where it's set.
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.
Makes sense, thanks!
…r-config-not-a-global
Fixes #157
Changes proposed in this PR: