Skip to content

Commit

Permalink
Fix InflationIndex test,Bootstraptraits , testLogLinearZeroConsistenc…
Browse files Browse the repository at this point in the history
…y now all test pass.Update version.
  • Loading branch information
amaggiulli committed Oct 28, 2014
1 parent 79be210 commit fe756bc
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 42 deletions.
2 changes: 1 addition & 1 deletion QLNet/Indexes/InflationIndex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ bool needsForecast(Date fixingDate)
// we're not sure, but the fixing might be there so we
// check. Todo: check which fixings are not possible, to
// avoid using fixings in the future
return !IndexManager.instance().getHistory(name()).value().ContainsKey(latestNeededDate);
return IndexManager.instance().getHistory(name()).value().ContainsKey(latestNeededDate);
}
}

Expand Down
70 changes: 35 additions & 35 deletions QLNet/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// Le informazioni generali relative a un assembly sono controllate dal seguente
// insieme di attributi. Per modificare le informazioni associate a un assembly
// occorre quindi modificare i valori di questi attributi.
[assembly: AssemblyTitle("QLNet")]
[assembly: AssemblyDescription("A free/open-source library for quantitative finance")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("QLNet")]
[assembly: AssemblyCopyright("Copyright (c) 2008-2013 Andrea Maggiulli (a.maggiulli@gmail.com)")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
// COM, impostare su true l'attributo ComVisible per tale tipo.
[assembly: ComVisible(false)]

// Se il progetto viene esposto a COM, il GUID che segue verrà utilizzato per creare l'ID della libreria dei tipi
[assembly: Guid("3595e2b1-f95c-4ddb-bd92-908610e7542d")]

// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
//
// Numero di versione principale
// Numero di versione secondario
// Numero build
// Revisione
//
// È possibile specificare tutti i valori o impostare come predefiniti i valori Numero revisione e Numero build
// utilizzando l'asterisco (*) come descritto di seguito:
[assembly: AssemblyVersion("1.4.0.0")]
[assembly: AssemblyFileVersion("1.4.0.0")]
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// Le informazioni generali relative a un assembly sono controllate dal seguente
// insieme di attributi. Per modificare le informazioni associate a un assembly
// occorre quindi modificare i valori di questi attributi.
[assembly: AssemblyTitle("QLNet")]
[assembly: AssemblyDescription("A free/open-source library for quantitative finance")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("QLNet")]
[assembly: AssemblyCopyright("Copyright (c) 2008-2013 Andrea Maggiulli (a.maggiulli@gmail.com)")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
// COM, impostare su true l'attributo ComVisible per tale tipo.
[assembly: ComVisible(false)]

// Se il progetto viene esposto a COM, il GUID che segue verrà utilizzato per creare l'ID della libreria dei tipi
[assembly: Guid("3595e2b1-f95c-4ddb-bd92-908610e7542d")]

// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
//
// Numero di versione principale
// Numero di versione secondario
// Numero build
// Revisione
//
// È possibile specificare tutti i valori o impostare come predefiniti i valori Numero revisione e Numero build
// utilizzando l'asterisco (*) come descritto di seguito:
[assembly: AssemblyVersion("1.4.0.4")]
[assembly: AssemblyFileVersion("1.4.0.4")]
2 changes: 1 addition & 1 deletion QLNet/Termstructures/Yield/Bootstraptraits.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public interface ITraits<T>

public class Discount : ITraits<YieldTermStructure>
{
const double maxRate = 3;
const double maxRate = 1;
const double avgRate = 0.05;
public Date initialDate( YieldTermStructure c ) { return c.referenceDate(); } // start of curve data
public double initialValue( YieldTermStructure c ) { return 1; } // value at reference date
Expand Down
12 changes: 10 additions & 2 deletions QLNet/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,16 @@ public static void QL_REQUIRE(bool condition, string message)
public static void QL_FAIL(string message)
{
throw new ApplicationException(message);
}

}

public static bool is_QL_NEGATIVE_RATES()
{
#if QL_NEGATIVE_RATES
return true;
#else
return false;
#endif
}
}

// this is a redefined collection class to emulate array-type behaviour at initialisation
Expand Down
12 changes: 9 additions & 3 deletions Test/T_Piecewiseyieldcurve.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,18 @@ public void testLinearDiscountConsistency() {

[TestMethod()]
public void testLogLinearZeroConsistency() {
// "Testing consistency of piecewise-log-linear zero-yield curve...");

// "Testing consistency of piecewise-log-linear zero-yield curve...");

// if rates can be negative it makes no sense to interpolate loglinearly
if ( Utils.is_QL_NEGATIVE_RATES() )
return;
else
{
CommonVars vars = new CommonVars();

testCurveConsistency<ZeroYield, LogLinear, IterativeBootstrapForYield>( vars );
testBMACurveConsistency<ZeroYield, LogLinear, IterativeBootstrapForYield>( vars );
}
}

[TestMethod()]
Expand Down

0 comments on commit fe756bc

Please sign in to comment.