Rename method to monitor option spreads
This commit is contained in:
parent
2ca34e4004
commit
d7bce267ca
@ -22,7 +22,7 @@ load_dotenv()
|
|||||||
# Necessary for monitoring spread prices asynchronously while interacting with the IBKR client.
|
# Necessary for monitoring spread prices asynchronously while interacting with the IBKR client.
|
||||||
nest_asyncio.apply()
|
nest_asyncio.apply()
|
||||||
|
|
||||||
def monitor_spread_price(trade: IronCondorTrade, spread_order: OptionOrder, client: Client):
|
def monitor_spread(trade: IronCondorTrade, spread_order: OptionOrder, client: Client):
|
||||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||||
Stop loss orders will not execute if trying to sell back a contract with no bid while paper trading.
|
Stop loss orders will not execute if trying to sell back a contract with no bid while paper trading.
|
||||||
Therefore, the spread price must be monitored and the spread manually exited if the stop price is reached.
|
Therefore, the spread price must be monitored and the spread manually exited if the stop price is reached.
|
||||||
@ -141,7 +141,7 @@ def _enter_iron_condor(entry_time: datetime):
|
|||||||
logging.info(f'Call Spread Slippage: {call_spread_order.mid_price - call_spread_order.fill_price}')
|
logging.info(f'Call Spread Slippage: {call_spread_order.mid_price - call_spread_order.fill_price}')
|
||||||
logging.info(f'Options Chain Call Spread Slippage: {call_spread_price - call_spread_order.fill_price}')
|
logging.info(f'Options Chain Call Spread Slippage: {call_spread_price - call_spread_order.fill_price}')
|
||||||
|
|
||||||
monitor_spread_price(trade, call_spread_order, ibkr_client)
|
monitor_spread(trade, call_spread_order, ibkr_client)
|
||||||
|
|
||||||
short_put_leg = OptionLeg(symbol, expiration, short_put_strike, PUT, SELL, sub_symbol)
|
short_put_leg = OptionLeg(symbol, expiration, short_put_strike, PUT, SELL, sub_symbol)
|
||||||
long_put_leg = OptionLeg(symbol, expiration, long_put_strike, PUT, BUY, sub_symbol)
|
long_put_leg = OptionLeg(symbol, expiration, long_put_strike, PUT, BUY, sub_symbol)
|
||||||
@ -152,7 +152,7 @@ def _enter_iron_condor(entry_time: datetime):
|
|||||||
logging.info(f'Put Spread Slippage: {put_spread_order.mid_price - put_spread_order.fill_price}')
|
logging.info(f'Put Spread Slippage: {put_spread_order.mid_price - put_spread_order.fill_price}')
|
||||||
logging.info(f'Options Chain Put Spread Slippage: {put_spread_price - put_spread_order.fill_price}')
|
logging.info(f'Options Chain Put Spread Slippage: {put_spread_price - put_spread_order.fill_price}')
|
||||||
|
|
||||||
monitor_spread_price(trade, put_spread_order, ibkr_client)
|
monitor_spread(trade, put_spread_order, ibkr_client)
|
||||||
|
|
||||||
insert_trade(trade, call_spread_order, put_spread_order)
|
insert_trade(trade, call_spread_order, put_spread_order)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user