@@ -485,7 +485,7 @@ public static bool TryDecomposeOptionTickerOSI(string ticker, SecurityType secur
485485 public static string GenerateOptionTicker ( Symbol symbol )
486486 {
487487 var symbolTicker = symbol . SecurityType == SecurityType . IndexOption ? symbol . Canonical . Value . Replace ( "?" , string . Empty ) : SecurityIdentifier . Ticker ( symbol . Underlying , symbol . ID . Date ) ;
488- var letter = _optionSymbology . Where ( x => x . Value . Item2 == symbol . ID . OptionRight && x . Value . Item1 == symbol . ID . Date . Month ) . Select ( x => x . Key ) . Single ( ) ;
488+ var letter = OptionCodeLookup . Where ( x => x . Value . Item2 == symbol . ID . OptionRight && x . Value . Item1 == symbol . ID . Date . Month ) . Select ( x => x . Key ) . Single ( ) ;
489489 var twoYearDigit = symbol . ID . Date . ToString ( "yy" ) ;
490490 return $ "{ symbolTicker } { twoYearDigit } { symbol . ID . Date . Day : 00} { letter } { symbol . ID . StrikePrice . ToStringInvariant ( ) } ";
491491 }
@@ -498,13 +498,13 @@ public static string GenerateOptionTicker(Symbol symbol)
498498 /// <returns>Results containing 1) underlying name, 2) option right, 3) option strike 4) expiration date</returns>
499499 public static OptionTickerProperties ParseOptionTickerIQFeed ( string ticker )
500500 {
501- var letterRange = _optionSymbology . Keys
501+ var letterRange = OptionCodeLookup . Keys
502502 . Select ( x => x [ 0 ] )
503503 . ToArray ( ) ;
504504 var optionTypeDelimiter = ticker . LastIndexOfAny ( letterRange ) ;
505505 var strikePriceString = ticker . Substring ( optionTypeDelimiter + 1 , ticker . Length - optionTypeDelimiter - 1 ) ;
506506
507- var lookupResult = _optionSymbology [ ticker [ optionTypeDelimiter ] . ToStringInvariant ( ) ] ;
507+ var lookupResult = OptionCodeLookup [ ticker [ optionTypeDelimiter ] . ToStringInvariant ( ) ] ;
508508 var month = lookupResult . Item1 ;
509509 var optionRight = lookupResult . Item2 ;
510510
@@ -545,23 +545,30 @@ public static OptionTickerProperties ParseOptionTickerIQFeed(string ticker)
545545 }
546546
547547
548- // This table describes IQFeed option symbology
549- private static Dictionary < string , Tuple < int , OptionRight > > _optionSymbology = new Dictionary < string , Tuple < int , OptionRight > >
550- {
551- { "A" , Tuple . Create ( 1 , OptionRight . Call ) } , { "M" , Tuple . Create ( 1 , OptionRight . Put ) } ,
552- { "B" , Tuple . Create ( 2 , OptionRight . Call ) } , { "N" , Tuple . Create ( 2 , OptionRight . Put ) } ,
553- { "C" , Tuple . Create ( 3 , OptionRight . Call ) } , { "O" , Tuple . Create ( 3 , OptionRight . Put ) } ,
554- { "D" , Tuple . Create ( 4 , OptionRight . Call ) } , { "P" , Tuple . Create ( 4 , OptionRight . Put ) } ,
555- { "E" , Tuple . Create ( 5 , OptionRight . Call ) } , { "Q" , Tuple . Create ( 5 , OptionRight . Put ) } ,
556- { "F" , Tuple . Create ( 6 , OptionRight . Call ) } , { "R" , Tuple . Create ( 6 , OptionRight . Put ) } ,
557- { "G" , Tuple . Create ( 7 , OptionRight . Call ) } , { "S" , Tuple . Create ( 7 , OptionRight . Put ) } ,
558- { "H" , Tuple . Create ( 8 , OptionRight . Call ) } , { "T" , Tuple . Create ( 8 , OptionRight . Put ) } ,
559- { "I" , Tuple . Create ( 9 , OptionRight . Call ) } , { "U" , Tuple . Create ( 9 , OptionRight . Put ) } ,
560- { "J" , Tuple . Create ( 10 , OptionRight . Call ) } , { "V" , Tuple . Create ( 10 , OptionRight . Put ) } ,
561- { "K" , Tuple . Create ( 11 , OptionRight . Call ) } , { "W" , Tuple . Create ( 11 , OptionRight . Put ) } ,
562- { "L" , Tuple . Create ( 12 , OptionRight . Call ) } , { "X" , Tuple . Create ( 12 , OptionRight . Put ) } ,
563-
564- } ;
548+ /// <summary>
549+ /// A dictionary that maps option symbols to a tuple containing the option series number and the option right (Call or Put).
550+ /// The key represents a single character option symbol, and the value contains the series number and the associated option right.
551+ /// </summary>
552+ /// <remarks>
553+ /// The dictionary is designed to map each option symbol (e.g., "A", "M", "B", etc.) to an option series number and
554+ /// the corresponding option right (either a Call or Put). The series number determines the group of options the symbol belongs to,
555+ /// and the option right indicates whether the option is a Call (buyer has the right to buy) or Put (buyer has the right to sell).
556+ /// </remarks>
557+ public static IReadOnlyDictionary < string , Tuple < int , OptionRight > > OptionCodeLookup { get ; } = new Dictionary < string , Tuple < int , OptionRight > >
558+ {
559+ { "A" , Tuple . Create ( 1 , OptionRight . Call ) } , { "M" , Tuple . Create ( 1 , OptionRight . Put ) } ,
560+ { "B" , Tuple . Create ( 2 , OptionRight . Call ) } , { "N" , Tuple . Create ( 2 , OptionRight . Put ) } ,
561+ { "C" , Tuple . Create ( 3 , OptionRight . Call ) } , { "O" , Tuple . Create ( 3 , OptionRight . Put ) } ,
562+ { "D" , Tuple . Create ( 4 , OptionRight . Call ) } , { "P" , Tuple . Create ( 4 , OptionRight . Put ) } ,
563+ { "E" , Tuple . Create ( 5 , OptionRight . Call ) } , { "Q" , Tuple . Create ( 5 , OptionRight . Put ) } ,
564+ { "F" , Tuple . Create ( 6 , OptionRight . Call ) } , { "R" , Tuple . Create ( 6 , OptionRight . Put ) } ,
565+ { "G" , Tuple . Create ( 7 , OptionRight . Call ) } , { "S" , Tuple . Create ( 7 , OptionRight . Put ) } ,
566+ { "H" , Tuple . Create ( 8 , OptionRight . Call ) } , { "T" , Tuple . Create ( 8 , OptionRight . Put ) } ,
567+ { "I" , Tuple . Create ( 9 , OptionRight . Call ) } , { "U" , Tuple . Create ( 9 , OptionRight . Put ) } ,
568+ { "J" , Tuple . Create ( 10 , OptionRight . Call ) } , { "V" , Tuple . Create ( 10 , OptionRight . Put ) } ,
569+ { "K" , Tuple . Create ( 11 , OptionRight . Call ) } , { "W" , Tuple . Create ( 11 , OptionRight . Put ) } ,
570+ { "L" , Tuple . Create ( 12 , OptionRight . Call ) } , { "X" , Tuple . Create ( 12 , OptionRight . Put ) } ,
571+ } ;
565572
566573
567574 /// <summary>
0 commit comments