Beispiel #1
0
 public static ISplineAddOptionalParameters <TResult> AddContract <TResult, TContract>
     (this ISplineAddOptionalParameters <TResult> splineCurveBuilder, TContract singlePeriod, double price)
     where TResult : ITimePeriod <TResult>
     where TContract : ITimePeriod <TContract>
 {
     return(splineCurveBuilder.AddContract(Contract <TResult> .Create(singlePeriod, price)));
 }
Beispiel #2
0
        public static ISplineAddOptionalParameters <T> AddContracts <T>([NotNull] this IMaxSmoothSplineCurveBuilder <T> splineCurveBuilder,
                                                                        [NotNull] IEnumerable <Contract <T> > contracts)
            where T : ITimePeriod <T>
        {
            if (splineCurveBuilder == null)
            {
                throw new ArgumentNullException(nameof(splineCurveBuilder));
            }
            if (contracts == null)
            {
                throw new ArgumentNullException(nameof(contracts));
            }

            var contractList = contracts.ToList();

            if (contractList.Count < 1)
            {
                throw new ArgumentException("contracts must have at least one element", nameof(contracts));
            }

            ISplineAddOptionalParameters <T> addSecondContract = splineCurveBuilder.AddContract(contractList[0]);

            foreach (var contract in contractList.Skip(1))
            {
                addSecondContract = addSecondContract.AddContract(contract);
            }

            return(addSecondContract);
        }
Beispiel #3
0
 public static ISplineAddOptionalParameters <T> AddContract <T>(this ISplineAddOptionalParameters <T> addFirstContract,
                                                                T start, T end, double price)
     where T : ITimePeriod <T>
 {
     return(addFirstContract.AddContract(new Contract <T>(start, end, price)));
 }