public static IBootstrapperAddOptionalParameters <T> AddContract <T, TPrice>(this IBootstrapperAddOptionalParameters <T> addFirstContract, TPrice timePeriod, double price) where T : ITimePeriod <T> where TPrice : ITimePeriod <TPrice> { return(addFirstContract.AddContract(Contract <T> .Create(timePeriod, price))); }
public static IBootstrapperAddOptionalParameters <T> AddContracts <T>([NotNull] this IBootstrapper <T> bootstrapper, [NotNull] IEnumerable <Contract <T> > contracts) where T : ITimePeriod <T> { if (bootstrapper == null) { throw new ArgumentNullException(nameof(bootstrapper)); } if (contracts == null) { throw new ArgumentNullException(nameof(contracts)); } var contractList = contracts.ToList(); if (contractList.Count < 1) { throw new ArgumentException("contracts parameter must contain at least one element.", nameof(contracts)); } IBootstrapperAddOptionalParameters <T> addOptionalParameters = bootstrapper.AddContract(contractList[0]); foreach (var contract in contractList.Skip(1)) { addOptionalParameters = addOptionalParameters.AddContract(contract); } return(addOptionalParameters); }
public static IBootstrapperAddOptionalParameters <T> AddContract <T>(this IBootstrapperAddOptionalParameters <T> addSecondContract, T start, T end, double price) where T : ITimePeriod <T> { return(addSecondContract.AddContract(new Contract <T>(start, end, price))); }