Skip to content

Commit f81ea82

Browse files
committed
DEPR: Remove old deprecation
1 parent 054d453 commit f81ea82

1 file changed

Lines changed: 1 addition & 22 deletions

File tree

backtesting/backtesting.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def position(self) -> 'Position':
312312
@property
313313
def orders(self) -> 'Tuple[Order, ...]':
314314
"""List of orders (see `Order`) waiting for execution."""
315-
return _Orders(self._broker.orders)
315+
return tuple(self._broker.orders)
316316

317317
@property
318318
def trades(self) -> 'Tuple[Trade, ...]':
@@ -325,27 +325,6 @@ def closed_trades(self) -> 'Tuple[Trade, ...]':
325325
return tuple(self._broker.closed_trades)
326326

327327

328-
class _Orders(tuple):
329-
"""
330-
TODO: remove this class. Only for deprecation.
331-
"""
332-
def cancel(self):
333-
"""Cancel all non-contingent (i.e. SL/TP) orders."""
334-
for order in self:
335-
if not order.is_contingent:
336-
order.cancel()
337-
338-
def __getattr__(self, item):
339-
# TODO: Warn on deprecations from the previous version. Remove in the next.
340-
removed_attrs = ('entry', 'set_entry', 'is_long', 'is_short',
341-
'sl', 'tp', 'set_sl', 'set_tp')
342-
if item in removed_attrs:
343-
raise AttributeError(f'Strategy.orders.{"/.".join(removed_attrs)} were removed in'
344-
'Backtesting 0.2.0. '
345-
'Use `Order` API instead. See docs.')
346-
raise AttributeError(f"'tuple' object has no attribute {item!r}")
347-
348-
349328
class Position:
350329
"""
351330
Currently held asset position, available as

0 commit comments

Comments
 (0)