13 lines
438 B
Python
13 lines
438 B
Python
from datetime import datetime
|
|
from ibkr import Client as IBKR, OptionLeg
|
|
from ibkr.option_type import CALL, PUT
|
|
from ibkr.order_action import BUY, SELL
|
|
|
|
client = IBKR()
|
|
|
|
symbol, sub_symbol = 'SPX', 'SPXW'
|
|
expiration = datetime.now()
|
|
short_leg = OptionLeg(symbol, expiration, 4525.0, CALL, SELL, sub_symbol)
|
|
long_leg = OptionLeg(symbol, expiration, 4550.0, CALL, BUY, sub_symbol)
|
|
|
|
client.submit_combo_option_order([short_leg, long_leg], 1) |