Add the ability to submit a single leg option order
This commit is contained in:
parent
c6f86b8fd1
commit
af92a7647f
@ -79,6 +79,20 @@ class Client:
|
||||
self.ib.qualifyContracts(option_contract)
|
||||
return option_contract
|
||||
|
||||
def submit_option_order(self, leg: OptionLeg, quantity: int):
|
||||
option_contract = self.get_option_contract(leg)
|
||||
contract = Contract()
|
||||
contract.conId = option_contract.conId
|
||||
contract.exchange = SMART
|
||||
|
||||
order = Order()
|
||||
order.action = BUY
|
||||
order.orderType = 'MKT' # TODO: Support limit orders.
|
||||
order.totalQuantity = quantity
|
||||
order.transmit = True
|
||||
|
||||
return self.ib.placeOrder(contract, order)
|
||||
|
||||
def submit_combo_option_order(self, legs: List[OptionLeg], quantity: int) -> Trade:
|
||||
combo_legs = []
|
||||
for leg in legs:
|
||||
|
Loading…
Reference in New Issue
Block a user