Class RobustCointegration
- java.lang.Object
-
- tech.nmfin.meanreversion.cointegration.RobustCointegration
-
public class RobustCointegration extends Object
This class runs the robust cointegration algorithm on a pair of prices to determine if their cointegration relationship is stable enough to trade.
-
-
Field Summary
Fields Modifier and Type Field Description protected static double
REMAINING_ROWS_PCT_THRESHOLD
-
Constructor Summary
Constructors Constructor Description RobustCointegration()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCheck(PairingCheck check)
protected static double
computeCointegratingBeta(Matrix prices)
TradingPair
computeRobustPair(String symbol1, String symbol2, Vector price1, Vector price2)
protected static double
computeShortTermCointegratingBeta(Matrix prices, double tailed)
protected static Matrix
filterPrices(Matrix prices0)
Filters out invalid prices.protected static Matrix
filterUnchangedPrices(Matrix prices0)
Filters out prices that are unchanged between consecutive times.protected static Matrix
getTailedMatrix(Matrix A, double tailed)
-
-
-
Field Detail
-
REMAINING_ROWS_PCT_THRESHOLD
protected static final double REMAINING_ROWS_PCT_THRESHOLD
- See Also:
- Constant Field Values
-
-
Method Detail
-
addCheck
public void addCheck(PairingCheck check)
-
computeRobustPair
public TradingPair computeRobustPair(String symbol1, String symbol2, Vector price1, Vector price2) throws NoPairFoundException
- Throws:
NoPairFoundException
-
computeCointegratingBeta
protected static double computeCointegratingBeta(Matrix prices)
-
computeShortTermCointegratingBeta
protected static double computeShortTermCointegratingBeta(Matrix prices, double tailed)
-
filterPrices
protected static Matrix filterPrices(Matrix prices0) throws NoPairFoundException
Filters out invalid prices.- Parameters:
prices0
- the prices to be filtered- Returns:
- the filtered prices
- Throws:
NoPairFoundException
- when no pair is found
-
filterUnchangedPrices
protected static Matrix filterUnchangedPrices(Matrix prices0) throws NoPairFoundException
Filters out prices that are unchanged between consecutive times.- Parameters:
prices0
- the prices to be filtered- Returns:
- the filtered prices
- Throws:
NoPairFoundException
- when no pair is found
-
-