From e02167ab93f5bf87d41dce96b8dac0e7a4151230 Mon Sep 17 00:00:00 2001 From: moshferatu Date: Tue, 20 Feb 2024 10:43:41 -0800 Subject: [PATCH] Commenting out limit order logic while further analysis is performed on the slippage incurred when placing market orders --- ibkr/client.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ibkr/client.py b/ibkr/client.py index c662eb6..3f07d7a 100644 --- a/ibkr/client.py +++ b/ibkr/client.py @@ -136,10 +136,12 @@ class Client: leg_data = self.get_market_data(self.get_option_contract(leg)) leg_mid = (leg_data.ask + max(leg_data.bid, 0)) / 2.0 - leg_limit = (leg_mid - 0.25) - (leg_mid % 0.05) - leg_limit = leg_limit if leg.action == BUY else -leg_limit + # Limit orders currently on hold while awaiting slippage metrics on market orders. + # 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(): self.ib.waitOnUpdate() @@ -153,10 +155,12 @@ class Client: far_leg_mid = (far_leg_data.ask + max(far_leg_data.bid, 0)) / 2.0 spread_mid = near_leg_mid - far_leg_mid - spread_limit = (spread_mid - 0.25) - (spread_mid % 0.05) - spread_limit = spread_limit if near_leg.action == BUY else -spread_limit + # Limit orders currently on hold while awaiting slippage metrics on market orders. + # 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(): self.ib.waitOnUpdate()