ENH: Add fixed commission option to _Broker (see #623) #662
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.
Hello and thanks for this amazing library!
I added the 'use_fixed_commission' parameter to the class _Broker: if set to "True", in the function _adjusted_price the commission will be calculated as a flat fee instead of a percentage.
Fixes #623
At first I thought about using parsing the value from commission (e.g. if the value is '0.05' -> percentage, if '1$' -> remove the dollar sign and parse it as fixed fee), but I don't want to mess up with the types so I added another parameter in the _Broker instance.
What do you think? :)