Ensure that entry slippage is always a positive number

This commit is contained in:
moshferatu 2024-02-21 08:50:32 -08:00
parent 09ba7dfed3
commit f3c99b3aa0

View File

@ -165,7 +165,7 @@ def _enter_iron_condor(entry_time: datetime):
{'Action': 'BUY', 'Strike': long_call_strike, 'Type': 'CALL'}
],
'Open': call_spread_fill,
'Entry Slippage': round(call_spread_fill - call_spread_mid, 3)
'Entry Slippage': round(call_spread_mid - call_spread_fill, 3)
}
put_spread_details = {
@ -174,7 +174,7 @@ def _enter_iron_condor(entry_time: datetime):
{'Action': 'BUY', 'Strike': long_put_strike, 'Type': 'PUT'}
],
'Open': put_spread_fill,
'Entry Slippage': round(put_spread_fill - put_spread_mid, 3)
'Entry Slippage': round(put_spread_mid, put_spread_fill, 3)
}
upsert(pd.DataFrame([{