Changeset 225
- Timestamp:
- 07/15/08 05:45:12 (2 months ago)
- Files:
-
- trunk/QLNet/QLNet.sln (modified) (1 diff)
- trunk/QLNet/QLNet.vsmdi (modified) (2 diffs)
- trunk/QLNet/QLNet/Error.cs (modified) (1 diff)
- trunk/QLNet/QLNet/Indexes/Ibor/DailyTenorLibor.cs (modified) (1 diff)
- trunk/QLNet/QLNet/Indexes/Ibor/Euribor.cs (modified) (4 diffs)
- trunk/QLNet/QLNet/Indexes/Ibor/Eurlibor.cs (modified) (4 diffs)
- trunk/QLNet/QLNet/Indexes/Ibor/Usdlibor.cs (modified) (1 diff)
- trunk/QLNet/QLNet/Instruments/Bonds/Fixedratebond.cs (modified) (1 diff)
- trunk/QLNet/QLNet/Instruments/Bonds/FloatingRateBond.cs (modified) (1 diff)
- trunk/QLNet/QLNet/Math/Matrix.cs (modified) (2 diffs)
- trunk/QLNet/QLNet/Math/matrixutilities/choleskydecomposition.cs (added)
- trunk/QLNet/QLNet/Math/matrixutilities/pseudosqrt.cs (added)
- trunk/QLNet/QLNet/Math/matrixutilities/svd.cs (modified) (4 diffs)
- trunk/QLNet/QLNet/Math/matrixutilities/symmetricschurdecomposition.cs (added)
- trunk/QLNet/QLNet/Methods/montecarlo/earlyexercisepathpricer.cs (modified) (2 diffs)
- trunk/QLNet/QLNet/Methods/montecarlo/longstaffschwartzpathpricer.cs (modified) (3 diffs)
- trunk/QLNet/QLNet/Methods/montecarlo/montecarlomodel.cs (modified) (2 diffs)
- trunk/QLNet/QLNet/Methods/montecarlo/multipath.cs (modified) (2 diffs)
- trunk/QLNet/QLNet/Methods/montecarlo/path.cs (modified) (1 diff)
- trunk/QLNet/QLNet/Methods/montecarlo/pathpricer.cs (modified) (1 diff)
- trunk/QLNet/QLNet/Methods/montecarlo/sample.cs (modified) (1 diff)
- trunk/QLNet/QLNet/Pricingengines/mclongstaffschwartzengine.cs (modified) (4 diffs)
- trunk/QLNet/QLNet/Pricingengines/mcsimulation.cs (modified) (2 diffs)
- trunk/QLNet/QLNet/Pricingengines/vanilla/mcamericanengine.cs (modified) (5 diffs)
- trunk/QLNet/QLNet/Pricingengines/vanilla/mceuropeanengine.cs (modified) (3 diffs)
- trunk/QLNet/QLNet/QLNet.csproj (modified) (3 diffs)
- trunk/QLNet/QLNet/Time/Date.cs (modified) (1 diff)
- trunk/QLNet/QLNet/Time/DayCounters/ActualActual.cs (modified) (1 diff)
- trunk/QLNet/QLNet/Time/Period.cs (modified) (11 diffs)
- trunk/QLNet/QLNet/processes/stochasticprocessarray.cs (added)
- trunk/QLNet/Test2008/T_Matrices.cs (added)
- trunk/QLNet/Test2008/T_Mclongstaffschwartzengine.cs (added)
- trunk/QLNet/Test2008/Test2008.csproj (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/QLNet/QLNet.sln
r187 r225 51 51 {96693C81-8F03-4FCF-AC22-470820236A8A}.Release|Any CPU.ActiveCfg = Release|Any CPU 52 52 {96693C81-8F03-4FCF-AC22-470820236A8A}.Release|Any CPU.Build.0 = Release|Any CPU 53 {6F0131DC-A031-4422-85AD-C8C497AE244F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU54 {6F0131DC-A031-4422-85AD-C8C497AE244F}.Debug|Any CPU.Build.0 = Debug|Any CPU53 {6F0131DC-A031-4422-85AD-C8C497AE244F}.Debug|Any CPU.ActiveCfg = Release|Any CPU 54 {6F0131DC-A031-4422-85AD-C8C497AE244F}.Debug|Any CPU.Build.0 = Release|Any CPU 55 55 {6F0131DC-A031-4422-85AD-C8C497AE244F}.Release|Any CPU.ActiveCfg = Release|Any CPU 56 56 {6F0131DC-A031-4422-85AD-C8C497AE244F}.Release|Any CPU.Build.0 = Release|Any CPU trunk/QLNet/QLNet.vsmdi
r204 r225 10 10 <TestList name="Swap" id="1fb9da58-c37b-40da-9772-c8899ed4f8c6" parentListId="8c43106b-9dc1-4907-a29f-aa66a61bf5b6"> 11 11 <TestLinks> 12 <TestLink id=" 019427b9-dea4-5598-dd43-a00afdcf7984" name="testCachedValue" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />12 <TestLink id="bfdd9348-cf70-0cc9-aefe-30e8f235d572" name="testSpreadDependency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 13 13 <TestLink id="cd832602-6407-a10e-5585-88a96542e91e" name="testInArrears" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 14 14 <TestLink id="4a7f54ba-aa40-17eb-4f2c-4e956babf8b3" name="testRateDependency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 15 15 <TestLink id="6d8e3375-fefb-38b0-2f10-3bb7dcdc7cc6" name="testFairRate" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 16 <TestLink id=" bfdd9348-cf70-0cc9-aefe-30e8f235d572" name="testSpreadDependency" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />16 <TestLink id="019427b9-dea4-5598-dd43-a00afdcf7984" name="testCachedValue" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 17 17 <TestLink id="f909c484-4167-4782-e0bc-cd5f18e918ba" name="testFairSpread" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 18 </TestLinks> 19 </TestList> 20 <TestList name="Matrices" id="25633d76-5f09-440e-8201-24fb89c87f80" parentListId="8c43106b-9dc1-4907-a29f-aa66a61bf5b6"> 21 <TestLinks> 22 <TestLink id="b4704ed2-b5d7-2ec0-af5e-d8f52bdc6660" name="testEigenvectors" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 18 23 </TestLinks> 19 24 </TestList> … … 84 89 <TestList name="American Option" id="da9a808d-acf7-4baf-9dfb-e4b091d30fef" parentListId="8c43106b-9dc1-4907-a29f-aa66a61bf5b6"> 85 90 <TestLinks> 86 <TestLink id=" 33c4d801-48ac-44c4-329e-d6fe84f5e034" name="testJuValues" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />91 <TestLink id="2bbf531b-68cb-84c0-a06f-6bedfb89f20f" name="testBaroneAdesiWhaleyValues" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 87 92 <TestLink id="3be50179-04ee-902d-73d8-3c94e9305a67" name="testFdShoutGreeks" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 88 93 <TestLink id="783f96db-cce8-bf61-b280-f5010f7d7eb3" name="testFdValues" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 89 94 <TestLink id="1e42c90a-8e82-1369-9ed9-52b036b1c07e" name="testBjerksundStenslandValues" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 90 95 <TestLink id="9f4ff6f8-9938-8ecb-5608-7dbc928cbda3" name="testFdAmericanGreeks" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 91 <TestLink id=" 2bbf531b-68cb-84c0-a06f-6bedfb89f20f" name="testBaroneAdesiWhaleyValues" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" />96 <TestLink id="33c4d801-48ac-44c4-329e-d6fe84f5e034" name="testJuValues" storage="test2008\bin\debug\test2008.dll" type="Microsoft.VisualStudio.TestTools.TestTypes.Unit.UnitTestElement, Microsoft.VisualStudio.QualityTools.Tips.UnitTest.ObjectModel, PublicKeyToken=b03f5f7f11d50a3a" /> 92 97 </TestLinks> 93 98 </TestList> trunk/QLNet/QLNet/Error.cs
r217 r225 23 23 namespace QLNet { 24 24 public class Error { 25 public static ArgumentException UnknownTimeUnit(TimeUnit u) {26 return new ArgumentException("Unknown TimeUnit: " + u); }27 25 public static ArgumentException UnknownFrequency(Frequency f) { 28 26 return new ArgumentException("Unknown frequency: " + f); } trunk/QLNet/QLNet/Indexes/Ibor/DailyTenorLibor.cs
r111 r225 23 23 24 24 namespace QLNet { 25 //! base class for O/N-S/N BBA LIBOR indexes but the EUR ones 26 // ! One day deposit LIBOR fixed by BBA. 27 // 28 // See <http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1414>. 29 // 30 public class DailyTenorLibor : IborIndex { 31 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 : 32 // no o/n or s/n fixings (as the case may be) will take place 33 // when the principal centre of the currency concerned is 34 // closed but London is open on the fixing day. 35 public DailyTenorLibor(string familyName, int settlementDays, Currency currency, Calendar financialCenterCalendar, 36 DayCounter dayCounter) 37 : this(familyName, settlementDays, currency, financialCenterCalendar, dayCounter, new Handle<YieldTermStructure>()) { 38 } 25 39 26 //! base class for O/N-S/N BBA LIBOR indexes but the EUR ones 27 // ! One day deposit LIBOR fixed by BBA. 28 // 29 // See <http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1414>. 30 // 31 public class DailyTenorLibor : IborIndex 32 { 33 34 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 : 35 // no o/n or s/n fixings (as the case may be) will take place 36 // when the principal centre of the currency concerned is 37 // closed but London is open on the fixing day. 38 39 public DailyTenorLibor(string familyName, int settlementDays, Currency currency, Calendar financialCenterCalendar, DayCounter dayCounter) : this(familyName, settlementDays, currency, financialCenterCalendar, dayCounter, new Handle<YieldTermStructure>()) 40 { 41 } 42 43 public DailyTenorLibor(string familyName, int settlementDays, Currency currency, Calendar financialCenterCalendar, DayCounter dayCounter, Handle<YieldTermStructure> h) 44 : base(familyName, new Period(1, TimeUnit.Days), settlementDays, currency, new JointCalendar(new UnitedKingdom(UnitedKingdom.Market.Exchange), financialCenterCalendar, JointCalendar.JointCalendarRule.JoinHolidays), 45 Utils.liborConvention(new Period(1, TimeUnit.Days)), 46 Utils.liborEOM(new Period(1, TimeUnit.Days)), dayCounter, h) 47 { 48 if (!(currency!= new EURCurrency())) 40 public DailyTenorLibor(string familyName, int settlementDays, Currency currency, Calendar financialCenterCalendar, 41 DayCounter dayCounter, Handle<YieldTermStructure> h) 42 : base(familyName, new Period(1, TimeUnit.Days), settlementDays, currency, 43 new JointCalendar(new UnitedKingdom(UnitedKingdom.Market.Exchange), financialCenterCalendar, JointCalendar.JointCalendarRule.JoinHolidays), 44 Utils.liborConvention(new Period(1, TimeUnit.Days)), Utils.liborEOM(new Period(1, TimeUnit.Days)), dayCounter, h) { 45 if (!(currency != new EURCurrency())) 49 46 throw new ApplicationException("for EUR Libor dedicated EurLibor constructor must be used"); 50 }51 }47 } 48 } 52 49 } trunk/QLNet/QLNet/Indexes/Ibor/Euribor.cs
r61 r225 23 23 24 24 namespace QLNet { 25 26 // %Euribor index 27 // Euribor rate fixed by the ECB. 28 // This is the rate fixed by the ECB. Use EurLibor if you're interested in the London fixing by BBA. 29 public class Euribor : IborIndex { 30 public Euribor(Period tenor) : this(tenor, new Handle<YieldTermStructure>()) { } 31 public Euribor(Period tenor, Handle<YieldTermStructure> h) : 32 base("Euribor", tenor, 2, // settlementDays 33 new EURCurrency(), new TARGET(), 34 euriborConvention(tenor), euriborEOM(tenor), 35 new Actual360(), h) { } 36 37 private static BusinessDayConvention euriborConvention(Period p) { 25 public static partial class Utils { 26 public static BusinessDayConvention euriborConvention(Period p) { 38 27 switch (p.units()) { 39 28 case TimeUnit.Days: … … 44 33 return BusinessDayConvention.ModifiedFollowing; 45 34 default: 46 throw Error.UnknownTimeUnit(p.units());35 throw new ArgumentException("Unknown TimeUnit: " + p.units()); 47 36 } 48 37 } 49 38 50 p rivatestatic bool euriborEOM(Period p) {39 public static bool euriborEOM(Period p) { 51 40 switch (p.units()) { 52 41 case TimeUnit.Days: … … 57 46 return true; 58 47 default: 59 throw Error.UnknownTimeUnit(p.units());48 throw new ArgumentException("Unknown TimeUnit: " + p.units()); 60 49 } 61 50 } 51 } 52 /// <summary> 53 /// %Euribor index 54 /// Euribor rate fixed by the ECB. 55 /// This is the rate fixed by the ECB. Use EurLibor if you're interested in the London fixing by BBA. 56 /// </summary> 57 public class Euribor : IborIndex { 58 public Euribor(Period tenor) : this(tenor, new Handle<YieldTermStructure>()) { } 59 public Euribor(Period tenor, Handle<YieldTermStructure> h) : 60 base("Euribor", tenor, 2, // settlementDays 61 new EURCurrency(), new TARGET(), 62 Utils.euriborConvention(tenor), Utils.euriborEOM(tenor), 63 new Actual360(), h) { } 64 } 65 66 //! Actual/365 %Euribor index 67 /*! Euribor rate adjusted for the mismatch between the actual/360 68 convention used for Euribor and the actual/365 convention 69 previously used by a few pre-EUR currencies. 70 */ 71 public class Euribor365 : IborIndex { 72 public Euribor365(Period tenor) : this(tenor, new Handle<YieldTermStructure>()) { } 73 public Euribor365(Period tenor, Handle<YieldTermStructure> h) 74 : base("Euribor365", tenor, 75 2, // settlement days 76 new EURCurrency(), new TARGET(), Utils.euriborConvention(tenor), Utils.euriborEOM(tenor), 77 new Actual365Fixed(), h) { 78 if (tenor.units() == TimeUnit.Days) 79 throw new ApplicationException("for daily tenors (" + tenor + ") dedicated DailyTenor constructor must be used"); 80 } 81 } 82 83 84 //! Daily tenor %Euribor index 85 /*! Euribor rate fixed by the ECB. 86 87 \warning This is the rate fixed by the ECB. Use EurLibor 88 if you're interested in the London fixing by BBA. 89 */ 90 public class DailyTenorEuribor : IborIndex { 91 public DailyTenorEuribor(int settlementDays) : this(settlementDays, new Handle<YieldTermStructure>()) { } 92 public DailyTenorEuribor(int settlementDays, Handle<YieldTermStructure> h) 93 : base("Euribor", new Period(1, TimeUnit.Days), settlementDays, 94 new EURCurrency(), new TARGET(), 95 Utils.euriborConvention(new Period(1, TimeUnit.Days)), Utils.euriborEOM(new Period(1, TimeUnit.Days)), 96 new Actual360(), h) { } 97 } 98 99 //! Daily tenor Actual/365 %Euribor index 100 /*! Euribor rate adjusted for the mismatch between the actual/360 101 convention used for Euribor and the actual/365 convention 102 previously used by a few pre-EUR currencies. 103 */ 104 public class DailyTenorEuribor365 : IborIndex { 105 public DailyTenorEuribor365(int settlementDays) : this(settlementDays, new Handle<YieldTermStructure>()) { } 106 public DailyTenorEuribor365(int settlementDays, Handle<YieldTermStructure> h) 107 : base("Euribor365", new Period(1, TimeUnit.Days), 108 settlementDays, 109 new EURCurrency(), new TARGET(), 110 Utils.euriborConvention(new Period(1, TimeUnit.Days)), Utils.euriborEOM(new Period(1, TimeUnit.Days)), 111 new Actual365Fixed(), h) {} 112 } 113 114 //! 1-week %Euribor index 115 public class EuriborSW : Euribor { 116 public EuriborSW() : this(new Handle<YieldTermStructure>()) { } 117 public EuriborSW(Handle<YieldTermStructure> h) : base(new Period(1, TimeUnit.Weeks), h) { } 118 } 119 120 //! 2-weeks %Euribor index 121 public class Euribor2W : Euribor { 122 public Euribor2W() : this(new Handle<YieldTermStructure>()) { } 123 public Euribor2W(Handle<YieldTermStructure> h) : base(new Period(2, TimeUnit.Weeks), h) { } 124 } 125 126 //! 3-weeks %Euribor index 127 public class Euribor3W : Euribor { 128 public Euribor3W() : this(new Handle<YieldTermStructure>()) { } 129 public Euribor3W(Handle<YieldTermStructure> h) : base(new Period(3, TimeUnit.Weeks), h) { } 130 } 131 132 //! 1-month %Euribor index 133 public class Euribor1M : Euribor { 134 public Euribor1M() : this(new Handle<YieldTermStructure>()) { } 135 public Euribor1M(Handle<YieldTermStructure> h) : base(new Period(1, TimeUnit.Months), h) { } 136 } 137 138 //! 2-months %Euribor index 139 public class Euribor2M : Euribor { 140 public Euribor2M() : this(new Handle<YieldTermStructure>()) { } 141 public Euribor2M(Handle<YieldTermStructure> h) : base(new Period(2, TimeUnit.Months), h) { } 62 142 } 63 143 … … 65 145 public class Euribor3M : Euribor { 66 146 public Euribor3M() : this(new Handle<YieldTermStructure>()) { } 67 public Euribor3M(Handle<YieldTermStructure> h) 68 : base(new Period(3, TimeUnit.Months), h) {} 147 public Euribor3M(Handle<YieldTermStructure> h) : base(new Period(3, TimeUnit.Months), h) {} 69 148 } 149 150 // 4-months %Euribor index 151 public class Euribor4M : Euribor { 152 public Euribor4M() : this(new Handle<YieldTermStructure>()) { } 153 public Euribor4M(Handle<YieldTermStructure> h) : base(new Period(4, TimeUnit.Months), h) { } 154 } 155 156 // 5-months %Euribor index 157 public class Euribor5M : Euribor { 158 public Euribor5M() : this(new Handle<YieldTermStructure>()) { } 159 public Euribor5M(Handle<YieldTermStructure> h) : base(new Period(5, TimeUnit.Months), h) { } 160 } 161 70 162 // 6-months %Euribor index 71 163 public class Euribor6M : Euribor { 72 164 public Euribor6M() : this(new Handle<YieldTermStructure>()) { } 73 public Euribor6M(Handle<YieldTermStructure> h) 74 : base(new Period(6, TimeUnit.Months), h) { } 165 public Euribor6M(Handle<YieldTermStructure> h) : base(new Period(6, TimeUnit.Months), h) { } 75 166 } 76 167 } trunk/QLNet/QLNet/Indexes/Ibor/Eurlibor.cs
r111 r225 23 23 24 24 namespace QLNet { 25 26 public static partial class Utils 27 { 28 public static BusinessDayConvention eurliborConvention(Period p) 29 { 30 switch (p.units()) 31 { 25 public static partial class Utils { 26 public static BusinessDayConvention eurliborConvention(Period p) { 27 switch (p.units()) { 32 28 case TimeUnit.Days: 33 29 case TimeUnit.Weeks: … … 37 33 return BusinessDayConvention.ModifiedFollowing; 38 34 default: 39 throw Error.UnknownTimeUnit(p.units());35 throw new ArgumentException("Unknown TimeUnit: " + p.units()); 40 36 } 41 37 } 42 38 43 public static bool eurliborEOM(Period p) 44 { 45 switch (p.units()) 46 { 39 public static bool eurliborEOM(Period p) { 40 switch (p.units()) { 47 41 case TimeUnit.Days: 48 42 case TimeUnit.Weeks: … … 52 46 return true; 53 47 default: 54 throw Error.UnknownTimeUnit(p.units());48 throw new ArgumentException("Unknown TimeUnit: " + p.units()); 55 49 } 56 50 } 57 51 } 58 52 59 //! base class for all BBA %EUR %LIBOR indexes but the O/N 60 // ! Euro LIBOR fixed by BBA. 61 // 62 // See <http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1414>. 63 // 64 // \warning This is the rate fixed in London by BBA. Use Euribor if 65 // you're interested in the fixing by the ECB. 66 // 67 public class EURLibor : IborIndex 68 {53 /// <summary> 54 /// base class for all BBA %EUR %LIBOR indexes but the O/N 55 /// ! Euro LIBOR fixed by BBA. 56 /// 57 /// See <http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1414>. 58 /// 59 /// \warning This is the rate fixed in London by BBA. Use Euribor if 60 /// you're interested in the fixing by the ECB. 61 /// </summary> 62 public class EURLibor : IborIndex { 69 63 private Calendar target_; 70 64 71 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 :72 // JoinBusinessDays is the fixing calendar for73 // all indexes but o/n65 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 : 66 // JoinBusinessDays is the fixing calendar for 67 // all indexes but o/n 74 68 75 69 public EURLibor(Period tenor) 76 70 : base("EURLibor", tenor, 2, new EURCurrency(), new JointCalendar(new UnitedKingdom(UnitedKingdom.Market.Exchange), new TARGET(), 77 71 JointCalendar.JointCalendarRule.JoinHolidays), 78 Utils.eurliborConvention(tenor), Utils.eurliborEOM(tenor), new Actual360(), 79 new Handle<YieldTermStructure>()) 80 { 72 Utils.eurliborConvention(tenor), Utils.eurliborEOM(tenor), new Actual360(), 73 new Handle<YieldTermStructure>()) { 81 74 target_ = new TARGET(); 82 75 if (!(tenor.units() != TimeUnit.Days)) … … 84 77 } 85 78 86 public EURLibor(Period tenor, Handle<YieldTermStructure> h) 79 public EURLibor(Period tenor, Handle<YieldTermStructure> h) 87 80 : base("EURLibor", tenor, 2, new EURCurrency(), new JointCalendar(new UnitedKingdom(UnitedKingdom.Market.Exchange), new TARGET(), 88 81 JointCalendar.JointCalendarRule.JoinHolidays), 89 Utils.eurliborConvention(tenor), Utils.eurliborEOM(tenor), new Actual360(), h) 90 { 91 target_ = new TARGET(); 92 if (!(tenor.units()!= TimeUnit.Days)) 82 Utils.eurliborConvention(tenor), Utils.eurliborEOM(tenor), new Actual360(), h) { 83 target_ = new TARGET(); 84 if (!(tenor.units() != TimeUnit.Days)) 93 85 throw new ApplicationException("for daily tenors (" + tenor + ") dedicated DailyTenor constructor must be used"); 94 } 95 96 // ! \name Date calculations 97 // 98 // see http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 99 // @{ 100 // 101 public override Date valueDate(Date fixingDate) 102 { 103 104 if (!(isValidFixingDate(fixingDate))) 86 } 87 88 // ! \name Date calculations 89 // 90 // see http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 91 // @{ 92 // 93 public override Date valueDate(Date fixingDate) { 94 95 if (!(isValidFixingDate(fixingDate))) 105 96 throw new ApplicationException("Fixing date " + fixingDate + " is not valid"); 106 107 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 : 108 // In the case of EUR the Value Date shall be two TARGET 109 // business days after the Fixing Date. 110 return target_.advance(fixingDate, fixingDays_, TimeUnit.Days); 111 } 112 public override Date maturityDate(Date valueDate) 113 { 114 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 : 115 // In the case of EUR only, maturity dates will be based on days in 116 // which the Target system is open. 117 return target_.advance(valueDate, tenor_, convention_, endOfMonth()); 118 } 119 } 120 121 //! base class for the one day deposit BBA %EUR %LIBOR indexes 122 // ! Euro O/N LIBOR fixed by BBA. It can be also used for T/N and S/N 123 // indexes, even if such indexes do not have BBA fixing. 124 // 125 // See <http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1414>. 126 // 127 // \warning This is the rate fixed in London by BBA. Use Euribor if 128 // you're interested in the fixing by the ECB. 129 // 130 public class DailyTenorEURLibor : IborIndex 131 { 132 133 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 : 134 // no o/n or s/n fixings (as the case may be) will take place 135 // when the principal centre of the currency concerned is 136 // closed but London is open on the fixing day. 137 public DailyTenorEURLibor(int settlementDays) : this(settlementDays, new Handle<YieldTermStructure>()) 138 { 139 } 97 98 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 : 99 // In the case of EUR the Value Date shall be two TARGET 100 // business days after the Fixing Date. 101 return target_.advance(fixingDate, fixingDays_, TimeUnit.Days); 102 } 103 public override Date maturityDate(Date valueDate) { 104 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 : 105 // In the case of EUR only, maturity dates will be based on days in 106 // which the Target system is open. 107 return target_.advance(valueDate, tenor_, convention_, endOfMonth()); 108 } 109 } 110 111 //! base class for the one day deposit BBA %EUR %LIBOR indexes 112 // ! Euro O/N LIBOR fixed by BBA. It can be also used for T/N and S/N 113 // indexes, even if such indexes do not have BBA fixing. 114 // 115 // See <http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1414>. 116 // 117 // \warning This is the rate fixed in London by BBA. Use Euribor if 118 // you're interested in the fixing by the ECB. 119 // 120 public class DailyTenorEURLibor : IborIndex { 121 122 // http://www.bba.org.uk/bba/jsp/polopoly.jsp?d=225&a=1412 : 123 // no o/n or s/n fixings (as the case may be) will take place 124 // when the principal centre of the currency concerned is 125 // closed but London is open on the fixing day. 126 public DailyTenorEURLibor(int settlementDays) 127 : this(settlementDays, new Handle<YieldTermStructure>()) { 128 } 140 129 public DailyTenorEURLibor() 141 130 : base("EURLibor", new Period(1, TimeUnit.Days), 0, new EURCurrency(), new TARGET(), 142 Utils.eurliborConvention(new Period(1, TimeUnit.Days)), Utils.eurliborEOM(new Period(1, TimeUnit.Days)), new Actual360(), new Handle<YieldTermStructure>()) 143 { 144 } 131 Utils.eurliborConvention(new Period(1, TimeUnit.Days)), Utils.eurliborEOM(new Period(1, TimeUnit.Days)), new Actual360(), new Handle<YieldTermStructure>()) { 132 } 145 133 public DailyTenorEURLibor(int settlementDays, Handle<YieldTermStructure> h) 146 134 : base("EURLibor", new Period(1, TimeUnit.Days), settlementDays, new EURCurrency(), new TARGET(), 147 Utils.eurliborConvention(new Period(1, TimeUnit.Days)), Utils.eurliborEOM(new Period(1, TimeUnit.Days)), new Actual360(), h) 148 { 149 } 150 } 151 152 //! Overnight %EUR %Libor index 153 public class EURLiborON : DailyTenorEURLibor 154 { 155 public EURLiborON() : base(0, new Handle<YieldTermStructure>()) 156 { 157 } 158 159 public EURLiborON(Handle<YieldTermStructure> h) : base(0, h) 160 { 161 } 162 } 163 164 //! 1-week %EUR %Libor index 165 public class EURLiborSW : EURLibor 166 { 167 public EURLiborSW() : base(new Period(1, TimeUnit.Weeks), new Handle<YieldTermStructure>()) 168 { 169 } 170 public EURLiborSW(Handle<YieldTermStructure> h) : base(new Period(1, TimeUnit.Weeks), h) 171 { 172 } 173 } 174 175 //! 2-weeks %EUR %Libor index 176 public class EURLibor2W : EURLibor 177 { 178 public EURLibor2W() : base(new Period(2, TimeUnit.Weeks), new Handle<YieldTermStructure>()) 179 { 180 } 181 public EURLibor2W(Handle<YieldTermStructure> h) : base(new Period(2, TimeUnit.Weeks), h) 182 { 183 } 184 } 185 186 187 //! 1-month %EUR %Libor index 188 public class EURLibor1M : EURLibor 189 { 190 public EURLibor1M() : base(new Period(1, TimeUnit.Months), new Handle<YieldTermStructure>()) 191 { 192 } 193 public EURLibor1M(Handle<YieldTermStructure> h) : base(new Period(1, TimeUnit.Months), h) 194 { 195 } 196 } 197 198 //! 2-months %EUR %Libor index 199 public class EURLibor2M : EURLibor 200 { 201 public EURLibor2M() : base(new Period(2, TimeUnit.Months), new Handle<YieldTermStructure>()) 202 { 203 } 204 public EURLibor2M(Handle<YieldTermStructure> h) : base(new Period(2, TimeUnit.Months), h) 205 { 206 } 207 } 208 209 //! 3-months %EUR %Libor index 210 public class EURLibor3M : EURLibor 211 { 212 public EURLibor3M() : base(new Period(3, TimeUnit.Months), new Handle<YieldTermStructure>()) 213 { 214 } 215 public EURLibor3M(Handle<YieldTermStructure> h) : base(new Period(3, TimeUnit.Months), h) 216 { 217 } 218 } 219 220 //! 4-months %EUR %Libor index 221 public class EURLibor4M : EURLibor 222 { 223 public EURLibor4M() : base(new Period(4, TimeUnit.Months), new Handle<YieldTermStructure>()) 224 { 225 } 226 public EURLibor4M(Handle<YieldTermStructure> h) : base(new Period(4, TimeUnit.Months), h) 227 { 228 } 229 } 230 231 //! 5-months %EUR %Libor index 232 public class EURLibor5M : EURLibor 233 { 234 public EURLibor5M() : base(new Period(5, TimeUnit.Months), new Handle<YieldTermStructure>()) 235 { 236 } 237 public EURLibor5M(Handle<YieldTermStructure> h) : base(new Period(5, TimeUnit.Months), h) 238 { 239 } 240 } 241 242 //! 6-months %EUR %Libor index 243 public class EURLibor6M : EURLibor 244 { 245 public EURLibor6M() : base(new Period(6, TimeUnit.Months), new Handle<YieldTermStructure>()) 246 { 247 } 248 public EURLibor6M(Handle<YieldTermStructure> h) : base(new Period(6, TimeUnit.Months), h) 249 { 250 } 251 } 252 253 //! 7-months %EUR %Libor index 254 public class EURLibor7M : EURLibor 255 { 256 public EURLibor7M() : base(new Period(7, TimeUnit.Months), new Handle<YieldTermStructure>()) 257 { 258 } 259 public EURLibor7M(Handle<YieldTermStructure> h) : base(new Period(7, TimeUnit.Months), h) 260 { 261 } 262 } 263 264 //! 8-months %EUR %Libor index 265 public class EURLibor8M : EURLibor 266 { 267 public EURLibor8M() : base(new Period(8, TimeUnit.Months), new Handle<YieldTermStructure>()) 268 { 269 } 270 public EURLibor8M(Handle<YieldTermStructure> h) : base(new Period(8, TimeUnit.Months), h) 271 { 272 } 273 } 274 275 //! 9-months %EUR %Libor index 276 public class EURLibor9M : EURLibor 277 { 278 public EURLibor9M() : base(new Period(9, TimeUnit.Months), new Handle<YieldTermStructure>()) 279 { 280 } 281 public EURLibor9M(Handle<YieldTermStructure> h) : base(new Period(9, TimeUnit.Months), h) 282 { 283 } 284 } 285 286 //! 10-months %EUR %Libor index 287 public class EURLibor10M : EURLibor 288 { 289 public EURLibor10M() : base(new Period(10, TimeUnit.Months), new Handle<YieldTermStructure>()) 290 { 291 } 292 public EURLibor10M(Handle<YieldTermStructure> h) : base(new Period(10, TimeUnit.Months), h) 293 { 294 } 295 } 296 297 //! 11-months %EUR %Libor index 298 public class EURLibor11M : EURLibor 299 { 300 public EURLibor11M() : base(new Period(11, TimeUnit.Months), new Handle<YieldTermStructure>()) 301 { 302 } 303 public EURLibor11M(Handle<YieldTermStructure> h) : base(new Period(11, TimeUnit.Months), h) 304 { 305 } 306 } 307 308 //! 1-year %EUR %Libor index 309 public class EURLibor1Y : EURLibor 310 { 311 public EURLibor1Y() : base(new Period(1, TimeUnit.Years), new Handle<YieldTermStructure>()) 312 { 313 } 314 public EURLibor1Y(Handle<YieldTermStructure> h) : base(new Period(1, TimeUnit.Years), h) 315 { 316 } 317 } 135 Utils.eurliborConvention(new Period(1, TimeUnit.Days)), Utils.eurliborEOM(new Period(1, TimeUnit.Days)), new Actual360(), h) { 136 } 137 } 138 139 //! Overnight %EUR %Libor index 140 public class EURLiborON : DailyTenorEURLibor { 141 public EURLiborON() 142 : base(0, new Handle<YieldTermStructure>()) { 143 } 144 145 public EURLiborON(Handle<YieldTermStructure> h) 146 : base(0, h) { 147 } 148 } 149 150 //! 1-week %EUR %Libor index 151 public class EURLiborSW : EURLibor { 152 public EURLiborSW() 153 : base(new Period(1, TimeUnit.Weeks), new Handle<YieldTermStructure>()) { 154 } 155 public EURLiborSW(Handle<YieldTermStructure> h) 156 : base(new Period(1, TimeUnit.Weeks), h) { 157 } 158 } 159 160 //! 2-weeks %EUR %Libor index 161 public class EURLibor2W : EURLibor { 162 public EURLibor2W() 163 : base(new Period(2, TimeUnit.Weeks), new Handle<YieldTermStructure>()) { 164 } 165 public EURLibor2W(Handle<YieldTermStructure> h) 166 : base(new Period(2, TimeUnit.Weeks), h) { 167 } 168 } 169 170 171 //! 1-month %EUR %Libor index 172 public class EURLibor1M : EURLibor { 173 public EURLibor1M() 174 : base(new Period(1, TimeUnit.Months), new Handle<YieldTermStructure>()) { 175 } 176 public EURLibor1M(Handle<YieldTermStructure> h) 177 : base(new Period(1, TimeUnit.Months), h) { 178 } 179 } 180 181 //! 2-months %EUR %Libor index 182 public class EURLibor2M : EURLibor { 183 public EURLibor2M() 184 : base(new Period(2, TimeUnit.Months), new Handle<YieldTermStructure>()) { 185 } 186 public EURLibor2M(Handle<YieldTermStructure> h) 187 : base(new Period(2, TimeUnit.Months), h) { 188 } 189 } 190 191 //! 3-months %EUR %Libor index 192 public class EURLibor3M : EURLibor { 193 public EURLibor3M() 194 : base(new Period(3, TimeUnit.Months), new Handle<YieldTermStructure>()) { 195 } 196 public EURLibor3M(Handle<YieldTermStructure> h) 197 : base(new Period(3, TimeUnit.Months), h) { 198 } 199 } 200 201 //! 4-months %EUR %Libor index 202 public class EURLibor4M : EURLibor { 203 public EURLibor4M() 204 : base(new Period(4, TimeUnit.Months), new Handle<YieldTermStructure>()) { 205 } 206 public EURLibor4M(Handle<YieldTermStructure> h) 207 : base(new Period(4, TimeUnit.Months), h) { 208 } 209 } 210 211 //! 5-months %EUR %Libor index 212 public class EURLibor5M : EURLibor { 213 public EURLibor5M() 214 : base(new Period(5, TimeUnit.Months), new Handle<YieldTermStructure>()) { 215 } 216 public EURLibor5M(Handle<YieldTermStructure> h) 217 : base(new Period(5, TimeUnit.Months), h) { 218 } 219 } 220 221 //! 6-months %EUR %Libor index 222 public class EURLibor6M : EURLibor { 223 public EURLibor6M() 224 : base(new Period(6, TimeUnit.Months), new Handle<YieldTermStructure>()) { 225 } 226 public EURLibor6M(Handle<YieldTermStructure> h) 227 : base(new Period(6, TimeUnit.Months), h) { 228 } 229 } 230 231 //! 7-months %EUR %Libor index 232 public class EURLibor7M : EURLibor { 233 public EURLibor7M() 234 : base(new Period(7, TimeUnit.Months), new Handle<YieldTermStructure>()) { 235 } 236 public EURLibor7M(Handle<YieldTermStructure> h) 237 : base(new Period(7, TimeUnit.Months), h) { 238 } 239 } 240 241 //! 8-months %EUR %Libor index 242 public class EURLibor8M : EURLibor { 243 public EURLibor8M() 244 : base(new Period(8, TimeUnit.Months), new Handle<YieldTermStructure>()) { 245 } 246 public EURLibor8M(Handle<YieldTermStructure> h) 247 : base(new Period(8, TimeUnit.Months), h) { 248 } 249 } 250 251 //! 9-months %EUR %Libor index 252 public class EURLibor9M : EURLibor { 253 public EURLibor9M() 254 : base(new Period(9, TimeUnit.Months), new Handle<YieldTermStructure>()) { 255 } 256 public EURLibor9M(Handle<YieldTermStructure> h) 257 : base(new Period(9, TimeUnit.Months), h) { 258 } 259 } 260 261 //! 10-months %EUR %Libor index 262 public class EURLibor10M : EURLibor { 263 public EURLibor10M() 264 : base(new Period(10, TimeUnit.Months), new Handle<YieldTermStructure>()) { 265 } 266 public EURLibor10M(Handle<YieldTermStructure> h) 267 : base(new Period(10, TimeUnit.Months), h) { 268 } 269 } 270 271 //! 11-months %EUR %Libor index 272 public class EURLibor11M : EURLibor { 273 public EURLibor11M() 274 : base(new Period(11, TimeUnit.Months), new Handle<YieldTermStructure>()) { 275 } 276 public EURLibor11M(Handle<YieldTermStructure> h) 277 : base(new Period(11, TimeUnit.Months), h) { 278 } 279 } 280 281 //! 1-year %EUR %Libor index 282 public class EURLibor1Y : EURLibor { 283 public EURLibor1Y() 284 : base(new Period(1, TimeUnit.Years), new Handle<YieldTermStructure>()) { 285 } 286 public EURLibor1Y(Handle<YieldTermStructure> h) 287 : base(new Period(1, TimeUnit.Years), h) { 288 } 289 } 318 290 319 291 trunk/QLNet/QLNet/Indexes/Ibor/Usdlibor.cs
r144 r225 33 33 : base("USDLibor", tenor, 2, new USDCurrency(), new UnitedStates(UnitedStates.Market.NYSE), new Actual360(), h) { } 34 34 } 35