AlgoQuant, an integrated trading strategy research and backtesting system

• java.lang.Object

• public class BasketUtils
extends Object
Provides utility methods to construct various types of baskets.
• ### Method Summary

All Methods
Modifier and Type Method and Description
static Basket<Product> newBasket(Map<? extends Product,Double> productWeights)
Constructs a basket with given weights of products, such that the value of the basket equals to the weighted sum of the mid prices of the products.
static Basket<Product> newOneLegPairBasket(Product x, Product y, double beta)
Similar to newPairBasket(com.numericalmethod.algoquant.execution.datatype.product.Product, com.numericalmethod.algoquant.execution.datatype.product.Product, double) but the sizes returned by this basket contains only the quantity of X, i.e., we trade only one leg of the pair.
static Basket<Product> newPairBasket(Product x, Product y, double beta)
Construct a basket Z consisting of two assets X and Y with ratio of 1 : β, i.e., Z = X + βY Note: the values of X and Y are computed by Depth.mid().
static Basket<Product> newSingleAssetBasket(Product product)
Constructs a basket containing only a single asset.
static double[] spread(double[] beta, double[][] ts)
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Method Detail

public static Basket<Product> newBasket(Map<? extends Product,Double> productWeights)
Constructs a basket with given weights of products, such that the value of the basket equals to the weighted sum of the mid prices of the products.
Parameters:
productWeights -
Returns:

public static Basket<Product> newSingleAssetBasket(Product product)
Constructs a basket containing only a single asset. The value of the basket equals to the value of the single asset. The ratio between sizes of the basket and the single asset is also one-to-one.
Parameters:
product - a single asset
Returns:

public static Basket<Product> newPairBasket(Product x,
Product y,
double beta)
Construct a basket Z consisting of two assets X and Y with ratio of 1 : β, i.e.,
Z = X + βY
Note: the values of X and Y are computed by Depth.mid().
Parameters:
x - an asset X
y - an asset Y
beta - the value of β
Returns:
public static double[] spread(double[] beta,
double[][] ts)
beta - weights
ts - a multivariate time series