We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f88baff commit 9a15617Copy full SHA for 9a15617
backtesting/backtesting.py
@@ -838,7 +838,7 @@ def unrealized_pl(self) -> float:
838
@property
839
def last_price(self) -> float:
840
""" Price at the last (current) close. """
841
- return self._data.Close[-1]
+ return self._data._current_value('Close')
842
843
def _adjusted_price(self, size=None, price=None) -> float:
844
"""
@@ -869,7 +869,7 @@ def next(self):
869
if equity <= 0:
870
assert self.margin_available <= 0
871
for trade in self.trades:
872
- self._close_trade(trade, self._data.Close[-1], i)
+ self._close_trade(trade, self.last_price, i)
873
self._cash = 0
874
self._equity[i:] = 0
875
raise _OutOfMoneyError
0 commit comments