Example #1
0
        public void SetupFeatures(IFeatureCollection pathProcessFeaturesCollection)
        {
            var mappingFeature = pathProcessFeaturesCollection.GetFeature <IPathMappingFeature>();

            _factorIndex = mappingFeature.AddDimension(_name);

            _timesteps = pathProcessFeaturesCollection.GetFeature <ITimeStepsFeature>();
            _timesteps.AddDates(_pastFixings.Keys.Where(x => x < _startDate));

            var stepSize = (_expiryDate - _startDate).TotalDays / _numberOfSteps;
            var simDates = new List <DateTime>();

            for (var i = 0; i < _numberOfSteps; i++)
            {
                simDates.Add(_startDate.AddDays(i * stepSize).Date);
            }

            _timesteps.AddDates(simDates.Distinct());
        }
Example #2
0
        public void SetupFeatures(IFeatureCollection pathProcessFeaturesCollection)
        {
            _factorIndices = new int[_codes.Count];
            var mappingFeature = pathProcessFeaturesCollection.GetFeature <IPathMappingFeature>();

            for (var c = 0; c < _factorIndices.Length; c++)
            {
                _factorIndices[c] = mappingFeature.AddDimension(_codes[c]);
            }
            _mainFactorIndex = mappingFeature.AddDimension(_name);
            _timesteps       = pathProcessFeaturesCollection.GetFeature <ITimeStepsFeature>();
            var simDates = new List <DateTime>(_pastFixings.Keys.Where(x => x < _startDate));
            var stepSize = (_expiryDate - _startDate).TotalDays / _numberOfSteps;

            for (var i = 0; i < _numberOfSteps - 1; i++)
            {
                simDates.Add(_startDate.AddDays(i * stepSize).Date);
            }
            simDates = simDates.Distinct().ToList();
            _timesteps.AddDates(simDates);
        }