Пример #1
0
        public void addFixings(Dictionary <Date, double> source, bool forceOverwrite)
        {
            ObservableValue <TimeSeries <double> > target = IndexManager.instance().getHistory(name());

            foreach (Date d in source.Keys)
            {
                if (isValidFixingDate(d))
                {
                    if (!target.value().ContainsKey(d))
                    {
                        target.value().Add(d, source[d]);
                    }
                    else
                    if (forceOverwrite)
                    {
                        target.value()[d] = source[d];
                    }
                    else if (Utils.close(target.value()[d], source[d]))
                    {
                        continue;
                    }
                    else
                    {
                        throw new ArgumentException("Duplicated fixing provided: " + d + ", " + source[d] +
                                                    " while " + target.value()[d] + " value is already present");
                    }
                }
                else
                {
                    throw new ArgumentException("Invalid fixing provided: " + d.DayOfWeek + " " + d + ", " + source[d]);
                }
            }

            IndexManager.instance().setHistory(name(), target);
        }
 public ObservableValue(ObservableValue <T> t)
 {
     value_ = t.value_;
 }
 public ObservableValue <T> Assign(ObservableValue <T> t)
 {
     value_ = t.value_;
     notifyObservers();
     return(this);
 }
Пример #4
0
 //! stores the historical fixings of the index
 public void setHistory(string name, ObservableValue <TimeSeries <double?> > history)
 {
     checkExists(name);
     data_[name].Assign(history);
 }