Appendix A
OLPS: A Toolbox for Online Portfolio
Selection
This appendix presents an open-source software toolbox for online portfolio
selection (OLPS), which implements a collection of classical and state-of-the-art
OLPS strategies powered by state-of-the-art machine learning techniques.
OLPS aims to sequentially allocate capital among a set of assets to maximize
long-term return. In recent years, a variety of machine learning algorithms have been
proposed to address this challenging problem, but there is no comprehensive open-
source toolbox available due to various reasons. This may have significantly hindered
the progresses of research and development of new techniques in this field.
OLPS was designed and developed to facilitate the investigation and development
of new methods and enable performance benchmarking and comparisons of different
existing strategies. OLPS is an open-source project implemented in MATLAB
and
is compatible with Octave. The software toolbox has been released under Apache
License (version 2.0), and it is freely available at: https://github.com/OLPS/
A.1 Introduction
A.1.1 Target Task
In this section, we briefly formulate the OLPS model, which will be used in our model.
Suppose we have a finite number of m 2 investment assets, over which an investor
can invest for a finite number of n 1 periods.
At the t-th period, t = 1,...,n, the asset (close) prices are represented by a
vector p
t
R
m
+
, and each element p
t,i
,i = 1,...,m represents the close price of
asset i. Their price changes are represented by a price relative vector x
t
R
m
+
, each
component of which denotes the ratio of the t-th close price to the last close price,
that is, x
t,i
=
p
t,i
p
t1,i
. Thus, an investment in asset i throughout period t changes by a
factor of x
t,i
. Let us denote by x
n
1
={x
1
,...,x
n
}a sequence of price relative vectors
for n periods, and x
e
s
={x
s
,...,x
e
}, 1 s<e n as a market window.
143
T&F Cat #K23731 — K23731_A001 — page 143 — 9/28/2015 — 20:46
144 OLPS: A TOOLBOX FOR ONLINE PORTFOLIO SELECTION
An investment in the market for the t-th period is specified by a portfolio vector
b
t
= (b
t,1
,...,b
t,m
), where b
t,i
,i = 1,...,m, represents the proportion of wealth
invested in asset i at the beginning of the t-th period. Typically, a portfolio is
self-financed and no margin/short sale is allowed; therefore, each entry of a port-
folio is nonnegative and adds up to one, that is, b
t
m
, where
m
={b
t
: b
t
0,
m
i=1
b
t,i
= 1}.
The investment procedure is represented by a portfolio strategy,
that is, b
1
=
1
m
,...,
1
m
and the following sequence of mappings:
b
t
: R
m(t1)
+
m
,t = 2, 3,...,
where b
t
= b
t
(x
t1
1
) is the portfolio determined at the beginning of the t-th period
upon observing past market behaviors. We denote by b
n
1
={b
1
,...,b
n
} the strategy
for n periods, which is the output of an OLPS strategy.
At the t-th period, a portfolio b
t
produces a portfolio period return s
t
, that is,
the wealth changes by a factor of s
t
= b
t
x
t
=
m
i=1
b
t,i
x
t,i
. Since we reinvest and
adopt relative prices, the wealth would change multiplicatively. Thus, after n periods,
a portfolio strategy b
n
1
will produce a portfolio cumulative wealth of S
n
, which changes
the initial wealth by a factor of
n
t=1
b
t
x
t
:
S
n
(b
n
1
, x
n
1
) = S
0
n
t=1
b
t
x
t
,
where S
0
denotes the initial wealth and is set to $1 for convenience.
Algorithm A.1: Online portfolio selection.
Input: x
n
1
: Historical market price relative sequence
Output: S
n
: Final cumulative wealth
Initialize S
0
= 1, b
1
=
1
m
,...,
1
m
;
for t = 1, 2,...,ndo
Portfolio manager learns a portfolio b
t
;
Market reveals a price relative vector x
t
;
Portfolio incurs period return s
t
= b
t
x
t
and updates cumulative return
S
t
= S
t1
×(b
t
x
t
);
Portfolio manager updates his/her decision rules;
end
We present the framework of the above task in Algorithm A.1. In this task,
a portfolio manager’s goal is to produce a portfolio strategy (b
n
1
) upon the market
price relatives (x
n
1
), aiming to achieve certain targets. He or she computes the portfo-
lios in a sequential manner. At each period t, the manager has access to the sequence
of past price relative vectors x
t1
1
. He or she then computes a new portfolio b
t
for next
price relative vector x
t
, where the decision criterion varies among different managers.
0 denotes that each element of the vector is nonnegative.
T&F Cat #K23731 — K23731_A001 — page 144 — 9/28/2015 — 20:46
INTRODUCTION 145
Then the manager will rebalance to the new portfolio via buying and selling the
underlying stocks. At the end of a trading period, the market will reveal x
t
. The
resulting portfolio b
t
is scored based on portfolio period return s
t
. This procedure
is repeated until the end, and the portfolio strategy is finally scored by the portfolio
cumulative wealth S
n
.
Note that we have made several general and common nontrivial assumptions in
the above model:
1. Transaction cost: no explicit or implicit transaction costs
exist.
2. Market liquidity: one can buy and sell the required amount, even fractional, at the
last close price of any given trading period.
3. Market impact: any portfolio selection strategy shall not influence the market or
any other stocks’ prices.
All the implemented strategies follow the same architecture in AlgorithmA.1, and
they are called at Line 3.
A.1.2 Installation
A.1.2.1 Supported Platforms
OLPS is based on MATLAB (both 32- and 64-bit) and Octave (except the Graph-
ical User Interface [GUI] Part); thus, it is supported on 32- and 64-bit versions of
Linux, Mac OS, and Windows. The first version of OLPS is developed and tested on
MATLAB 2009a, while the latest version of OLPS is tested on MATLAB 2013a.
A.1.2.2 Installation Instructions
Installation of the toolbox consists of two steps:
1. Retrieve the latest version of OLPS from the project website. The package can be
downloaded as either a .zip file or a .tar.gz file.
2. Unpack the package to any folder. The root directory is named “OLPS.”
Then the toolbox is available in the folder. Note that the directory structure of the
toolbox is predefined, which decides the running datasets and logs.
A.1.2.3 Folders and Paths
The toolbox consists of five folders in relative path: “/Strategy,” “/Data,” “/GUI,”
“/Log,” and “/Documentation.” The folder “/Strategy” consists of the core strategies
for online portfolios selection, which will be introduced in Section A.3. The folder
also consists of the commands used in the Command Line Interface (CLI), which will
be introduced in Section A.2.2. The folder “/Data” includes some popular datasets in
forms of .mat, which will be detailed in SectionA.1.4. The folder “/GUI” includes the
files to run the Graphical User Interface, which will be detailed in Section A.2.1. The
folder “/Log” stores the experimental details of a strategy on a dataset, which will be
Explicit costs include commissions, taxes, stamp duties, and fees. Implicit costs include the bid–ask
spread, opportunity costs, and slippage costs.
T&F Cat #K23731 — K23731_A001 — page 145 — 9/28/2015 — 20:46
146 OLPS: A TOOLBOX FOR ONLINE PORTFOLIO SELECTION
generated after the simulation process. The folder “/Documentation” contains some
documentations of the toolbox, including one summary paper and one comprehensive
documentation of the toolbox.
A.1.3 Implemented Strategies
Table A.1 illustrates all implemented strategies in the toolbox.
Table A.1 All implemented strategies in the toolbox
Categories Strategies Sections Strategy Names
Benchmarks Uniform Buy and
Hold
A.3.1.1 ubah
Best Stock A.3.1.2 best
Uniform Constant
Rebalanced
Portfolios
A.3.1.3 ucrp
Best Constant
Rebalanced
Portfolios
A.3.1.4 bcrp
Follow the
Winner
Universal Portfolios A.3.2.1 up
Exponential
Gradient
A.3.2.2 eg
Online Newton Step A.3.2.3 ons
Follow the
Loser
Anticorrelation A.3.3.1 anticor/anticor
anticor
Passive–Aggressive
Mean Reversion
A.3.3.2 pamr/pamr
1/pamr 2
Confidence-
Weighted Mean
Reversion
A.3.3.3 cwmr
var/cwmr stdev
Online Moving
Average Reversion
A.3.3.4 olmar1/olmar2
Pattern
Matching
Nonparametric
Kernel-Based
Log-Optimal
A.3.4.1 bk
Nonparametric
Nearest Neighbor
Log-Optimal
A.3.4.2 bnn
Correlation-Driven
Nonparametric
Learning
A.3.4.3 corn/cornu/cornk
Others M0 m0
T0 t0
T&F Cat #K23731 — K23731_A001 — page 146 — 9/28/2015 — 20:46
FRAMEWORK AND INTERFACES 147
Table A.2 All included datasets in the toolbox
File Names
(.mat) Dataset Region Time Frame # Periods # Assets
nyse-o NYSE (O) US 07/03/1962–12/31/1984 5651 36
nyse-n NYSE (N) US 01/01/1985–06/30/2010 6431 23
tse TSE CA 01/04/1994–12/31/1998 1259 88
sp500 SP500 US 01/02/1998–01/31/2003 1276 25
msci MSCI Global 04/01/2006–03/31/2010 1043 24
djia DJIA US 01/14/2001–01/14/2003 507 30
A.1.4 Included Datasets
As shown in TableA.2, six main datasets are widely used for the OLPS task. We do not
include the high-frequency datasets (Li et al. 2013) as they are private. Other variants,
such as the revered datasets (Borodin et al. 2004) and margin datasets (Helmbold et al.
1998), which users may generate themselves, will not be provided in the toolbox.
A.1.5 Quick Start
To quick start the OLPS toolbox, we provide two fast-entry files. One is GUI_start.m,
which starts the GUI. The other is CLI_demo.m, which provides fast executions of
all strategies one by one in the command line. All the parameters used in the file are
set according to their original studies, respectively.
A.2 Framework and Interfaces
In this toolbox, we provide two interfaces to call the implemented strategies, that is,
Graphical User Interface (GUI) and Command Line Interface (CLI). The framework
can be easily extended to include new algorithms and datasets.
A.2.1 Graphical User Interface
In the GUI, users will call the implemented algorithms via interaction with the GUI.
We provide a menu-driven interface for the user to select datasets and algorithms,
and input the desired arguments. After providing the inputs and hitting the start but-
ton, the algorithm(s) execute. Upon completion, the results and relevant graphs are
displayed.
A.2.1.1 Getting Started
To start the GUI, we type the following command in MATLAB:
>> OLPS_gui
After executing the above command, the Trading Manager starts. As shown in
Figure A.1, the opening window has five buttons. The About and Exit buttons are
self-explanatory. The other three are the main functional buttons. The Algorithm
T&F Cat #K23731 — K23731_A001 — page 147 — 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.216.32.116