Changeset 154
- Timestamp:
- 05/07/08 06:27:11 (5 months ago)
- Files:
-
- trunk/QLNet/QLNet/Currencies/ExchangeRateManager.cs (modified) (1 diff)
- trunk/QLNet/QLNet/Indexes/Indexmanager.cs (modified) (4 diffs)
- trunk/QLNet/QLNet/Settings.cs (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/QLNet/QLNet/Currencies/ExchangeRateManager.cs
r153 r154 34 34 { 35 35 [ThreadStatic] 36 public static readonly ExchangeRateManager Instance = new ExchangeRateManager(); 36 private static ExchangeRateManager instance_ = null; 37 public static ExchangeRateManager Instance 38 { 39 get 40 { 41 if (instance_ == null) 42 { 43 instance_ = 44 new ExchangeRateManager(); 45 } 46 return instance_; 47 } 48 } 49 37 50 private ExchangeRateManager() { 38 51 addKnownRates(); trunk/QLNet/QLNet/Indexes/Indexmanager.cs
r153 r154 27 27 28 28 [ThreadStatic] 29 private static Dictionary<string, TimeSeries<double>> data_ = new Dictionary<string, TimeSeries<double>>(); 30 29 private static Dictionary<string, TimeSeries<double>> data_ = null; 30 public static Dictionary<string, TimeSeries<double>> Data 31 { 32 get 33 { 34 if (data_ == null) 35 { 36 data_ = new Dictionary<string, TimeSeries<double>>(); 37 } 38 return data_; 39 } 40 } 41 31 42 //! returns whether historical fixings were stored for the index 32 43 public static bool hasHistory(string name) { 33 return data_.ContainsKey(name);44 return Data.ContainsKey(name); 34 45 } 35 46 36 47 //! returns the (possibly empty) history of the index fixings 37 48 public static TimeSeries<double> getHistory(string name) { 38 return hasHistory(name) ? data_[name] : new TimeSeries<double>();49 return hasHistory(name) ? Data[name] : new TimeSeries<double>(); 39 50 } 40 51 … … 42 53 public static void setHistory(string name, TimeSeries<double> history) { 43 54 if (hasHistory(name)) 44 data_[name] = history;55 Data[name] = history; 45 56 else 46 data_.Add(name, history);57 Data.Add(name, history); 47 58 } 48 59 49 60 //! observer notifying of changes in the index fixings 50 61 public static TimeSeries<double> notifier(string name) { 51 return data_[name];62 return Data[name]; 52 63 } 53 64 … … 55 66 public static List<string> histories() { 56 67 List<string> t = new List<string>(); 57 foreach (string s in data_.Keys)68 foreach (string s in Data.Keys) 58 69 t.Add(s); 59 70 return t; … … 62 73 //! clears the historical fixings of the index 63 74 public static void clearHistory(string name) { 64 data_[name].Clear();75 Data[name].Clear(); 65 76 } 66 77 67 78 //! clears all stored fixings 68 79 public static void clearHistories() { 69 data_.Clear();80 Data.Clear(); 70 81 } 71 82 } trunk/QLNet/QLNet/Settings.cs
r153 r154 29 29 30 30 [ThreadStatic] 31 private static Date evaluationDate_ = Date.Today;31 private static Date evaluationDate_ = null; 32 32 33 33 [ThreadStatic] 34 34 private static bool enforcesTodaysHistoricFixings_ = false; 35 35 36 public static Date evaluationDate() { return evaluationDate_; } 36 public static Date evaluationDate() 37 { 38 if (evaluationDate_ == null) 39 evaluationDate_ = Date.Today; 40 return evaluationDate_; 41 } 42 37 43 public static void setEvaluationDate(Date d) { 38 44 evaluationDate_ = d;