Skip to content

Commit aff00ca

Browse files
authored
Fix error message in position.py (microsoft#922)
* Update position.py * Update position.py fix CI error
1 parent 8862af1 commit aff00ca

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

qlib/backtest/position.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,9 @@ def _sell_stock(self, stock_id, trade_val, cost, trade_price):
360360
# check if to delete
361361
if self.position[stock_id]["amount"] < -1e-5:
362362
raise ValueError(
363-
"only have {} {}, require {}".format(self.position[stock_id]["amount"], stock_id, trade_amount)
363+
"only have {} {}, require {}".format(
364+
self.position[stock_id]["amount"] + trade_amount, stock_id, trade_amount
365+
)
364366
)
365367

366368
new_cash = trade_val - cost

0 commit comments

Comments
 (0)