30 using System.Collections.Generic;
169 registeredTypesProvider,
186 _ =>
throw new ArgumentException(
"Invalid OptionStyle")
190 SetFilter(-1, 1, TimeSpan.Zero, TimeSpan.FromDays(35));
256 return _symbolProperties.ContractUnitOfTrade;
260 _symbolProperties.SetContractUnitOfTrade(value);
271 return (
int)_symbolProperties.ContractMultiplier;
275 _symbolProperties.SetContractMultiplier(value);
428 [Obsolete(
"This property has been deprecated. Please use QLOptionPriceModel.EnableGreekApproximation instead.")]
478 throw new ArgumentException($
"SetOptionAssignmentModel: {pyObject.Repr()} is not a valid argument.");
511 throw new ArgumentException($
"SetOptionExerciseModel: {pyObject.Repr()} is not a valid argument.");
538 SetFilterImp(universe => universe.Strikes(minStrike, maxStrike));
549 public void SetFilter(TimeSpan minExpiry, TimeSpan maxExpiry)
551 SetFilterImp(universe => universe.Expiration(minExpiry, maxExpiry));
568 public void SetFilter(
int minStrike,
int maxStrike, TimeSpan minExpiry, TimeSpan maxExpiry)
570 SetFilterImp(universe => universe
571 .Strikes(minStrike, maxStrike)
572 .Expiration(minExpiry, maxExpiry));
589 public void SetFilter(
int minStrike,
int maxStrike,
int minExpiryDays,
int maxExpiryDays)
591 SetFilterImp(universe => universe
592 .Strikes(minStrike, maxStrike)
593 .Expiration(minExpiryDays, maxExpiryDays));
600 public void SetFilter(Func<OptionFilterUniverse, OptionFilterUniverse> universeFunc)
605 var result = universeFunc(optionUniverse);
606 return result.ApplyTypesFilter();
622 PyObject result = (universeFunc as dynamic)(optionUniverse);
631 if ((result).TryConvert(out filter))
633 optionUniverse = filter;
635 else if ((result).TryConvert(out list))
637 optionUniverse = optionUniverse.WhereContains(list);
641 throw new ArgumentException($
"QCAlgorithm.SetFilter: result type {result.GetPythonType()} from " +
642 $
"filter function is not a valid argument, please return either a OptionFilterUniverse or a list of symbols");
645 return optionUniverse.ApplyTypesFilter();
657 throw new ArgumentException(
"DataNormalizationMode.Raw must be used with options");
660 base.SetDataNormalizationMode(mode);
663 private void SetFilterImp(Func<OptionFilterUniverse, OptionFilterUniverse> universeFunc)
668 var result = universeFunc(optionUniverse);
669 return result.ApplyTypesFilter();
676 internal override void UpdateSymbolProperties(
SymbolProperties symbolProperties)
678 if (symbolProperties !=
null)