Ensure that the limit price is always a positive number

This commit is contained in:
moshferatu 2024-02-20 07:47:47 -08:00
parent 5be5867c47
commit 83a008f981

View File

@ -3,5 +3,5 @@ from ib_insync import Trade
class OptionOrder: class OptionOrder:
def __init__(self, trade_result: Trade): def __init__(self, trade_result: Trade):
self.limit_price = trade_result.order.lmtPrice self.limit_price = abs(trade_result.order.lmtPrice)
self.fill_price = abs(trade_result.orderStatus.avgFillPrice) self.fill_price = abs(trade_result.orderStatus.avgFillPrice)