Skip to content

Commit e3cccdf

Browse files
authored
ENH: Relax commission constraints for rebates (#300)
* commission constraints for rebates * linter warning fix * assert linter warning
1 parent a37b0b8 commit e3cccdf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

backtesting/backtesting.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,9 @@ class _Broker:
664664
def __init__(self, *, data, cash, commission, margin,
665665
trade_on_close, hedging, exclusive_orders, index):
666666
assert 0 < cash, f"cash should be >0, is {cash}"
667-
assert 0 <= commission < .1, f"commission should be between 0-10%, is {commission}"
667+
assert -.1 <= commission < .1, \
668+
("commission should be between -10% "
669+
f"(e.g. market-maker's rebates) and 10% (fees), is {commission}")
668670
assert 0 < margin <= 1, f"margin should be between 0 and 1, is {margin}"
669671
self._data: _Data = data
670672
self._cash = cash

0 commit comments

Comments
 (0)