QLNet.IndexManager.instance C# (CSharp) Метод

instance() публичный статический Метод

public static instance ( ) : IndexManager
Результат IndexManager
        public static IndexManager instance()
        {
            return instance_;
        }

Usage Example

Пример #1
0
        /*! \warning the forecastTodaysFixing parameter (required by
         *           the Index interface) is currently ignored.
         */
        public override double fixing(Date aFixingDate, bool forecastTodaysFixing = false)
        {
            if (!needsForecast(aFixingDate))
            {
                KeyValuePair <Date, Date> lim = Utils.inflationPeriod(aFixingDate, frequency_);
                Utils.QL_REQUIRE(IndexManager.instance().getHistory(name()).value().ContainsKey(lim.Key), () =>
                                 "Missing " + name() + " fixing for " + lim.Key);

                double pastFixing = IndexManager.instance().getHistory(name()).value()[lim.Key];
                double theFixing  = pastFixing;
                if (interpolated_)
                {
                    // fixings stored on first day of every period
                    if (aFixingDate == lim.Key)
                    {
                        // we don't actually need the next fixing
                        theFixing = pastFixing;
                    }
                    else
                    {
                        Utils.QL_REQUIRE(IndexManager.instance().getHistory(name()).value().ContainsKey(lim.Value + 1), () =>
                                         "Missing " + name() + " fixing for " + (lim.Value + 1));
                        double pastFixing2 = IndexManager.instance().getHistory(name()).value()[lim.Value + 1];
                        // now linearly interpolate
                        double daysInPeriod = lim.Value + 1 - lim.Key;
                        theFixing = pastFixing + (pastFixing2 - pastFixing) * (aFixingDate - lim.Key) / daysInPeriod;
                    }
                }
                return(theFixing);
            }
            else
            {
                return(forecastFixing(aFixingDate));
            }
        }
All Usage Examples Of QLNet.IndexManager::instance