Commenting out limit order logic while further analysis is performed on the slippage incurred when placing market orders

This commit is contained in:
moshferatu 2024-02-20 10:43:41 -08:00
parent 8f48ff6950
commit e02167ab93

View File

@ -136,10 +136,12 @@ class Client:
leg_data = self.get_market_data(self.get_option_contract(leg)) leg_data = self.get_market_data(self.get_option_contract(leg))
leg_mid = (leg_data.ask + max(leg_data.bid, 0)) / 2.0 leg_mid = (leg_data.ask + max(leg_data.bid, 0)) / 2.0
leg_limit = (leg_mid - 0.25) - (leg_mid % 0.05) # Limit orders currently on hold while awaiting slippage metrics on market orders.
leg_limit = leg_limit if leg.action == BUY else -leg_limit # leg_limit = (leg_mid - 0.25) - (leg_mid % 0.05)
# leg_limit = leg_limit if leg.action == BUY else -leg_limit
# option_order = self.submit_single_option_order(leg_data, limit_price = leg_limit)
option_order = self.submit_single_option_order(leg_data, limit_price = leg_limit) option_order = self.submit_single_option_order(leg_data)
while not option_order.isDone(): while not option_order.isDone():
self.ib.waitOnUpdate() self.ib.waitOnUpdate()
@ -153,10 +155,12 @@ class Client:
far_leg_mid = (far_leg_data.ask + max(far_leg_data.bid, 0)) / 2.0 far_leg_mid = (far_leg_data.ask + max(far_leg_data.bid, 0)) / 2.0
spread_mid = near_leg_mid - far_leg_mid spread_mid = near_leg_mid - far_leg_mid
spread_limit = (spread_mid - 0.25) - (spread_mid % 0.05) # Limit orders currently on hold while awaiting slippage metrics on market orders.
spread_limit = spread_limit if near_leg.action == BUY else -spread_limit # spread_limit = (spread_mid - 0.25) - (spread_mid % 0.05)
# spread_limit = spread_limit if near_leg.action == BUY else -spread_limit
# spread_order = self.submit_combo_option_order([near_leg, far_leg], limit_price = spread_limit)
spread_order = self.submit_combo_option_order([near_leg, far_leg], limit_price = spread_limit) spread_order = self.submit_combo_option_order([near_leg, far_leg])
while not spread_order.isDone(): while not spread_order.isDone():
self.ib.waitOnUpdate() self.ib.waitOnUpdate()