File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,20 +55,27 @@ public virtual OptionAssignmentResult GetAssignment(OptionAssignmentParameters p
5555 var underlying = parameters . Option . Underlying ;
5656
5757 // we take only options that expire soon
58- if ( ( option . Symbol . ID . OptionStyle == OptionStyle . American && option . Symbol . ID . Date - option . LocalTime <= _priorExpiration ||
58+ try
59+ {
60+ if ( ( option . Symbol . ID . OptionStyle == OptionStyle . American && option . Symbol . ID . Date - option . LocalTime <= _priorExpiration ||
5961 option . Symbol . ID . OptionStyle == OptionStyle . European && option . Symbol . ID . Date . Date == option . LocalTime . Date )
6062 // we take only deep ITM strikes
6163 && IsDeepInTheMoney ( option ) )
62- {
63- // we estimate P/L
64- var potentialPnL = EstimateArbitragePnL ( option , ( OptionHolding ) option . Holdings , underlying ) ;
65- if ( potentialPnL > 0 )
6664 {
67- return new OptionAssignmentResult ( option . Holdings . AbsoluteQuantity , "Simulated option assignment before expiration" ) ;
65+ // we estimate P/L
66+ var potentialPnL = EstimateArbitragePnL ( option , ( OptionHolding ) option . Holdings , underlying ) ;
67+ if ( potentialPnL > 0 )
68+ {
69+ return new OptionAssignmentResult ( option . Holdings . AbsoluteQuantity , "Simulated option assignment before expiration" ) ;
70+ }
6871 }
69- }
7072
71- return OptionAssignmentResult . Null ;
73+ return OptionAssignmentResult . Null ;
74+ }
75+ catch ( Exception e )
76+ {
77+ throw new Exception ( $ "Error in DefaultOptionAssignmentModel.GetAssignment({ option . Symbol . Value } :: { underlying . Symbol . ID } :: { underlying . Symbol . Value } ): { e . Message } ", e ) ;
78+ }
7279 }
7380
7481 private bool IsDeepInTheMoney ( Option option )
You can’t perform that action at this time.
0 commit comments