Track the spread mid prices and use them to obtain a more accurate measure of slippage
This commit is contained in:
parent
c723cc3ecc
commit
df932568b4
@ -123,11 +123,13 @@ def _enter_iron_condor(entry_time: datetime):
|
|||||||
long_call_leg = OptionLeg(symbol, expiration, long_call_strike, CALL, BUY, sub_symbol)
|
long_call_leg = OptionLeg(symbol, expiration, long_call_strike, CALL, BUY, sub_symbol)
|
||||||
|
|
||||||
call_spread_order = ibkr_client.submit_spread_order(short_call_leg, long_call_leg)
|
call_spread_order = ibkr_client.submit_spread_order(short_call_leg, long_call_leg)
|
||||||
|
call_spread_mid = call_spread_order.mid_price
|
||||||
call_spread_limit = call_spread_order.limit_price
|
call_spread_limit = call_spread_order.limit_price
|
||||||
call_spread_fill = call_spread_order.fill_price
|
call_spread_fill = call_spread_order.fill_price
|
||||||
|
logging.info(f'Call Spread Mid Price: {call_spread_mid}')
|
||||||
logging.info(f'Call Spread Limit Price: {call_spread_limit}')
|
logging.info(f'Call Spread Limit Price: {call_spread_limit}')
|
||||||
logging.info(f'Call Spread Fill Price: {call_spread_fill}')
|
logging.info(f'Call Spread Fill Price: {call_spread_fill}')
|
||||||
logging.info(f'Call Spread Slippage: {call_spread_fill - call_spread_limit}')
|
logging.info(f'Call Spread Slippage: {call_spread_fill - call_spread_mid}')
|
||||||
|
|
||||||
monitor_spread_price(
|
monitor_spread_price(
|
||||||
short_leg = short_call_leg,
|
short_leg = short_call_leg,
|
||||||
@ -140,11 +142,13 @@ def _enter_iron_condor(entry_time: datetime):
|
|||||||
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)
|
||||||
|
|
||||||
put_spread_order = ibkr_client.submit_spread_order(short_put_leg, long_put_leg)
|
put_spread_order = ibkr_client.submit_spread_order(short_put_leg, long_put_leg)
|
||||||
|
put_spread_mid = put_spread_order.mid_price
|
||||||
put_spread_limit = put_spread_order.limit_price
|
put_spread_limit = put_spread_order.limit_price
|
||||||
put_spread_fill = put_spread_order.fill_price
|
put_spread_fill = put_spread_order.fill_price
|
||||||
|
logging.info(f'Put Spread Mid Price: {put_spread_mid}')
|
||||||
logging.info(f'Put Spread Limit Price: {put_spread_limit}')
|
logging.info(f'Put Spread Limit Price: {put_spread_limit}')
|
||||||
logging.info(f'Put Spread Fill Price: {put_spread_fill}')
|
logging.info(f'Put Spread Fill Price: {put_spread_fill}')
|
||||||
logging.info(f'Put Spread Slippage: {put_spread_fill - put_spread_limit}')
|
logging.info(f'Put Spread Slippage: {put_spread_fill - put_spread_mid}')
|
||||||
|
|
||||||
monitor_spread_price(
|
monitor_spread_price(
|
||||||
short_leg = short_put_leg,
|
short_leg = short_put_leg,
|
||||||
|
Loading…
Reference in New Issue
Block a user