/// <summary> /// Updates universe to only contain the symbols in the list /// </summary> /// <param name="universe">Universe to apply the filter too</param> /// <param name="filterList">List of Symbols to keep in the Universe</param> /// <returns>Universe with filter applied</returns> public static OptionFilterUniverse WhereContains(this OptionFilterUniverse universe, List <Symbol> filterList) { universe.AllSymbols = universe.AllSymbols.Where(filterList.Contains).ToList(); universe.IsDynamicInternal = true; return(universe); }
/// <summary> /// Filters universe /// </summary> /// <param name="universe">Universe to apply the filter too</param> /// <param name="predicate">Bool function to determine which Symbol are filtered</param> /// <returns>Universe with filter applied</returns> public static OptionFilterUniverse Where(this OptionFilterUniverse universe, Func <Symbol, bool> predicate) { universe.AllSymbols = universe.AllSymbols.Where(predicate).ToList(); universe.IsDynamicInternal = true; return(universe); }
/// <summary> /// Binds universe /// </summary> /// <param name="universe">Universe to apply the filter too</param> /// <param name="mapFunc">Symbol function to determine which Symbols are filtered</param> /// <returns>Universe with filter applied</returns> public static OptionFilterUniverse SelectMany(this OptionFilterUniverse universe, Func <Symbol, IEnumerable <Symbol> > mapFunc) { universe.AllSymbols = universe.AllSymbols.SelectMany(mapFunc).ToList(); universe.IsDynamicInternal = true; return(universe); }
/// <summary> /// Maps universe /// </summary> public static OptionFilterUniverse Select(this OptionFilterUniverse universe, Func <Symbol, Symbol> mapFunc) { universe._allSymbols = universe._allSymbols.Select(mapFunc).ToList(); universe._isDynamic = true; return(universe); }