Usage:
=qlSwapLegAnalysis(<SwapID>, <LegNumber>,
<AfterDate>)
ID of the swap object to inspect
The sequential number of the leg to inspect (starts from 0, so specify 0 for first leg, 1 for second leg, etc)
Only return the cashflows after this date
Here is example usage in QLW – QuantLib-Addin like interface from Java and Python
// Copyright (C) 2012 Bojan Nikolic <bojan@bnikolic.co.uk>
//
import co.uk.bnikolic.qlw.property_t;
import co.uk.bnikolic.qlw.qlw;
import co.uk.bnikolic.qlw.StringVector;
import co.uk.bnikolic.qlw.LongVector;
import co.uk.bnikolic.qlw.PropertyVector;
import co.uk.bnikolic.qlw.PropertyMatrix;
import co.uk.bnikolic.qlw.DoubleVector;
public class qlSwapLegAnalysis {
public static void main(String[] args) throws Exception {
String swap=mkSwap();
PropertyMatrix res=qlw.qlSwapLegAnalysis(swap, 0, qlw.OH_NULL(), qlw.OH_NULL());
for(int i=0; i<res.size(); ++i)
{
if (i==0)
{
System.out.print("Header \t");
}
else
{
System.out.print("Flow #" + i +"\t");
}
for(int j=0; j<res.get(i).size(); ++j)
{
System.out.print(" " + qlw.OH_GetString((res.get(i)).get(j))+ "\t\t\t");
}
System.out.print("\n");
}
}
// See
// http://www.bnikolic.co.uk/ql/addindoc/f/qlMakeVanillaSwap.html
// for explanation of this function
public static String mkSwap() {
PropertyVector datesList= new PropertyVector();
datesList.add(new property_t("0D"));
datesList.add(new property_t("1Y"));
DoubleVector ratesList=new DoubleVector();
ratesList.add(0.01);
ratesList.add(0.01);
property_t dcc=new property_t("Actual/365 (Fixed)");
String curve=qlw.qlInterpolatedYieldCurve("curve",
datesList,
ratesList,
"TARGET", dcc,
new PropertyVector(),
new PropertyVector(),
new property_t("ZeroYield"),
new property_t("LogLinear"),
qlw.OH_NULL(),
qlw.OH_NULL(),
false);
String engine=qlw.qlDiscountingSwapEngine("engine", curve,
qlw.OH_NULL(),
qlw.OH_NULL(),
qlw.OH_NULL(),
qlw.OH_NULL(),
qlw.OH_NULL(),
false);
String index=qlw.qlEuribor("index","6M",
qlw.OH_NULL(),
qlw.OH_NULL(),
qlw.OH_NULL(),
false);
String swap=qlw.qlMakeVanillaSwap("swap",
"5Y",
index,
new property_t(0.01),
"0D",
new property_t("Actual/360"),
new property_t(0.0),
engine,
qlw.OH_NULL(),
qlw.OH_NULL(),
false);
return swap;
}
}
The output of this program is:
Header Payment Date Amount Nominal Accrual Start Date Accrual End Date Accrual Days Index Fixing Days Fixing Dates Day Counter Accrual Period Effective Rate Floor Gearing Index Fixing Conv. Adj. Spread Cap Call Digital Payoff Put Digital Payoff
Flow #1 41417 0.0101389 1 41052 41417 365 #N/A #N/A #N/A Actual/360 1.01389 0.01 #N/A #N/A #N/A #N/A #N/A #N/A #N/A #N/A
Flow #2 41782 0.0101389 1 41417 41782 365 #N/A #N/A #N/A Actual/360 1.01389 0.01 #N/A #N/A #N/A #N/A #N/A #N/A #N/A #N/A
Flow #3 42149 0.0101944 1 41782 42149 367 #N/A #N/A #N/A Actual/360 1.01944 0.01 #N/A #N/A #N/A #N/A #N/A #N/A #N/A #N/A
Flow #4 42513 0.0101111 1 42149 42513 364 #N/A #N/A #N/A Actual/360 1.01111 0.01 #N/A #N/A #N/A #N/A #N/A #N/A #N/A #N/A
Flow #5 42878 0.0101389 1 42513 42878 365 #N/A #N/A #N/A Actual/360 1.01389 0.01 #N/A #N/A #N/A #N/A #N/A #N/A #N/A #N/A