20 using System.Collections.Generic;
31 private readonly
string _market;
32 private readonly
bool _fundamentalData;
33 private readonly
bool _filterFineData;
35 private readonly Func<IEnumerable<Fundamental>, IEnumerable<Symbol>> _selector;
43 _fundamentalData =
true;
54 _fundamentalData =
true;
55 _universeSettings = universeSettings;
63 : this(
Market.USA, universeSettings)
77 _fundamentalData =
true;
78 _universeSettings = universeSettings;
87 : this(
Market.USA, selector, universeSettings)
100 Func<IEnumerable<Fundamental>,
object> selectorFunc;
101 if (selector.TryConvertToDelegate(out selectorFunc))
103 _selector = selectorFunc.ConvertToUniverseSelectionSymbolDelegate();
113 : this(
Market.USA, selector, universeSettings)
121 [Obsolete(
"Fine and Coarse selection are merged, please use 'FundamentalUniverseSelectionModel()'")]
123 : this(filterFineData, null)
132 [Obsolete(
"Fine and Coarse selection are merged, please use 'FundamentalUniverseSelectionModel(UniverseSettings)'")]
136 _filterFineData = filterFineData;
137 _universeSettings = universeSettings;
147 if (_fundamentalData)
158 if (universe.UniverseSettings.Asynchronous.HasValue && universe.UniverseSettings.Asynchronous.Value)
160 throw new ArgumentException(
"Asynchronous universe setting is not supported for coarse & fine selections, please use the new Fundamental single pass selection");
162 #pragma warning disable CS0618 // Type or member is obsolete
164 #pragma warning restore CS0618 // Type or member is obsolete
166 yield
return universe;
184 coarse = coarse.Where(c => c.HasFundamentalData);
187 #pragma warning disable CS0618 // Type or member is obsolete
189 #pragma warning restore CS0618 // Type or member is obsolete
199 public virtual IEnumerable<Symbol>
Select(
QCAlgorithm algorithm, IEnumerable<Fundamental> fundamental)
201 if(_selector ==
null)
203 throw new NotImplementedException(
"If inheriting, please overrride the 'Select' fundamental function, else provide it as a constructor parameter");
205 return _selector(fundamental);
214 [Obsolete(
"Fine and Coarse selection are merged, please use 'Select(QCAlgorithm, IEnumerable<Fundamental>)'")]
217 throw new NotImplementedException(
"Please overrride the 'Select' fundamental function");
226 [Obsolete(
"Fine and Coarse selection are merged, please use 'Select(QCAlgorithm, IEnumerable<Fundamental>)'")]
230 return fine.Select(f => f.Symbol);
238 [Obsolete(
"Fine and Coarse selection are merged, please use 'Fundamental(Func<IEnumerable<Fundamental>, IEnumerable<Symbol>>)'")]
250 [Obsolete(
"Fine and Coarse selection are merged, please use 'Fundamental(Func<IEnumerable<Fundamental>, IEnumerable<Symbol>>)'")]
251 public static IUniverseSelectionModel Fine(Func<IEnumerable<CoarseFundamental>, IEnumerable<Symbol>> coarseSelector, Func<IEnumerable<FineFundamental>, IEnumerable<Symbol>> fineSelector)