org.ojalgo.finance
Class FinanceUtils

java.lang.Object
  extended by org.ojalgo.finance.FinanceUtils

public abstract class FinanceUtils
extends Object


Method Summary
static double calculateValueAtRisk(double aReturn, double aStdDev, double aConfidence, double aTime)
           
static
<V extends Number>
GeometricBrownianMotion
estimateExcessDiffusionProcess(CalendarDateSeries<V> aPriceSeries, CalendarDateSeries<V> aRiskFreeInterestRateSeries, CalendarDateUnit aTimeUnit)
           
static CalendarDateSeries<RandomNumber> forecast(CalendarDateSeries<? extends Number> aSeries, int aPointCount, CalendarDateUnit aTimeUnit, boolean includeOriginalSeries)
           
static CalendarDateSeries<BigDecimal> makeCalendarPriceSeries(double[] somePrices, Calendar aStartCalendar, CalendarDateUnit aResolution)
           
static
<V extends Number>
BasicMatrix
makeCovarianceMatrix(Collection<CalendarDateSeries<V>> aTimeSeriesCollection)
           
static CalendarDateSeries<BigDecimal> makeDatePriceSeries(double[] somePrices, Date aStartDate, CalendarDateUnit aResolution)
           
static
<K extends Comparable<K>,V extends Number>
SampleSet
makeExcessSampleSet(CalendarDateSeries<V> aPriceSeries, CalendarDateSeries<V> aRiskFreeInterestRateSeries)
           
static double toGrowthFactorFromInterestRate(double anInterestRate, CalendarDateUnit aGrowthFactorUnit)
          GrowthFactor = exp(GrowthRate)
static double toGrowthRateFromInterestRate(double anInterestRate, CalendarDateUnit aGrowthRateUnit)
          GrowthRate = ln(1.0 + InterestRate) / GrowthRateUnitsPerYear
static double toInterestRateFromGrowthFactor(double aGrowthFactor, CalendarDateUnit aGrowthFactorUnit)
          GrowthRate = ln(GrowthFactor)
static double toInterestRateFromGrowthRate(double aGrowthRate, CalendarDateUnit aGrowthRateUnit)
          InterestRate = exp(GroiwthRate * GrowthRateUnitsPerYear) + 1.0
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

calculateValueAtRisk

public static double calculateValueAtRisk(double aReturn,
                                          double aStdDev,
                                          double aConfidence,
                                          double aTime)

estimateExcessDiffusionProcess

public static <V extends Number> GeometricBrownianMotion estimateExcessDiffusionProcess(CalendarDateSeries<V> aPriceSeries,
                                                                                        CalendarDateSeries<V> aRiskFreeInterestRateSeries,
                                                                                        CalendarDateUnit aTimeUnit)

forecast

public static CalendarDateSeries<RandomNumber> forecast(CalendarDateSeries<? extends Number> aSeries,
                                                        int aPointCount,
                                                        CalendarDateUnit aTimeUnit,
                                                        boolean includeOriginalSeries)

makeCalendarPriceSeries

public static CalendarDateSeries<BigDecimal> makeCalendarPriceSeries(double[] somePrices,
                                                                     Calendar aStartCalendar,
                                                                     CalendarDateUnit aResolution)

makeCovarianceMatrix

public static <V extends Number> BasicMatrix makeCovarianceMatrix(Collection<CalendarDateSeries<V>> aTimeSeriesCollection)
Parameters:
aTimeSeriesCollection -
Returns:
Annualised covariances

makeDatePriceSeries

public static CalendarDateSeries<BigDecimal> makeDatePriceSeries(double[] somePrices,
                                                                 Date aStartDate,
                                                                 CalendarDateUnit aResolution)

makeExcessSampleSet

public static <K extends Comparable<K>,V extends Number> SampleSet makeExcessSampleSet(CalendarDateSeries<V> aPriceSeries,
                                                                                       CalendarDateSeries<V> aRiskFreeInterestRateSeries)
Type Parameters:
K - Time series key type
V - Time series value type
Parameters:
aPriceSeries - A series of prices
aRiskFreeInterestRateSeries - A series of interest rates (risk free return expressed in %)
Returns:
A sample set of price growth factors adjusted for risk free return

toGrowthFactorFromInterestRate

public static double toGrowthFactorFromInterestRate(double anInterestRate,
                                                    CalendarDateUnit aGrowthFactorUnit)
GrowthFactor = exp(GrowthRate)

Parameters:
anInterestRate - Annualised interest rate (percentage per year)
aGrowthFactorUnit - A growth factor unit
Returns:
A growth factor per unit (day, week, month, year...)

toGrowthRateFromInterestRate

public static double toGrowthRateFromInterestRate(double anInterestRate,
                                                  CalendarDateUnit aGrowthRateUnit)
GrowthRate = ln(1.0 + InterestRate) / GrowthRateUnitsPerYear

Parameters:
anInterestRate - Annualised interest rate (percentage per year)
aGrowthRateUnit - A growth rate unit
Returns:
A growth rate per unit (day, week, month, year...)

toInterestRateFromGrowthFactor

public static double toInterestRateFromGrowthFactor(double aGrowthFactor,
                                                    CalendarDateUnit aGrowthFactorUnit)
GrowthRate = ln(GrowthFactor)

Parameters:
aGrowthFactor - A growth factor per unit (day, week, month, year...)
aGrowthFactorUnit - A growth factor unit
Returns:
Annualised interest rate (percentage per year)

toInterestRateFromGrowthRate

public static double toInterestRateFromGrowthRate(double aGrowthRate,
                                                  CalendarDateUnit aGrowthRateUnit)
InterestRate = exp(GroiwthRate * GrowthRateUnitsPerYear) + 1.0

Parameters:
aGrowthRate - A growth rate per unit (day, week, month, year...)
aGrowthRateUnit - A growth rate unit
Returns:
Annualised interest rate (percentage per year)