@@ -178,6 +178,7 @@ def maybe_values_list_to_string(
178178
179179def maybe_symbols_list_to_string (
180180 symbols : Optional [Union [Iterable [str ], str ]],
181+ stype_in : SType ,
181182) -> Optional [str ]:
182183 """
183184 Concatenate a symbols string or iterable of symbol strings (if not None).
@@ -186,21 +187,31 @@ def maybe_symbols_list_to_string(
186187 ----------
187188 symbols : iterable of str or str, optional
188189 The symbols to concatenate.
190+ stype_in : SType
191+ The input symbology type for the request.
189192
190193 Returns
191194 -------
192195 str or ``None``
193196
194197 """
195198 if symbols is None :
196- return None # All symbols
197-
198- if isinstance (symbols , str ):
199- return symbols .strip ().rstrip ("," ).upper ()
200- elif isinstance (symbols , Iterable ):
201- return "," .join (symbols ).strip ().upper ()
202- else :
203- raise TypeError (f"invalid symbols type, was { type (symbols )} " )
199+ return None # Full universe
200+
201+ symbols_list = symbols .split ("," ) if isinstance (symbols , str ) else list (symbols )
202+ cleaned_symbols : List [str ] = []
203+ for symbol in symbols_list :
204+ if not symbol :
205+ continue
206+ symbol = symbol .strip ().upper ()
207+ if stype_in == SType .SMART :
208+ pieces : List [str ] = symbol .split ("." )
209+ if len (pieces ) == 3 :
210+ symbol = f"{ pieces [0 ]} .{ pieces [1 ].lower ()} .{ pieces [2 ]} "
211+
212+ cleaned_symbols .append (symbol )
213+
214+ return "," .join (cleaned_symbols )
204215
205216
206217def maybe_date_to_string (value : Optional [Union [date , str ]]) -> Optional [str ]:
0 commit comments