public class TradingPair extends Object
Modifier and Type | Field and Description |
---|---|
protected double |
beta |
protected Vector |
price1 |
protected Vector |
price2 |
protected Matrix |
returns |
protected Vector |
spread |
protected String |
symbol1 |
protected String |
symbol2 |
Constructor and Description |
---|
TradingPair(String symbol1,
String symbol2,
Vector price1,
Vector price2,
double beta)
Constructs a related pair for trading, e.g., cointegrated pair.
|
Modifier and Type | Method and Description |
---|---|
double |
beta() |
double |
cor(double tailed) |
double |
mean()
Computes the sample mean of the in-sample spread.
|
Vector |
spread()
S = A - bB
|
double |
stdev()
Gets the stdev of the spread.
|
double |
stdev(double tailed)
Gets the stdev of the last % portion in the spread.
|
String |
symbol1() |
String |
symbol2() |
String |
toString() |
protected final String symbol1
protected final String symbol2
protected final Vector price1
protected final Vector price2
protected final double beta
protected Matrix returns
protected Vector spread
public TradingPair(String symbol1, String symbol2, Vector price1, Vector price2, double beta)
symbol1
- symbol for the first assetsymbol2
- symbol for the second assetprice1
- price for the first assetprice2
- price for the second assetbeta
- the (e.g., cointegrated) beta to form a spreadpublic String symbol1()
public String symbol2()
public double beta()
public Vector spread()
public double mean()
public double stdev(double tailed)
tailed
- the last % portion in the datapublic double stdev()
public double cor(double tailed)
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.