-
Notifications
You must be signed in to change notification settings - Fork 2
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
Additions required for simson trade module #58
Conversation
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 looking much cleaner, thanks! Still a few minor comments, but all up for discussion, since I'm not fully convinced either way :)
sodym/trade.py
Outdated
def balance(self, **kwargs): | ||
pass |
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.
Potentially would be nice to have this with an inplace: bool=True
option, along with the **kwargs. I guess it could be useful for debugging to make the Trade that has been balanced as a separate object from the starting unbalanced Trade object. But, this makes me think that we don't need it as an abstractmethod. Still undecided tbh. What do you think?
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 like the idea of having the inplace option - I guess we could then have this function as not an abstract method but something like
class BalancedTrade(Trade)
def balance(self, inplace : bool=True, **kwargs):
if inplace:
self.balance_function(**kwargs)
else:
new_trade = self.__class__(imports=self.imports, exports=self.exports)
new_trade.balance_function(**kwargs)
return new_trade
@abstractmethod
def balance_function(**kwargs):
pass
class SpecificBalancedTrade(BalancedTrade):
def balance_function(**kwargs):
#foo
This way every balanced trade instance still has the balance function, the inplace works and you can specify what happens via the (abstract) balance_function in the subclasses (feel free to suggest a better name :) ). Or is that overcomplicating it? Just would like to keep the general idea.
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.
Another option could be to call it '_balance' instead of 'balance_function' to make it clear that one is for public use and the other for internal use.
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.
Looks great :)
for more information, see https://pre-commit.ci
Already did, looks great! |
Thanks to both of you! |
No description provided.