Skip to content

Commit

Permalink
ENH: Relax commission constraints for rebates (#300)
Browse files Browse the repository at this point in the history
* commission constraints for rebates

* linter warning fix

* assert linter warning
  • Loading branch information
muhrifqii committed Apr 5, 2021
1 parent a37b0b8 commit e3cccdf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion backtesting/backtesting.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,9 @@ class _Broker:
def __init__(self, *, data, cash, commission, margin,
trade_on_close, hedging, exclusive_orders, index):
assert 0 < cash, f"cash should be >0, is {cash}"
assert 0 <= commission < .1, f"commission should be between 0-10%, is {commission}"
assert -.1 <= commission < .1, \
("commission should be between -10% "
f"(e.g. market-maker's rebates) and 10% (fees), is {commission}")
assert 0 < margin <= 1, f"margin should be between 0 and 1, is {margin}"
self._data: _Data = data
self._cash = cash
Expand Down

0 comments on commit e3cccdf

Please sign in to comment.