Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/Ver-1.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
amaggiulli committed Mar 23, 2016
2 parents cc29b35 + a5f8338 commit 03e7720
Show file tree
Hide file tree
Showing 555 changed files with 9,252 additions and 3,398 deletions.
1,268 changes: 1,186 additions & 82 deletions ChangeLog.txt

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions Examples/CallableBonds/CallableBonds.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
Copyright (C) 2008, 2009 , 2010, 2011, 2012 Andrea Maggiulli (a.maggiulli@gmail.com)
Copyright (C) 2008, 2009 , 2010, 2011, 2012 Andrea Maggiulli (a.maggiulli@gmail.com)
This file is part of QLNet Project http://www.qlnet.org
QLNet is free software: you can redistribute it and/or modify it
under the terms of the QLNet license. You should have received a
copy of the license along with this program; if not, license is
copy of the license along with this program; if not, license is
available online at <http://trac2.assembla.com/QLNet/wiki/License>.
QLNet is a based on QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
The QuantLib license is available online at http://quantlib.org/license.shtml.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
Expand All @@ -27,13 +27,13 @@ namespace CallableBonds
{
class CallableBonds
{

static YieldTermStructure flatRate(Date today,
double forward,
DayCounter dc,
Compounding compounding,
Frequency frequency)
Frequency frequency)

{
return new FlatForward(today, forward, dc, compounding, frequency);
//FlatForward flatRate = new FlatForward(settlementDate, r.rate(), r.dayCounter(), r.compounding(), r.frequency());
Expand Down Expand Up @@ -81,7 +81,7 @@ as documented in PFC1 as a "default" in the latter case.
int numberOfCallDates = 24;
Date callDate = new Date(15,Month.September,2006);

for (int i=0; i< numberOfCallDates; i++)
for (int i=0; i< numberOfCallDates; i++)
{
Calendar nullCalendar = new NullCalendar();

Expand Down Expand Up @@ -147,9 +147,9 @@ Therefore use ActAct(Bond)
maxIterations));
Console.WriteLine("Bloomberg price/yld (%) ");
Console.WriteLine("96.50 / 5.47");

//

sigma = .01;

Console.WriteLine("sigma/vol (%) = {0:0.00}", (100.0 * sigma));
Expand Down Expand Up @@ -216,7 +216,7 @@ Therefore use ActAct(Bond)

Console.WriteLine("Bloomberg price/yld (%) ");
Console.WriteLine("87.16 / 7.83");

//

sigma = .12;
Expand Down
83 changes: 83 additions & 0 deletions News.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
QLNet 1.6
=========================

QLNet 1.6 stable version.

The most notable changes are included below.
A detailed list of changes is available in ChangeLog.txt.

DATE/TIME

+ Added Moscow Exchange calendar .

+ Added 70th anniversary of anti-Japanese day to Chinese calendar.

+ Fixed Chinese New Year date for 2010.

+ Added nearest-trading-day business day convention.

+ Prevented normalization of a 7-days period to a 1-week period, since
this doesn't apply to business days.

+ Allowed schedules built with a vector of dates to be used for coupon
generation, given that the required information was provided.

+ Added support for Australian Security Exchange (ASX) dates.

+ Added ECB dates for April and June 2016.

INSTRUMENTS

+ Fix capfloor bug on ctor.

+ Extended digital American options to handle knock-off case.

+ Added Bachelier engine for caps/floors based on normal volatility.

+ Allowed non strike/type payoffs in finite-differences engine for
vanilla options.

+ Fixed settlement days of BTP bonds.

+ Added IPrepayModel interface, ConstantCPR class, and updated MBSFixedRateBond to use the interface rather than the PSACurve class.

PRICING ENGINE

+ Black Formula rewritten

+ Added StulzEngine and KirkEngine

INDEXES

+ Fixed day-count convention for Fed Funds rate.

TERM STRUCTURES

+ Fixed bug where a valid previous curve state could be a bad guess
for the next and lead to a bootstrap failure.

VOLATILITY

+ BlackVarianceSurface implementation

MATH

+ Fix close and close_enough comparison.

+ Better comparison between double numbers.

+ Allowed user-defined Jacobian in optimization.

MISCELLANEA

+ Added IDR, MYR, RUB and VND currencies.

CODE REFACTORING

+ Fix Handle ctor to avoid empty constructors.

+ Removed Count() with property access , removed ThreadStatic initialize

+ Replace ?: operator with ?? operator.

+ Removed all redundant using directive.
Binary file modified QLNet/Cashflow.cs
Binary file not shown.
2 changes: 0 additions & 2 deletions QLNet/Cashflows/CPICoupon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ under the terms of the QLNet license. You should have received a

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNet
{
Expand Down
3 changes: 0 additions & 3 deletions QLNet/Cashflows/CPICouponPricer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ under the terms of the QLNet license. You should have received a
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNet
{
Expand Down
3 changes: 0 additions & 3 deletions QLNet/Cashflows/CappedFlooredCoupon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ under the terms of the QLNet license. You should have received a
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNet
{
Expand Down
4 changes: 0 additions & 4 deletions QLNet/Cashflows/CappedFlooredYoYInflationCoupon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ under the terms of the QLNet license. You should have received a
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNet
{
Expand Down
4 changes: 2 additions & 2 deletions QLNet/Cashflows/CashFlows.cs
Original file line number Diff line number Diff line change
Expand Up @@ -434,15 +434,15 @@ public static CashFlow previousCashFlow(Leg leg, bool includeSettlementDateFlows
{
if (leg.empty()) return null;

Date d = (settlementDate == null ? Settings.evaluationDate() : settlementDate);
Date d = (settlementDate ?? Settings.evaluationDate());
return leg.LastOrDefault(x => x.hasOccurred(d, includeSettlementDateFlows));
}
//! the first cashflow paying after the given date
public static CashFlow nextCashFlow(Leg leg, bool includeSettlementDateFlows, Date settlementDate = null)
{
if (leg.empty()) return null;

Date d = (settlementDate == null ? Settings.evaluationDate() : settlementDate);
Date d = (settlementDate ?? Settings.evaluationDate());

// the first coupon paying after d is the one we're after
return leg.FirstOrDefault(x => !x.hasOccurred(d, includeSettlementDateFlows));
Expand Down
2 changes: 0 additions & 2 deletions QLNet/Cashflows/Cashflowvectors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ under the terms of the QLNet license. You should have received a
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNet {

Expand Down
4 changes: 1 addition & 3 deletions QLNet/Cashflows/CmsCoupon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ under the terms of the QLNet license. You should have received a
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNet {
//! CMS coupon class
Expand Down
1 change: 0 additions & 1 deletion QLNet/Cashflows/ConundrumPricer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ under the terms of the QLNet license. You should have received a
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNet {
public abstract class VanillaOptionPricer {
Expand Down
Binary file modified QLNet/Cashflows/Coupon.cs
Binary file not shown.
10 changes: 4 additions & 6 deletions QLNet/Cashflows/CouponPricer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,8 @@ protected override double optionletPrice(Option.Type optionType, double effStrik
}
return Math.Max(a - b, 0.0) * coupon_.accrualPeriod() * discount_;
} else {
// not yet determined, use Black model
if (!(!capletVolatility().empty()))
throw new ApplicationException("missing optionlet volatility");
// not yet determined, use Black model
Utils.QL_REQUIRE( !capletVolatility().empty(),()=> "missing optionlet volatility" );


double stdDev = Math.Sqrt(capletVolatility().link.blackVariance(fixingDate, effStrike));
Expand All @@ -170,9 +169,8 @@ protected virtual double adjustedFixing(double? fixing_) {
if (!coupon_.isInArrears()) {
adjustement = 0.0;
} else {
// see Hull, 4th ed., page 550
if (!(!capletVolatility().empty()))
throw new ApplicationException("missing optionlet volatility");
// see Hull, 4th ed., page 550
Utils.QL_REQUIRE( !capletVolatility().empty(),()=> "missing optionlet volatility" );

Date d1 = coupon_.fixingDate();
Date referenceDate = capletVolatility().link.referenceDate();
Expand Down
4 changes: 1 addition & 3 deletions QLNet/Cashflows/DigitalCmsCoupon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ under the terms of the QLNet license. You should have received a
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNet
{
Expand Down
3 changes: 0 additions & 3 deletions QLNet/Cashflows/DigitalCoupon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ under the terms of the QLNet license. You should have received a
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNet
{
Expand Down
4 changes: 1 addition & 3 deletions QLNet/Cashflows/DigitalIborCoupon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ under the terms of the QLNet license. You should have received a
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNet
{
Expand Down
2 changes: 0 additions & 2 deletions QLNet/Cashflows/Dividend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ under the terms of the QLNet license. You should have received a
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNet
{
Expand Down
1 change: 0 additions & 1 deletion QLNet/Cashflows/FixedRateCoupon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ under the terms of the QLNet license. You should have received a
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNet
{
Expand Down
2 changes: 1 addition & 1 deletion QLNet/Cashflows/FloatingRateCoupon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public FloatingRateCoupon(double nominal,
: base(nominal, paymentDate, startDate, endDate, refPeriodStart, refPeriodEnd)
{
index_ = index;
dayCounter_ = dayCounter == null ? new DayCounter() : dayCounter ;
dayCounter_ = dayCounter ?? new DayCounter() ;
fixingDays_ = fixingDays == default(int) ? index.fixingDays() : fixingDays;
gearing_ = gearing;
spread_ = spread;
Expand Down
2 changes: 0 additions & 2 deletions QLNet/Cashflows/Iborcoupon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ under the terms of the QLNet license. You should have received a
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNet
{
Expand Down
5 changes: 0 additions & 5 deletions QLNet/Cashflows/IndexedCashFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ under the terms of the QLNet license. You should have received a
FOR A PARTICULAR PURPOSE. See the license for more details.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNet
{
//! Cash flow dependent on an index ratio.
Expand Down
4 changes: 0 additions & 4 deletions QLNet/Cashflows/InflationCoupon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ under the terms of the QLNet license. You should have received a
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNet
{
Expand Down
4 changes: 0 additions & 4 deletions QLNet/Cashflows/InflationCouponPricer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ under the terms of the QLNet license. You should have received a
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace QLNet
{
Expand Down
Loading

0 comments on commit 03e7720

Please sign in to comment.