Example #1
0
 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)));
 }
Example #2
0
        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);
        }
Example #3
0
 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)));
 }