STRATEGIES 163
cross-correlation and autocorrelation. Anticor adopts logarithmic price relatives in
two specific market windows, that is, y
1
= log(x
tw
t2w+1
) and y
2
= log(x
t
tw+1
).It
then calculates the cross-correlation matrix between y
1
and y
2
:
M
cov
(i, j ) =
1
w 1
(y
1,i
−¯y
1
)
(y
2,j
−¯y
2
),
M
cor
(
i, j
)
=
M
cov
(i,j)
σ
1
(i)σ
2
(j)
σ
1
(i), σ
2
(j) = 0
0 otherwise
.
Then, following the cross-correlation matrix,Anticor moves the proportions from the
stocks increasedmoreto the stocks increased less,inwhichthe corresponding amounts
are adjusted according to the cross-correlation matrix. In particular, if asset i increases
more than asset j and their sequences in the window are positively correlated,Anticor
claims a transfer from asset i to j with the amount equaling the crosscorrelation
value (M
cor
(i, j )) minus their negative autocorrelation values (min{0,M
cor
(i, i)}
and min{0,M
cor
(j, j )}). These transfer claims are finally normalized to keep the
portfolio in the simplex domain.
Usage We implemented two Anticor algorithms, BAH
W
(Anticor) and BAH
W
(Anticor(Anticor)). Their usages are listed below.
anticor(fid, data, {W, λ}, opts);
anticor_anticor(fid, data, {W, λ}, opts);
fid: file handle for writing log file;
data: market sequence matrix;
W: maximal window size;
λ: transaction cost rates; and
opts: options for behavioral control.
Example Call both Anticor algorithms on the “NYSE (O)” dataset with a maximal
window size of 30 and a transaction cost rate of 0.
1: >> manager(’anticor’, ’nyse-o’, {30, 0}, opts);
2: >> manager(’anticor_anticor’, ’nyse-o’, {30, 0}, opts);
A.3.3.2 Passive–Aggressive Mean Reversion
Description Rather than tracking the best stock, “passive–aggressive mean rever-
sion” (PAMR) (Li et al. 2012) explicitly tracks the worst stocks, while adopting
T&F Cat #K23731 — K23731_A001 — page 163 — 9/28/2015 — 20:46
164 OLPS: A TOOLBOX FOR ONLINE PORTFOLIO SELECTION
regularization techniques to constrain the deviation from the last portfolio. In
particular, PAMR’s formulation is
b
t+1
= arg min
b
m
1
2
b b
t
2
s.t.
(
b;x
t
)
= 0,
where
(b;x
t
) denotes a predefined loss function to capture the mean reversion
property,
(b;x
t
) =
0 b ·x
t
b ·x
t
otherwise
.
Solving the optimization, we can obtain PAMR’s portfolio update:
b
t+1
= b
t
τ
t
(x
t
−¯x
t
1), τ
t
= max
"
0,
b
t
·x
t
x
t
−¯x
t
1
2
#
.
Usage We implemented three PAMR algorithms (i.e., PAMR, PAMR-I, and
PAMR-II). Their usages are listed below.
pamr(fid, data, {, λ}, opts);
pamr_1(fid, data, {,C,λ}, opts);
pamr_2(fid, data, {,C,λ}, opts);
fid: file handle for writing log file;
data: market sequence matrix;
: mean reversion threshold;
C: aggressive parameter;
λ: transaction cost rates; and
opts: options for behavioral control.
Example Call the three PAMR algorithms on the “NYSE (O)” dataset with a mean
reversion threshold of 0.5, an aggressive parameter of 30, and a transaction cost rate
of 0.
1: >> manager(’pamr’, ’nyse-o’, {0.5, 0}, opts);
2: >> manager(’pamr_1’, ’nyse-o’, {0.5, 500, 0}, opts);
3: >> manager(’pamr_2’, ’nyse-o’, {0.5, 500, 0}, opts);
A.3.3.3 Confidence-Weighted Mean Reversion
Description “Confidence-weighted mean reversion” (CWMR) (Li et al. 2013)
models the portfolio vector on a Gaussian distribution and explicitly updates the
T&F Cat #K23731 — K23731_A001 — page 164 — 9/28/2015 — 20:46
STRATEGIES 165
distribution following the mean reversion principle. In particular, CWMR’s
formulation is
(μ
t+1
,
t+1
) = arg min
μ
m
,
D
KL
(N(μ, )N(μ
t
,
t
))
s.t. Pr[μ ·x
t
]≥θ.
Expanding the constraint, the resulting optimization problem is not convex. The
authors provided two methods to solve the optimization (i.e., CWMR-Var and
CWMR-Stdev). CWMR-Var involves linearizing the constraint and solving the
resulting optimization, and one can obtain the closed form update scheme as
μ
t+1
= μ
t
λ
t+1
t
(x
t
−¯x
t
1),
1
t+1
=
1
t
+2λ
t+1
φx
t
x
t
,
where λ
t+1
corresponds to the Lagrangian multiplier calculated by Eq. (11) in Li
et al. (2013), and ¯x
t
=
1
t
x
t
1
t
1
denotes the confidence-weighted price relative average.
CWMR-Stdev involves the decomposition of the covariance matrix and can also
release similar portfolio update formulas.
Usage We implemented two CWMR algorithms (i.e., CWMR-Var and CWMR-
Stdev). Their usages are listed below.
cwmr_var(fid, data, {φ, , λ}, opts);
cwmr_stdev(fid, data, {φ, , λ}, opts);
fid: file handle for writing log file;
data: market sequence matrix;
φ: confidence parameter;
: mean reversion threshold;
λ: transaction cost rates; and
opts: options for behavioral control.
Example Call the two CWMR algorithms on the “NYSE (O)” dataset with a
confidence parameter of 2, a mean reversion parameter of 0.5, and a transaction cost
rate of 0.
1: >> manager(’cwmr_var’, ’nyse-o’, {2, 0.5, 0}, opts);
2: >> manager(’cwmr_stdev’, ’nyse-o’, {2, 0.5, 0}, opts);
A.3.3.4 Online Moving Average Reversion
Description “Online moving average reversion” (OLMAR) (Li and Hoi 2012)
explicitly predicts next price relatives following the mean reversion idea (i.e., MAR-1
borrows the simple moving average):
˜
x
t+1
(w) =
1
w
1 +
1
x
t
+···+
1
w2
i=0
x
ti
,
T&F Cat #K23731 — K23731_A001 — page 165 — 9/28/2015 — 20:46
166 OLPS: A TOOLBOX FOR ONLINE PORTFOLIO SELECTION
where w is the window size and
denotes the element-wise product; and MAR-2
borrows the exponential moving average:
˜
x
t+1
(α) = α1 +(1 α)
˜
x
t
x
t
,
where α (0, 1) denotes the decaying factor and the operations are all element-wise.
Then, OLMAR’s formulation is
b
t+1
= arg min
b
m
1
2
b b
t
2
s.t. b ·
˜
x
t+1
.
Solving the optimization, we can obtain its portfolio update:
b
t+1
= b
t
+λ
t+1
(
˜
x
t+1
−¯x
t+1
1),
where ¯x
t+1
=
1
m
(1 ·
˜
x
t+1
) denotes the average predicted price relative and λ
t+1
is the Lagrangian multiplier calculated as
λ
t+1
= max
"
0,
b
t
·
˜
x
t+1
˜
x
t+1
−¯x
t+1
1
2
#
.
Usage We implemented two OLMAR algorithms (i.e., OLMAR-I and OLMAR-II).
Their usages are listed below.
olmar1(fid, data, {,W,λ}, opts);
olmar2(fid, data, {, α, λ}, opts);
fid: file handle for writing log file;
data: market sequence matrix;
: mean reversion threshold;
W: window size for simple moving average;
α ∈[0, 1]: decaying factor to calculate exponential moving average;
λ ∈[0, 1): transaction cost rates; and
opts: options for behavioral control.
Example Call the two OLMAR algorithms on the “NYSE (O)” dataset with a mean
reversion threshold of 10, a window size of 5, a decaying factor of 0.5, and a trans-
action cost rate of 0.
1: >> manager(’olmar1’, ’nyse-o’, {10, 5, 0}, opts);
2: >> manager(’olmar2’, ’nyse-o’, {10, 0.5, 0}, opts);
T&F Cat #K23731 — K23731_A001 — page 166 — 9/28/2015 — 20:46
STRATEGIES 167
A.3.4 Pattern Matching–Based Approaches
The pattern matching–based approaches are based on the assumption that market
sequences with similar preceding market appearances tend to reappear. Thus, the
common behavior of these approaches is to first identify similar market sequences that
are deemed similar to the coming sequence, and then obtain a portfolio that maximizes
the expected return based on these similar sequences.AlgorithmA.3 illustrates the first
step, or the sample selection procedure. The second step, or the portfolio optimization
procedure, often follows the following optimization:
b
t+1
= arg max
b
m
iC(x
t
1
)
b ·x
i
. (A.2)
A.3.4.1 Nonparametric Kernel-Based Log-Optimal Strategy
Description “Nonparametric kernel-based sample selection” (B
K
) (Györfi et al.
2006) identifies the similarity set by comparing two market windows via Euclidean
distance:
C
K
(x
t
1
,w) =
w<i<t+1 :x
t
tw+1
x
i1
iw
≤
c
,
Algorithm A.3: Sample selection framework (C(x
t
1
,w)).
Input: x
t
1
: Historical market sequence; w: window size;
Output: C: Index set of similar price relatives.
Initialize C =∅;
if t w +1 then
return;
end
for i = w +1,w+2,...,t do
if x
i1
iw
is similar to x
t
tw+1
then
C = C ∪{i};
end
end
where c and are the thresholds used to control the number of similar samples. Then,
it obtains an optimal portfolio via solving Equation A.2.
Usage
bk_run(fid, data, {K, L, c, λ}, opts);
fid: file handle for writing log file;
data: market sequence matrix;
K: maximal window size;
L: used to split the parameter space of each k;
T&F Cat #K23731 — K23731_A001 — page 167 — 9/28/2015 — 20:46
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.184.214