Skip to content

Commit 5e72e7b

Browse files
committed
DOC: Emit warning when cancelling the insufficient margin order
Fixes #1216
1 parent 6cbdd99 commit 5e72e7b

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

backtesting/backtesting.py

+3
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,9 @@ def _process_orders(self):
959959
// adjusted_price_plus_commission), size)
960960
# Not enough cash/margin even for a single unit
961961
if not size:
962+
warnings.warn(
963+
f'time={self._i}: Broker canceled the relative-sized '
964+
f'order due to insufficient margin.', category=UserWarning)
962965
# XXX: The order is canceled by the broker?
963966
self.orders.remove(order)
964967
continue

0 commit comments

Comments
 (0)