public class AnalyticsHelper
extends java.lang.Object
Constructor and Description |
---|
AnalyticsHelper() |
Modifier and Type | Method and Description |
---|---|
static java.util.Set<CouponPeriod> |
AggregateComponentPeriods(Component[] aComp)
Aggregate the period lists for an array of components
|
static java.lang.String |
BaseTsyBmk(double dblValue,
double dblMaturity)
Return the standard on-the-run benchmark treasury string from the valuation and the maturity dates
|
static double[] |
BumpNTPNode(double[] adblQuotesIn,
NodeTweakParams ntp)
Bump the node (or the given set of nodes) in accordance with the specified tweak parameters
|
static double[] |
BumpQuotes(double[] adblQuotesIn,
double dblBump,
boolean bIsProportional)
Bumps the input array quotes
|
static java.lang.String |
CalcRateIndex(java.lang.String strCouponCurrency,
int iCouponFreq)
Calculates the rate index from the coupon currency and the frequency
|
static java.util.Map<JulianDate,CaseInsensitiveTreeMap<java.lang.Double>> |
CreateFixingsObject(Bond bond,
JulianDate dtValue,
double dblFix)
Creates the fixings object from the bond, the valuation date, and the fixing.
|
static double |
DF2Yield(int iFreqIn,
double dblDF,
double dblTime)
Calculates the yield from the specified discount factor to the given time.
|
static java.util.List<LossPeriodCurveFactors> |
GenerateLossPeriods(CreditComponent comp,
ValuationParams valParams,
PricerParams pricerParams,
Period period,
double dblWorkoutDate,
ComponentMarketParams mktParams)
Creates a set of loss period measures
|
static java.lang.String |
GetDayCountFromBBGCode(java.lang.String strBBGDC)
Gets the DRIP day count from the Bloomberg code
|
static java.lang.String |
GetMonthCodeFromFreq(int iFreq)
Retrieves the month code from input frequency
|
static java.lang.String |
GetTenorFromFreq(int iFreq)
Retrieves the tenor from the frequency
|
static void |
Init()
Initializes IR switcher and Bloomberg day count maps
|
static JulianDate |
MakeJulianDateFromBBGDate(java.lang.String strBBGDate)
Creates a JulianDate from Bloomberg date string
|
static JulianDate |
MakeJulianFromDDMMMYY(java.lang.String strDDMMMYY,
java.lang.String strDelim)
Create a JulianDate from the DD MMM YY
|
static JulianDate |
MakeJulianFromRSEntry(java.util.Date dt)
Create a JulianDate from the java Date
|
static JulianDate |
MakeJulianFromYYYYMMDD(java.lang.String strYYYYMMDD,
java.lang.String strDelim)
Create a JulianDate from the YYYY MM DD
|
static java.util.List<CouponPeriod> |
MergePeriodLists(java.util.List<CouponPeriod> lsPeriod1,
java.util.List<CouponPeriod> lsPeriod2)
Merge two lists of periods
|
static java.lang.String |
ParseFromBBGDCCode(java.lang.String strBBGDCCode)
Converts the Bloomberg day count code to DRIP day count code.
|
static java.lang.String |
RateIndexFromCcyAndCouponFreq(java.lang.String strCcy,
int iCouponFreq)
Calculates the rate index from currency and coupon frequency
|
static java.lang.String |
SwitchIRCurve(java.lang.String strCurveIn)
Switches the given IR curve if necessary
|
static java.lang.String |
WorkoutTypeToString(int iWOType)
Turns the work out type to string
|
static double |
Yield2DF(int iFreqIn,
double dblYield,
double dblTime)
Calculates the discount factor from the specified frequency, yield, and accrual year fraction
|
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 java.lang.String BaseTsyBmk(double dblValue, double dblMaturity)
dblValue
- the valuation datedblMaturity
- 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 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 JulianDate MakeJulianFromRSEntry(java.util.Date dt)
dt
- Java Date inputpublic static final JulianDate MakeJulianFromDDMMMYY(java.lang.String strDDMMMYY, java.lang.String strDelim)
strDDMMMYY
- Java Date input as delimited DD MMM YYstrDelim
- Delimiterpublic static final JulianDate MakeJulianFromYYYYMMDD(java.lang.String strYYYYMMDD, java.lang.String strDelim)
strYYYYMMDD
- Java Date input as delimited YYYY MM DDstrDelim
- Delimiterpublic 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 JulianDate MakeJulianDateFromBBGDate(java.lang.String strBBGDate)
strBBGDate
- Bloomberg date stringpublic static final java.lang.String SwitchIRCurve(java.lang.String strCurveIn)
strCurveIn
- String representing the input curvepublic static final java.util.Map<JulianDate,CaseInsensitiveTreeMap<java.lang.Double>> CreateFixingsObject(Bond bond, JulianDate dtValue, double dblFix)
bond
- The input bonddtValue
- The valuation JulianDatedblFix
- Double representing the fixingpublic static final java.util.List<LossPeriodCurveFactors> GenerateLossPeriods(CreditComponent comp, ValuationParams valParams, PricerParams pricerParams, Period period, double dblWorkoutDate, ComponentMarketParams mktParams)
comp
- Component for which the measures are to be generatedvalParams
- ValuationParams from which the periods are generatedpricerParams
- PricerParams that control the generation characteristicsperiod
- The enveloping coupon perioddblWorkoutDate
- Double JulianDate representing the absolute end of all the generated periodsmktParams
- ComponentMarketParams that contain the discount and the credit curvespublic 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[] BumpNTPNode(double[] adblQuotesIn, NodeTweakParams ntp)
adblQuotesIn
- Array of quotes to be bumpedntp
- NodeTweakParams inputpublic static final java.util.List<CouponPeriod> MergePeriodLists(java.util.List<CouponPeriod> lsPeriod1, java.util.List<CouponPeriod> lsPeriod2)
lsPeriod1
- Period 1lsPeriod2
- Period 2public static final java.util.Set<CouponPeriod> AggregateComponentPeriods(Component[] aComp)
aComp
- Array of Components