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

#157 - [trader] Move max tries to trader agent config class #159

Merged

Conversation

trizin
Copy link
Contributor

@trizin trizin commented Sep 8, 2023

Fixes #157

Changes proposed in this PR:

  • Move max tries to trader agent config clas

@trizin trizin linked an issue Sep 8, 2023 that may be closed by this pull request
@trizin trizin changed the title [trader] Move max tries to trader agent config class #157 - [trader] Move max tries to trader agent config class Sep 8, 2023
@trizin trizin marked this pull request as ready for review September 8, 2023 14:49
@trizin trizin requested a review from trentmc September 8, 2023 14:49
@@ -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"))
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, thanks!

@trizin trizin requested a review from trentmc September 8, 2023 15:49
@trizin trizin merged commit 75db394 into main Sep 8, 2023
5 checks passed
@trizin trizin deleted the issue157-trader-max_tries-should-be-in-trader-config-not-a-global branch September 8, 2023 18:02
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.

[trader] MAX_TRIES should be in trader config, not a global
2 participants