Class InformationRatioRTIndicator
java.lang.Object
com.wualabs.qtsurfer.engine.indicators.core.AbstractRTIndicator
com.wualabs.qtsurfer.engine.indicators.core.AbstractWindowSeriesRTIndicator
com.wualabs.qtsurfer.engine.indicators.statistics.pro.ratios.InformationRatioRTIndicator
- All Implemented Interfaces:
Resettable, RTIndicator
Rolling Information Ratio with O(1) per-tick updates.
Measures the risk-adjusted active return of an asset relative to a benchmark:
IR = mean(activeReturn) / stddev(activeReturn)where
activeReturn = ln(asset/prevAsset) - ln(benchmark/prevBenchmark).
The Information Ratio quantifies how consistently an asset outperforms its benchmark. Higher IR means more consistent outperformance.
Maintains a single window storing active returns with
dual accumulators (sumAR, sumARSq). The first tick pair
establishes the initial prices.
Returns 0 when tracking error (stddev of active returns) is zero or window has fewer than 2 returns.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the current mean active return over the window.doubleReturns the current tracking error (stddev of active returns).protected voidonEvict(double evicted) Called when the window evicts the oldest value.protected voidonReset()Called after window is cleared.doubleupdate(double newValue) Not supported — Information Ratio requires two inputs.doubleupdate(double asset, double benchmark) Updates the indicator with a new (asset, benchmark) price pair and returns the current Information Ratio.withAnnualizationFactor(double factor) Sets the annualization factor.Methods inherited from class AbstractWindowSeriesRTIndicator
getPeriods, isReady, reset, window, windowSizeMethods inherited from class AbstractRTIndicator
equals, getDisplayHint, getMeta, getValue, hashCode, hide, isPoison, setValue, toString, toString, withDisplayHint, withMeta
-
Constructor Details
-
InformationRatioRTIndicator
public InformationRatioRTIndicator(int periods)
-
-
Method Details
-
onEvict
protected void onEvict(double evicted) Description copied from class:AbstractWindowSeriesRTIndicatorCalled when the window evicts the oldest value. Override to update accumulators.- Overrides:
onEvictin classAbstractWindowSeriesRTIndicator
-
onReset
protected void onReset()Description copied from class:AbstractWindowSeriesRTIndicatorCalled after window is cleared. Override to zero accumulators.- Overrides:
onResetin classAbstractWindowSeriesRTIndicator
-
withAnnualizationFactor
Sets the annualization factor. The output is multiplied by this factor. -
getMeanActiveReturn
public double getMeanActiveReturn()Returns the current mean active return over the window. -
getTrackingError
public double getTrackingError()Returns the current tracking error (stddev of active returns). -
update
public double update(double newValue) Not supported — Information Ratio requires two inputs. Useupdate(double, double).- Specified by:
updatein interfaceRTIndicator- Overrides:
updatein classAbstractRTIndicator- Throws:
UnsupportedOperationException- always
-
update
public double update(double asset, double benchmark) Updates the indicator with a new (asset, benchmark) price pair and returns the current Information Ratio.
-