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 f94b20f commit f8f4969Copy full SHA for f8f4969
backtesting/backtesting.py
@@ -590,7 +590,8 @@ def _copy(self, **kwargs):
590
def close(self, portion: float = 1.):
591
"""Place new `Order` to close `portion` of the trade at next market price."""
592
assert 0 < portion <= 1, "portion must be a fraction between 0 and 1"
593
- size = copysign(max(1, round(abs(self.__size) * portion)), -self.__size)
+ # Ensure size is an int to avoid rounding errors on 32-bit OS
594
+ size = copysign(max(1, int(round(abs(self.__size) * portion))), -self.__size)
595
order = Order(self.__broker, size, parent_trade=self, tag=self.__tag)
596
self.__broker.orders.insert(0, order)
597
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments