@@ -63,7 +63,9 @@ def infer_forward_from_atm(
6363 "strike" : row ["strike" ],
6464 "call_price" : row ["call_price" ],
6565 "put_price" : row ["put_price" ],
66- "distance_from_underlying" : abs (row ["strike" ] - underlying_price ),
66+ "distance_from_underlying" : abs (
67+ row ["strike" ] - underlying_price
68+ ),
6769 }
6870 )
6971
@@ -185,7 +187,12 @@ def apply_put_call_parity(
185187 put_data = row if pd .notna (put_price ) and put_price > 0 else None
186188
187189 _process_strike_prices (
188- results , strike , call_data , put_data , forward_price , discount_factor
190+ results ,
191+ strike ,
192+ call_data ,
193+ put_data ,
194+ forward_price ,
195+ discount_factor ,
189196 )
190197
191198 elif "last_price" in options_df .columns and "option_type" in options_df .columns :
@@ -204,7 +211,12 @@ def apply_put_call_parity(
204211 put_row = put_data .iloc [0 ] if len (put_data ) > 0 else None
205212
206213 _process_strike_prices (
207- results , strike , call_row , put_row , forward_price , discount_factor
214+ results ,
215+ strike ,
216+ call_row ,
217+ put_row ,
218+ forward_price ,
219+ discount_factor ,
208220 )
209221 else :
210222 raise ValueError (
@@ -343,7 +355,10 @@ def _process_strike_prices(
343355
344356
345357def _convert_put_to_call (
346- put_price : float , strike : float , forward_price : float , discount_factor : float
358+ put_price : float ,
359+ strike : float ,
360+ forward_price : float ,
361+ discount_factor : float ,
347362) -> float :
348363 """
349364 Convert put price to synthetic call price using put-call parity.
@@ -489,7 +504,9 @@ def preprocess_with_parity(
489504
490505 try :
491506 # Apply parity preprocessing
492- forward_price = infer_forward_from_atm (options_df , underlying_price , discount_factor )
507+ forward_price = infer_forward_from_atm (
508+ options_df , underlying_price , discount_factor
509+ )
493510 cleaned_df = apply_put_call_parity (options_df , forward_price , discount_factor )
494511 return cleaned_df
495512
0 commit comments