public class Helper
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
LEFT_TENOR_EQUALS
Tenor Comparator - Left Tenor Matches Right
|
static int |
LEFT_TENOR_GREATER
Tenor Comparator - Left Tenor Greater than Right
|
static int |
LEFT_TENOR_LESSER
Tenor Comparator - Left Tenor Lesser than Right
|
| Constructor and Description |
|---|
Helper() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
AccumulateMeasures(CaseInsensitiveTreeMap<java.lang.Double> mapOutput,
java.lang.String strPrefix,
CaseInsensitiveTreeMap<java.lang.Double> mapInput)
Append the Prefixed Map Entries of the specified Input Map onto the Output Map
|
static java.util.Set<CompositePeriod> |
AggregateComponentPeriods(Component[] aComp)
Aggregate the period lists for an array of components
|
static java.lang.String |
AggregateTenor(java.lang.String strBaseTenor,
java.lang.String strRollTenor)
Aggregate the Base and the Roll Tenors onto a Composite Tenor
|
static java.lang.String |
BaseTsyBmk(int iValueDate,
int iMaturityDate)
Return the standard on-the-run benchmark treasury string from the valuation and the maturity dates
|
static double |
BondFuturesPriceAUDBillStyle(JulianDate dtValue,
Bond bond,
double dblReferenceIndex)
Compute the Bond Futures Price AUD Bill Style from the Reference Index Level
|
static double[] |
BumpQuotes(double[] adblQuotesIn,
double dblBump,
boolean bIsProportional)
Bump the input array quotes
|
static java.lang.String |
CalcRateIndex(java.lang.String strCouponCurrency,
int iCouponFreq)
Calculate the rate index from the coupon currency and the frequency
|
static LatentStateFixingsContainer |
CreateFixingsObject(Bond bond,
JulianDate dtFixing,
double dblFixing)
Create the Latent State Fixings object from the bond, the fixings date, and the fixing.
|
static double |
DF2Yield(int iFreqIn,
double dblDF,
double dblTime)
Calculate the yield from the specified discount factor to the given time.
|
static double |
DIStylePriceFromRate(double dblDIRate,
int iStartDate,
int iEndDate,
java.lang.String strCalendar)
Compute the DI-Style Price given the Rate
|
static double |
DIStyleRateFromPrice(double dblDIPrice,
int iStartDate,
int iEndDate,
java.lang.String strCalendar)
Compute the DI-Style Rate given the Price
|
static java.lang.String |
GetDayCountFromBBGCode(java.lang.String strBBGDC)
Get the DRIP day count from the Bloomberg code
|
static java.lang.String |
GetMonthCodeFromFreq(int iFreq)
Retrieve the month code from input frequency
|
static java.lang.String |
GetTenorFromFreq(int iFreq)
Retrieve the tenor from the frequency
|
static void |
Init()
Initialize IR switcher and Bloomberg day count maps
|
static boolean |
LabelMatch(LatentStateLabel lslLeft,
LatentStateLabel lslRight)
Do the Left and the Right Labels Match?
|
static java.util.List<CompositePeriod> |
MergePeriodLists(java.util.List<CompositePeriod> lsPeriod1,
java.util.List<CompositePeriod> lsPeriod2)
Merge two lists of periods
|
static double[] |
NormalizedEqualWeightedArray(int iNumElement)
Construct a Normalized, Equally Weighted Array from the Specified Number of Elements
|
static double |
OISFromLIBORSwapFedFundBasis(double dblLIBORSwapRate,
double dblFedFundLIBORSwapBasis)
Compute the uncompounded OIS Rate from the LIBOR Swap Rate and the LIBOR Swap Rate - Fed Fund Basis.
|
static double |
OISFromLIBORSwapFedFundBasis2(double dblLIBORSwapRate,
double dblFedFundLIBORSwapBasis)
Compute the Daily Compounded OIS Rate from the LIBOR Swap Rate and the LIBOR Swap Rate - Fed Fund
Basis.
|
static java.lang.String |
ParseFromBBGDCCode(java.lang.String strBBGDCCode)
Convert the Bloomberg day count code to DRIP day count code.
|
static java.lang.String |
RateIndexFromCcyAndCouponFreq(java.lang.String strCcy,
int iCouponFreq)
Calculate the rate index from currency and coupon frequency
|
static java.lang.String |
SwitchIRCurve(java.lang.String strCurveIn)
Switch the given IR curve if necessary
|
static int |
TenorCompare(java.lang.String strTenorLeft,
java.lang.String strTenorRight)
Compare the Left and the Right Tenors
|
static int |
TenorToDays(java.lang.String strTenor)
Retrieve the Number of Days from the Tenor
|
static int |
TenorToFreq(java.lang.String strTenor)
Retrieve the Annual Frequency from the Tenor
|
static int |
TenorToMonths(java.lang.String strTenor)
Retrieve the Number of Months from the Tenor
|
static double |
TenorToYearFraction(java.lang.String strTenor)
Retrieve the Number of Days from the Tenor
|
static int |
TenorToYears(java.lang.String strTenor)
Retrieve the Number of Years from the Tenor
|
static double[] |
TweakManifestMeasure(double[] adblQuotesIn,
ManifestMeasureTweak ntp)
Tweak the Manifest Measures (gor the given set of nodes) in accordance with the specified tweak
parameters
|
static java.lang.String |
WorkoutTypeToString(int iWOType)
Turn the work out type to string
|
static double |
Yield2DF(int iFreqIn,
double dblYield,
double dblTime)
Calculate the discount factor from the specified frequency, yield, and accrual year fraction
|
public static int LEFT_TENOR_GREATER
public static int LEFT_TENOR_LESSER
public static int LEFT_TENOR_EQUALS
public static final void Init()
public static final double Yield2DF(int iFreqIn,
double dblYield,
double dblTime)
throws java.lang.Exception
iFreqIn - Input frequency - if zero, set to semi-annual.dblYield - YielddblTime - Time in DC yearsjava.lang.Exception - if input are invalid.public static final double DF2Yield(int iFreqIn,
double dblDF,
double dblTime)
throws java.lang.Exception
iFreqIn - Yield calculation frequency - defaults to semi-annual if zero.dblDF - Discount FactordblTime - Time to which the yield/DF are specifiedjava.lang.Exception - Thrown if yield cannot be computedpublic static final double OISFromLIBORSwapFedFundBasis(double dblLIBORSwapRate,
double dblFedFundLIBORSwapBasis)
throws java.lang.Exception
dblLIBORSwapRate - LIBOR Swap RatedblFedFundLIBORSwapBasis - Fed Fund - LIBOR Swap Rate Basisjava.lang.Exception - Thrown if the Inputs are invalidpublic static final double OISFromLIBORSwapFedFundBasis2(double dblLIBORSwapRate,
double dblFedFundLIBORSwapBasis)
throws java.lang.Exception
dblLIBORSwapRate - LIBOR Swap RatedblFedFundLIBORSwapBasis - Fed Fund - LIBOR Swap Rate Basisjava.lang.Exception - Thrown if the Inputs are invalidpublic static final double DIStylePriceFromRate(double dblDIRate,
int iStartDate,
int iEndDate,
java.lang.String strCalendar)
throws java.lang.Exception
dblDIRate - The DI RateiStartDate - The Start DateiEndDate - The End DatestrCalendar - The Calendarjava.lang.Exception - Thrown if the DI-Style Price cannot be calculatedpublic static final double DIStyleRateFromPrice(double dblDIPrice,
int iStartDate,
int iEndDate,
java.lang.String strCalendar)
throws java.lang.Exception
dblDIPrice - The DI PriceiStartDate - The Start DateiEndDate - The End DatestrCalendar - The Calendarjava.lang.Exception - Thrown if the DI-Style Price cannot be calculatedpublic static final java.lang.String BaseTsyBmk(int iValueDate,
int iMaturityDate)
iValueDate - the Valuation dateiMaturityDate - the Maturity datepublic static final java.lang.String WorkoutTypeToString(int iWOType)
iWOType - One of the WO_TYPE_* fields in the WorkoutInfo classpublic static final java.lang.String ParseFromBBGDCCode(java.lang.String strBBGDCCode)
strBBGDCCode - String representing the Bloomberg day count code.public static final java.lang.String GetTenorFromFreq(int iFreq)
iFreq - Integer frequencypublic static final int TenorToYears(java.lang.String strTenor)
throws java.lang.Exception
strTenor - The Specified Tenorjava.lang.Exception - Thrown if the Inputs are Invalidpublic static final int TenorToMonths(java.lang.String strTenor)
throws java.lang.Exception
strTenor - The Specified Tenorjava.lang.Exception - Thrown if the Inputs are Invalidpublic static final int TenorToDays(java.lang.String strTenor)
throws java.lang.Exception
strTenor - The Specified Tenorjava.lang.Exception - Thrown if the Inputs are Invalidpublic static final double TenorToYearFraction(java.lang.String strTenor)
throws java.lang.Exception
strTenor - The Specified Tenorjava.lang.Exception - Thrown if the Inputs are Invalidpublic static final int TenorToFreq(java.lang.String strTenor)
throws java.lang.Exception
strTenor - The Specified Tenorjava.lang.Exception - Thrown if the Inputs are Invalidpublic static final int TenorCompare(java.lang.String strTenorLeft,
java.lang.String strTenorRight)
throws java.lang.Exception
strTenorLeft - Left TenorstrTenorRight - Right Tenorjava.lang.Exception - Thrown if the Comparison cannot be donepublic static final java.lang.String GetMonthCodeFromFreq(int iFreq)
iFreq - Integer frequencypublic static final java.lang.String CalcRateIndex(java.lang.String strCouponCurrency,
int iCouponFreq)
strCouponCurrency - String representing the coupon currencyiCouponFreq - Integer representing the coupon frequencypublic static final java.lang.String GetDayCountFromBBGCode(java.lang.String strBBGDC)
strBBGDC - String representing the Bloomberg day count conventionpublic static final java.lang.String RateIndexFromCcyAndCouponFreq(java.lang.String strCcy,
int iCouponFreq)
strCcy - String representing coupon currencyiCouponFreq - Integer representing coupon frequencypublic static final java.lang.String SwitchIRCurve(java.lang.String strCurveIn)
strCurveIn - String representing the input curvepublic static final LatentStateFixingsContainer CreateFixingsObject(Bond bond, JulianDate dtFixing, double dblFixing)
bond - The input bonddtFixing - The Fixings DatedblFixing - Double representing the fixingpublic static final double[] BumpQuotes(double[] adblQuotesIn,
double dblBump,
boolean bIsProportional)
adblQuotesIn - Array of the input double quotesdblBump - Bump amountbIsProportional - True - Bump is proportionalpublic static final double[] TweakManifestMeasure(double[] adblQuotesIn,
ManifestMeasureTweak ntp)
adblQuotesIn - Array of quotes to be bumpedntp - NodeTweakParams inputpublic static final java.util.List<CompositePeriod> MergePeriodLists(java.util.List<CompositePeriod> lsPeriod1, java.util.List<CompositePeriod> lsPeriod2)
lsPeriod1 - Period 1lsPeriod2 - Period 2public static final java.util.Set<CompositePeriod> AggregateComponentPeriods(Component[] aComp)
aComp - Array of Componentspublic static final boolean AccumulateMeasures(CaseInsensitiveTreeMap<java.lang.Double> mapOutput, java.lang.String strPrefix, CaseInsensitiveTreeMap<java.lang.Double> mapInput)
mapOutput - The Output MapstrPrefix - The Entry PrefixmapInput - The Input Mappublic static final boolean LabelMatch(LatentStateLabel lslLeft, LatentStateLabel lslRight)
lslLeft - Left Cash Flow Period LabellslRight - Right Cash Flow Period Labelpublic static final double BondFuturesPriceAUDBillStyle(JulianDate dtValue, Bond bond, double dblReferenceIndex) throws java.lang.Exception
dtValue - The Valuation Datebond - The Bond InstancedblReferenceIndex - The Reference Indexjava.lang.Exception - Thrown if the Bond Futures Price AUD Bill Style cannot be computedpublic static final double[] NormalizedEqualWeightedArray(int iNumElement)
iNumElement - Number of Elementspublic static final java.lang.String AggregateTenor(java.lang.String strBaseTenor,
java.lang.String strRollTenor)
strBaseTenor - The Base TenorstrRollTenor - The Roll Tenor