Online Portfolio Selection Based on Adaptive Kalman Filter through Fuzzy Approach ()

Taksaporn Sirirut^{1}, Dawud Thongtha^{2}

^{1}Department of Mathematics, Faculty of Science, King Mongkut’s University of Technology Thonburi (KMUTT), Thung Khru, Bangkok, Thailand.

^{2}Mathematics and Statistics with Applications (MaSA), Department of Mathematics, Faculty of Science, King Mongkut’s University of Technology Thonburi (KMUTT), Thung Khru, Bangkok, Thailand.

**DOI: **10.4236/jmf.2022.123026
PDF
HTML XML
160
Downloads
1,018
Views
Citations

Online portfolio selection is considered about an asset allocation that can be updated by using current data. This is a fundamental problem in computational finance, which is attracted by investors who aim to manage their existing assets. However, several existing methods for solving this problem have not paid much attention to noisy price data. In this research, the extended Kalman filter with fuzzy approach is applied to the online portfolio selection in order to reduce noise in stock price data and estimate its inherent value. For the initial portfolio setting, two ways, being an equal proportion setting and a single index model (SIM), are applied in this work. Numerical results obtained by the proposed algorithm and other techniques such as anticor (AC) and the anticor based on Kalman filtering (K-AC) are compared and discussed. The results show that, based on this dataset, the proposed method gives the higher wealth and red reward-to-variability (RV) ratio in most window sizes when it is compared to other traditional methods in both initial setting techniques. Taking a closer look at the initial proportion techniques, the results reveal that all algorithms with a single index model provide higher wealth than those obtained by using an equal proportion setting. Moreover, the proposed algorithm equipped with SIM method provides both the higher wealth and RV ratio at the window size 20 days and 30 days.

Keywords

Anticor Algorithm, Adaptive Kalman Filter, Fuzzy Inference System, Online Portfolio Selection

Share and Cite:

Sirirut, T. and Thongtha, D. (2022) Online Portfolio Selection Based on Adaptive Kalman Filter through Fuzzy Approach. *Journal of Mathematical Finance*, **12**, 480-496. doi: 10.4236/jmf.2022.123026.

1. Introduction

The portfolio selection problem is a process for finding the optimal portfolio that provides the highest return with the lowest risk. In order to maximize long-term return, a portfolio manager often properly modifies a portfolio and its proportion. Thus, portfolio selection is considered as an online problem.

Online portfolio selection algorithms are constructed based on various principles such as cross rate principle and mean reversion principle. The cross rate principle proposed by Albeverio *et al.* in 2001 [1] and is adjusted by Ren and Wu in 2016 [2] and 2017 [3] . This principle regards the order of the asset returns rather than the returns of asset themselves. The concept of this principle is replacing lower performance asset by a better one into a portfolio. However, the cross rate method is effective when we consider only two assets. For a mean reversion principle, an online portfolio selection strategy has been proposed by many researchers (see, [4] [5] [6] and [7] ). In this principle, it is assumed that the stock price will tend to move back to the mean price or inherent value over time. From this point, the investor may get more capital gain in the future from lower-performance stocks than the higher ones at the current time due to a more reasonable cost. Nevertheless, these strategies did not pay much attention to the noise of price data leading to an inaccurate estimation.

Borodin, El-Yaniv and Gogan [8] proposed an online portfolio strategy, named anticor (AC) strategy, with an assumption that a market follows the mean reversion principle. In the mechanism of AC, the statistical relationship and the cross-correlation matrix are used to determine a change of the next period price from the previous one. By the mean reversion principle and this mechanism of AC, the AC algorithm is able to transfer the wealth by moving the proportions of good performing stocks to poor performing ones, and the corresponding amount of proportions is adjusted according to the cross-correlation matrix. However, the AC uses the relative price as a ratio of the current price and the last previous price. This relative price is called a raw relative price. Therefore, the AC considers a price movement from one period to the next one, but it does not focus on a price movement from one period to the true value or its inherent value. However, it is hard to find the inherent value of a stock price because of the complex market noise. This leads to inaccurate predictions.

To eliminate the impact of market noise and accurately describe the asset’s inherent trend price, Raphael and Alain [9] used the Kalman filter algorithm (KF) to reduce noise in the stock price. They proposed a new relative price, called a cyclically adjusted price relative (CAPR), by replacing the last price in an original relative price by the inherent value via the Kalman filter algorithm. Based on the CAPR, they propose the K-AC algorithm, which is proved to be more efficient than AC.

However, there are some important limits of KF. For example, an initial value of noise covariance is completely assumed in the KF system by a fixed number. The covariance has an effect on the Kalman gain, which is used to control the filter bandwidth of the algorithm [10] . However, these values are unknown in most practical applications. The problem here is that the quality of these a priori noise statistics affects the optimality of the KF. Moreover, it has been shown that uncertain noise may provoke the divergence of the filter [11] [12] . From this point of view, Escamilla-Ambrosio and Mort [13] proposed a fuzzy inference system (FIS) based adaptive Kalman filtering. Also, they applied their system to a tracking model in logistics. Their adaptive process is concerned with a prescription of conditions under which the noise covariance is adaptively tuned via a fuzzy inference system. In their numerical study, the result reveals that the adaptation of the Kalman filter performs well when it is compared to KF. With this idea, we provide a new way to estimate the inherent price, given in [13] , by using the adaptive Kalman filter.

In this work, the adaptive Kalman filtering through fuzzy approach is applied to an online portfolio selection to predict a new inherent value for adjusting a raw relative price. Furthermore, comparing and analyzing the results from our approach with traditional methods in real datasets are provided. This paper is organized into five sections. In Section 2, the problem setting in a financial market and the academic background are described. The new online portfolio selection algorithms consisting of three steps are presented in Section 3. The first step is computing an inherent stock price from adaptive Kalman filtering through fuzzy approach. It is followed by constructing an adjusted relative price by using an inherent stock price from the first step. The last step is modifying an AC algorithm and computing a portfolio via adaptive AC with the adjusted relative price. The numerical results and discussions are described in Section 4. Finally, the conclusions of this work are given in Section 5.

2. Academic Background and Problem Setting

In this section, we introduce the problem setting in a financial market for defining variables utilized in this work. Moreover, the basic knowledge, being the anticor algorithm, Kalman filter, and fuzzy inference system, is also presented. The algorithms will be used to setup portfolio selection algorithms in the next section.

2.1. Problem Setting

Consider *m* stocks in a financial market. The relative price of stock *i* at the *t*^{th} period
${q}_{t}\left(i\right)$ is the ratio of the closing price of the stock *i* at the *t*^{th} period to the

closing price stock at the (*t* − 1)^{th} period. That is
${q}_{t}\left(i\right)=\frac{{p}_{t}\left(i\right)}{{p}_{t-1}\left(i\right)}$ . Let

${q}_{t}=\left({q}_{t}\left(1\right)\mathrm{,}{q}_{t}\left(2\right)\mathrm{,}\cdots \mathrm{,}{q}_{t}\left(m\right)\right)$ and
$q=\left({q}_{1}\mathrm{,}{q}_{2}\mathrm{,}\cdots \mathrm{,}{q}_{n}\right)$ where *n* is the number of period invested. The vectors
${q}_{t}$ and
$q$ are known as the market vector and the market sequence. Let
${b}_{t}=\left({b}_{t}\left(1\right)\mathrm{,}{b}_{t}\left(2\right)\mathrm{,}\cdots \mathrm{,}{b}_{t}\left(m\right)\right)$ be a portfolio vector, where
${b}_{t}\left(j\right)$ represents the weightage of the investor’s capital invested in the *j*^{th} stock on the *t*^{th} period. In this paper, the self-financing portfolio is assumed and margin and short selling are not allowed. Thus,
${\sum}_{i=1}^{m}}\text{\hspace{0.05em}}\text{\hspace{0.05em}}{b}_{t}\left(i\right)=1$ and
${b}_{t}\left(i\right)\ge 0$ for all *t* and *i*. For trading period
$t>0$ , the cumulative wealth of a portfolio strategy
$b=\left({b}_{1},{b}_{2},\cdots ,{b}_{n}\right)$ after *n* trading periods is as follows:

${S}_{n}\left(b\right)={S}_{0}{\displaystyle \underset{t=1}{\overset{n}{\prod}}}\text{\hspace{0.05em}}{b}_{t}^{\text{T}}\cdot {q}_{t}={S}_{0}{\displaystyle \underset{t=1}{\overset{n}{\prod}}}\text{\hspace{0.05em}}\text{\hspace{0.05em}}{\displaystyle \underset{i=1}{\overset{m}{\sum}}}\text{\hspace{0.05em}}\text{\hspace{0.05em}}{b}_{t}\left(i\right){q}_{t}\left(i\right)$ (1)

where the initial wealth is denoted by ${S}_{0}$ .

In addition, some assumptions on market and trading are assumed as follows:

1) There are no transaction costs and taxes on trading.

2) Investors can trade in a liquid market. Therefore, investors can buy and sell any number of stocks at closing prices.

3) The market behavior cannot influence any portfolio selection strategy.

The simplest portfolio selection strategy is called a buy and hold strategy (BH), which the investors buy stocks using the initial portfolio $b$ and hold all stocks

until the end of investing period. For a portfolio
${b}_{t}=\left(\frac{1}{m}\mathrm{,}\frac{1}{m}\mathrm{,}\cdots \mathrm{,}\frac{1}{m}\right)$ for all *t*,

the BH strategy is referred to as the uniform buy and hold strategy (U-BH), which treats the trend in the market. However, the proportion of each stock in a portfolio may not be equal. In this point, the initial proportion setting with a single index model proposed [14] . We purpose the new method that can adjust the next period trading portfolio according to the value assessment of each stock.

2.2. The Anticor Algorithm

In 2004 Borodin *et al.* [8] proposed an anticor (AC) algorithm. The AC updates a portfolio for the next trading period by adopting the mean reversion theory. The idea of this principle is that whatever the stock price rises or falls, it must revert to the inherent value. Therefore, the algorithm determines an instrument to transfer the wealth from higher-performance stocks to lower-performance ones. To evaluate the performance of the stocks, the AC partitions historical trading days into a number of equal-sized periods called windows size (*w*), which *w* is an integer greater than one. Moreover, the AC requires three assumptions as follows:

1) The growth rate of stock *i* exceeds that of stock *j* in the current window.

2) Stock *j* in the next window follows the same performance of stock *i* in the past window.

3) There is a positive correlation between stock *i* over the second last window and stock *j* over the last window.

Let $L{X}_{1}$ and $L{X}_{2}$ be two $w\times n$ matrices defined as

$\begin{array}{l}L{X}_{1}={\left(\mathrm{log}\left({X}_{t-2w+1}\right)\right)}^{\text{T}}\mathrm{,}\cdots \mathrm{,}{\left(\mathrm{log}\left({X}_{t-w}\right)\right)}^{\text{T}}\\ L{X}_{2}={\left(\mathrm{log}\left({X}_{t-w+1}\right)\right)}^{\text{T}}\mathrm{,}\cdots \mathrm{,}{\left(\mathrm{log}\left({X}_{t}\right)\right)}^{\text{T}}\end{array}$ (2)

where
$\mathrm{log}\left({X}_{t}\right)$ denotes
$\left(\mathrm{log}\left({q}_{t}\left(1\right)\right)\mathrm{,}\cdots \mathrm{,}\mathrm{log}\left({q}_{t}\left(m\right)\right)\right)$ . The
$L{X}_{1}$ and
$L{X}_{2}$ are two
$w\times n$ matrices constructed by taking the logarithm over two consecutive corresponding to time windows
$\left[t-2w+\mathrm{1,}t-w\right]$ and
$\left[t-w+\mathrm{1,}t\right]$ . Let
$L{X}_{k}\left(j\right)$ be the *j*^{th} column of
$L{X}_{k}$ and
${\mu}_{k}\left(j\right)$ and
${\sigma}_{k}\left(j\right)$ be the mean and the standard deviation of
$L{X}_{k}\left(j\right)$ , respectively. The cross-correlation matrix between the column vectors in
$L{X}_{k}$ is defined as follows:

$\begin{array}{l}{M}_{cov}\left(i\mathrm{,}j\right)=\frac{1}{w-1}\left(L{X}_{1}\left(i\right)-{\mu}_{1}\left(i\right)\right){\left(L{X}_{2}\left(j\right)-{\mu}_{2}\left(j\right)\right)}^{\text{T}}\mathrm{,}\\ {M}_{cor}\left(i\mathrm{,}j\right)=(\begin{array}{ll}\frac{{M}_{cov}\left(i\mathrm{,}j\right)}{{\sigma}_{1}\left(i\right){\sigma}_{2}\left(j\right)}\hfill & {\sigma}_{1}\left(i\right)\mathrm{,}{\sigma}_{2}\left(j\right)\ne \mathrm{0,}\hfill \\ 0\hfill & \text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{otherwise}\text{.}\hfill \end{array}\end{array}$ (3)

The
${M}_{cor}\left(i\mathrm{,}j\right)\in \left[-\mathrm{1,1}\right]$ measures the correlation between the log-relative prices of stock *i* over the second last window and stock *j* over the last window. If
${\mu}_{2}\left(i\right)\ge {\mu}_{2}\left(j\right)$ and
${M}_{cor}\left(i,j\right)>0$ , the AC computes an updated portfolio in the next trading day by considering these two transferring functions:

#Math_39# (4)

$transfe{r}_{i\to j}={b}_{t-1}\left(i\right)\cdot \frac{clai{m}_{i\to j}}{{\displaystyle {\sum}_{j}clai{m}_{i\to j}}}\mathrm{.}$ (5)

The updated investment proportion ${\stackrel{^}{b}}_{t}$ is computed by

${\stackrel{^}{b}}_{t}=\frac{1}{{b}_{t}\cdot {q}_{t}}\left({b}_{t}\left(1\right){q}_{t}\left(1\right)\mathrm{,}\cdots \mathrm{,}{b}_{t}\left(m\right){q}_{t}\left(m\right)\right)$ (6)

where

${b}_{t}\left(i\right)={b}_{t-1}\left(i\right)+{\displaystyle \underset{j\ne i}{\sum}}\left(transfe{r}_{j\to i}-transfe{r}_{i\to j}\right)\mathrm{.}$ (7)

2.3. Kalman Filter

The Kalman filter (KF) is considered as the optimal recursive data processing algorithm [15] that produces an estimation of unobservable variables ${x}_{t}\in {\mathbb{R}}^{n}$ at each instant $t=1,2,\cdots $ . Also, the KF provides a prediction of the future system state based on past estimations. The state equation of the time series of unobservable variables is as follows:

${x}_{t+1}={A}_{t}{x}_{t}+{B}_{t}{u}_{t}+{\omega}_{t}$ (8)

where
${x}_{t}$ is an
$\left(n\times 1\right)$ state vector at time *t*,
${u}_{t}$ is an
$\left(l\times 1\right)$ control variable at time *t*,
${\omega}_{t}$ is an
$\left(n\times 1\right)$ noise vector at time *t* assumed to be zero-mean Gaussian white noise with the covariance
${Q}_{t}$ . The matrix
${A}_{t}$ is an
$\left(n\times n\right)$ transition matrix and
${B}_{t}$ is an
$\left(n\times l\right)$ matrix. The observation equation
${z}_{t}\in {\mathbb{R}}^{m}$ is given by

${z}_{t}={H}_{t}{x}_{t}+{\nu}_{t}$ (9)

where
${z}_{t}$ is an
$\left(m\times 1\right)$ observation at time *t*,
${\nu}_{t}$ is an
$\left(m\times 1\right)$ observation noise at time *t* that are assumed to be zero-mean Gaussian white noise with the covariance
${R}_{t}$ and
${H}_{t}$ is an
$\left(m\times n\right)$ measurement matrix.

The KF algorithm consists of prediction state and update state as follows [16] :

1) Prediction state (time update equations):

$\text{Predictedstateestimate}:{\stackrel{^}{x}}_{t+1}^{-}=A{\stackrel{^}{x}}_{t}+B{u}_{t}$ (10)

$\text{Predictederrorcovariance}:{P}_{t+1}^{-}=A{P}_{t}{A}^{\text{T}}+{Q}_{t}$ (11)

2) Update state (measurement update equations):

$\text{Kalmangain}:{K}_{t}={P}_{t}^{-}{H}^{\text{T}}{\left[H{P}_{t}^{-}{H}^{\text{T}}+{R}_{t}\right]}^{-1}$ (12)

$\text{Updatedstateestimate}:{\stackrel{^}{x}}_{t}={\stackrel{^}{x}}_{t}^{-}+{K}_{t}\left[{z}_{t}-H{\stackrel{^}{x}}_{t}^{-}\right]$ (13)

$\text{Updatederrorcovariance}:{P}_{t}=\left[I-{K}_{t}H\right]{P}_{t}^{-}$ (14)

In addition, the covariance matrices ${Q}_{t}$ and ${R}_{t}$ in KF display the statistics of the noises. In many practical applications, we don’t know the true value or Gaussianity of it. Thus, ${Q}_{t}$ and ${R}_{t}$ are used as tuning parameters in general, the user can adjust to get the desired performance.

2.4. Fuzzy Inference System

A fuzzy inference system (FIS) is a system that uses fuzzy set theory to map inputs to outputs. The work of the FIS consists of the following three steps:

1) Fuzzification transforms the crisp values into fuzzy values, it maps actual input values into fuzzy membership functions and evaluates each input’s grade of membership in each membership function. The membership function of a fuzzy set *A* is denoted by
${\mu}_{A}\left(x\right)$ where
${\mu}_{A}\left(x\right)\in \left[\mathrm{0,1}\right]$ and it represents the degree of membership of *x* to the fuzzy set *A* [17] . The triangular membership function, which is used in this paper, is characterized by a mathematical simplicity. It is specified by three parameters
$\left\{a\mathrm{,}b\mathrm{,}c\right\}$ . For each value *x*, the triangular membership function
${\mu}_{A}\left(x\right)$ is defined as follows:

${\mu}_{A}\left(x\right)=(\begin{array}{ll}0\hfill & \text{if}\text{\hspace{0.17em}}x\le a\mathrm{,}\hfill \\ \frac{x-a}{b-a}\hfill & \text{if}\text{\hspace{0.17em}}a\le x\le b\mathrm{,}\hfill \\ \frac{c-x}{c-b}\hfill & \text{if}\text{\hspace{0.17em}}b\le x\le c\mathrm{,}\hfill \\ 0\hfill & \text{if}\text{\hspace{0.17em}}x\ge c\mathrm{.}\hfill \end{array}$

2) Fuzzy rules are a set of rules that make an association between typical input and output data, sometimes in an intuitive way, or, on other occasions, in a data driven way. The fuzzy IF-THEN rule is used in our work is in the following form:

IF *x* is *A* THEN *y* is *B*,

where *A* is a condition in a form of a fuzzy set of input and *B* is a conclusion in a form of a fuzzy set of output.

3) The defuzzification is finally converted into real output or crisp output. The centre of gravity method (COG) is used as a defuzzification method in this research. Let $\mu \left({x}_{i}\right)$ be the membership value for point ${x}_{i}$ in the universe of discourse. Then, COG of a tuning factor $\Delta {R}_{t}$ is defined by

$\text{COG}=\frac{{\displaystyle {\sum}_{i}\mu \left({x}_{i}\right){x}_{i}}}{{\displaystyle {\sum}_{i}\mu \left({x}_{i}\right)}}.$ (15)

3. Computing an Online Portfolio Selection Based on Adaptive Kalman Filtering through Fuzzy Approach

In this research, we adapted AC by adjusting the relative price. The adjusted relative price is defined as a ratio of the current price over the inherent price which is computed through KF and fuzzy approach. There are three steps for constructing the new algorithm. First, we compute an inherent stock price from adaptive KF through fuzzy approach. After that, an adjusted relative price is constructed by using the current price and the inherent stock price that derives from the first step. The last step is computing a portfolio via adaptive AC with the adjusted relative price obtained from the second step.

3.1. Computing an Inherent Stock Price

Previously, the raw relative price is adjusted by the traditional KF formulation which already assumes entire a priori noise statistics. The quality of these prior affects on the optimality of the KF and may provoke the divergence of the filter. Therefore, an adaptive Kalman filtering through fuzzy approach is developed [13] . This adaptation improves the KF performance and prevents filter divergence when ${Q}_{t}$ or ${R}_{t}$ in (11) and (12) are uncertain.

3.1.1. Residual Value and Variance Setting

In this work, the KF algorithm is applied for predicting the inherent value of a stock price on the next trading day by using the current observation. Thus, the linear KF is optimal and we will set the variables in KF accord with the financial market. That is, the dimension of all variables is an
$\left(1\times 1\right)$ matrix. The *A*, *B*, and *H* are assumed to be 1. In fact, we don’t know the control variable in the market, so the
${u}_{t}$ is assumed to be zero.

Therefore, we defined variables for finding the inherent value of stock prices in KF as follows:

1) Prediction state (time update equations):

${\stackrel{^}{p}}_{t+1}^{k-}=A{\stackrel{^}{p}}_{t}^{k}+B{u}_{t}$ (16)

${V}_{t+1}^{-}=A{V}_{t}{A}^{\text{T}}+{Q}_{t}$ (17)

2) Update state (measurement update equations):

${K}_{t}={V}_{t}^{-}{H}^{\text{T}}{\left[H{V}_{t}^{-}{H}^{\text{T}}+{R}_{t}\right]}^{-1}$ (18)

${\stackrel{^}{p}}_{t}^{k}={\stackrel{^}{p}}_{t}^{k-}+{K}_{t}\left[{p}_{t}-H{\stackrel{^}{p}}_{t}^{k-}\right]$ (19)

${V}_{t}=\left[I-{K}_{t}H\right]{V}_{t}^{-}$ (20)

where ${p}_{t}$ is an observation price, ${p}_{t}^{k}$ is an unobservation price obtained from KF algorithm, ${\stackrel{^}{p}}_{t}^{k}$ is an estimation of ${p}_{t}^{k}$ , ${\stackrel{^}{p}}_{t}^{k-}$ is an prediction of ${\stackrel{^}{p}}_{t}^{k}$ and the variance corresponding to the state estimation error defined by:

${V}_{t}=E{\left({p}_{t}^{k}-{\stackrel{^}{p}}_{t}^{k}\right)}^{2}\mathrm{.}$ (21)

The weighted residual with Kalman gain,
${K}_{t}\cdot \left[{p}_{t}-{\stackrel{^}{p}}_{t}^{{k}^{-}}\right]$ , performs as a correction to the predicted estimate
${\stackrel{^}{p}}_{t}^{{k}^{-}}$ . The actual variance #Math_103#, is approximated by its sample variance [18] through averaging inside a moving estimation window of size *N*. That is,

${\stackrel{^}{C}}_{rt}=\frac{1}{N}{\displaystyle \underset{i={i}_{0}}{\overset{t}{\sum}}}\text{\hspace{0.05em}}\text{\hspace{0.05em}}{r}_{i}^{2},$ (22)

where
${r}_{t}:={p}_{t}-{\stackrel{^}{p}}_{t}^{{k}^{-}}$ is the residual and
${i}_{0}=t-N+1$ is the first sample inside the estimation window. This means that its variance is estimated by using only the last *N* samples of
${r}_{t}$ .

3.1.2. Adaptive Observation Noise through Fuzzy Inference System

The purpose of adaptive observation noise through FIS in this research is to improve the performance of KF and prevent filter divergence when ${R}_{t}$ or ${Q}_{t}$ are uncertain. The observation noise ${R}_{t}$ in KF represents the accuracy of the measurement instrument. A larger ${R}_{t}$ of measured data implies that we trust the observed data less and take more importance on the predicted data.

In order to adjust
${R}_{t}$ , the
${R}_{1}$ is assumed to the variance of training data and the noise variance
${Q}_{t}$ in Equation (17) is assumed to be known and be a constant value for all *t*. Thus, we replace
${Q}_{t}$ with *Q*. This adaptive noise is able to reasonably correct the mismatch of the actual variance
${\stackrel{^}{C}}_{rt}$ in Equation (22) and its theoretical variance
${S}_{t}:=H{V}_{t}^{-}{H}^{\text{T}}+{R}_{t}={V}_{t}^{-}+{R}_{t}$ in Equation (18). Now, the discrepancy between
${S}_{t}$ and
${\stackrel{^}{C}}_{rt}$ , called the degree of matching (
$Do{M}_{t}$ ) [13] , is defined as:

$Do{M}_{t}={S}_{t}-{\stackrel{^}{C}}_{rt}.$ (23)

Based on knowledge of the size of the discrepancy between ${S}_{t}$ and ${C}_{rt}$ , an FIS is used to derive a tuning factor $\Delta {R}_{t}$ .

As mentioned above, FIS consists of three steps, namely, fuzzification, fuzzy rule base, and defuzzification.

Fuzzification: To simplify our idea, we divide the fuzzification step into 3 steps as follows:

1) Determining input and output for which the input is an error $Do{M}_{t}$ and actual output is a tuning factor $\Delta {R}_{t}$ of ${R}_{t}$ .

2) Choosing an appropriate membership function for determining input and output fuzzy sets. Because of the linearity of the Kalman equation, the performance of a triangular membership function is accepted in this research [19] .

3) Choosing the correct labels for each fuzzy set which, in this research, named as a linguistic variable. Based on experience knowledge, the linguistic variables for error ( $Do{M}_{t}$ ) are set as negative big (NB), negative medium (NM), negative small (NS), zero (ZE), positive Small (PS), positive medium (PM) and positive big (PB). Also, based on [20] and experience knowledge, it is quantized into equal sizes. The linguistic variables for change of error ( $\Delta {R}_{t}$ ) are defined as decrease large (DL), decrease medium (DM), decrease small (DS), maintain (M), increase small (IS), increase medium (IM) and increase large (IL), and all values are quantized with equal size.

Here, we use the membership function for the error $Do{M}_{t}$ in Figure 1, $a$ is a scale, $Do{M}_{t}$ represents crisp input; seven memberships are used to describe

Figure 1. Membership functions used to translate crisp input into fuzzy. This type of membership is constructed by modifying a membership function in [19] .

the input. The input boundary of a triangular membership function is defined by the maximum and minimum of
$Do{M}_{t}$ in KF. The membership functions for
$\Delta {R}_{t}$ can be expressed similarly, *b* is a scale, and the output boundary is defined by the maximum and minimum of
$\Delta {R}_{t}$ in KF.

Fuzzy rule base: The fuzzy rule base in this research based on Escamilla-Ambrosio and Mort [13] . The rules of adaptation are defined as follows:

1) If $Do{M}_{t}$ is negative big (NB) then increase $\Delta {R}_{t}$ large (IL).

2) If $Do{M}_{t}$ is negative Medium (NM) then increase $\Delta {R}_{t}$ medium (IM).

3) If $Do{M}_{t}$ is negative small (NS) then increase $\Delta {R}_{t}$ small (IS).

4) If $Do{M}_{t}$ is zero (ZE) then maintain (M) $\Delta {R}_{t}$ unchanged.

5) If $Do{M}_{t}$ is positive small (PS) then decrease $\Delta {R}_{t}$ small (DS).

6) If $Do{M}_{t}$ is positive medium (PM) then decrease $\Delta {R}_{t}$ medium (DM).

7) If $Do{M}_{t}$ is positive big (PB) then decrease $\Delta {R}_{t}$ large (DL).

Defuzzification: The last step to design FIS in defuzzification. In this part, a fuzzy set is transformed into a crisp set. Therefore, the input for defuzzification is an aggregate output and the output of this step is a crisp number. Based on (15), the center of gravity method (COG) is used as a defuzzification method in this research. Thus, FIS generates the tuning factor $\Delta {R}_{t}$ , and the correction is made in this way:

${R}_{t}={R}_{t-1}+\Delta {R}_{t}.$ (24)

The ${R}_{t}$ in the above equation is used as an updated value in (18). We now adjust the observation noise variance of ${R}_{t}$ in the KF by using the fuzzy approach to prevent the divergence of KF. Consequently, the observation price ${\stackrel{^}{p}}_{t}^{k}$ in (16) is added as an updated variable of the adaptive KF through fuzzy approach. Then, we observe a new inherent value of stock prices, denoted by ${p}^{fk}$ . The computation procedure of the development of the KF by using the fuzzy approach is shown in Figure 2.

3.2. Constructing an Adjusted Relative Prices

Since the raw relative price from the original AC can only measure how much the price moves from one period to the next one, it cannot measure how far the

Figure 2. The computation procedure of an improvement of KF via FIS.

stock price is different from its inherent value. Therefore, the adjusted relative price is proposed to measure this difference. The adjusted relative price of stock *i* for *t*^{th} trading period is shown as follows:

$\text{Theadjustedrelativeprice}=\frac{{p}_{t}\left(i\right)}{{p}_{t}^{fk}\left(i\right)}$ (25)

3.3. Computing a Portfolio via Adaptive Online Portfolio Selection

In this research, we modify an AC algorithm by applying the adjusted relative price via adaptive Kalman filtering through fuzzy approach. In this step, the updated portfolio for the next trading day is obtained. The algorithm for AC based on adaptive Kalman filtering through fuzzy approach (FK-AC) is shown in Table 1.

4. Numerical Results and Discussions

In this part, we will study the construction of an online trading portfolio with three algorithms, that is AC, K-AC, and FK-AC, and compare their performance by considering wealth and the reward-to-variability (RV) ratio of portfolios. In this research, we will use the real data from the SET50 market consisting of the top 50 listed companies in the Stock Exchange of Thailand in terms of large market capitalization and high liquidity. The daily price of SET50 over 10 months from 1 July 2020 to 1 April 2021 is considered as observation data.

For computing a portfolio, we divide this data into two groups. The first group, the data from 1 July 2020 to 31 August 2020, is used to compute initial parameters in each method. In this step, data window sizes are set to be 10, 20,

Table 1. The algorithm for FK-AC.

and 30. The second group, the data from 1 September 2020 to 30 April 2021, is considered as data for constructing a daily portfolio for each algorithm. In this work, the initial parameters in each method, the covariance *R* and the error covariance *V* (or *P*), are obtained by using the first two months of the data. These initial parameters are only used for constructing the updated portfolio for the first trading day. After that, the two parameters are updated by a mechanism of each algorithm and then used for constructing the next trading day portfolio. In this step, the two month data is assumed to have a sufficient amount for computing initial parameters. Moreover, it reflects the movement of the stock price better than using a long period of time. For an investment period, the data for seven months is considered as data for constructing a daily portfolio obtained from each algorithm. This data group depends on how long you want to invest. In this research, we study an investment for seven months.

For numerical study, an initial portfolio may affect numerical results. In this work, two ways of initial portfolio setting are assumed. Firstly, the initial proportion for each stock is assumed to be equal. We will call this initial portfolio as the basic method. Apart from equally proportion setting, we also use the single index model (SIM) [14] to set up an initial portfolio. In this way, the initial weight for each stock may be different. After that, the portfolios obtained by these two initial setting approaches with AC, K-AC and FK-AC algorithms are compared. Moreover, the following three different ways for selecting stocks into a portfolio are applied:

1) Selecting all stocks in SET50 market

2) Random selecting 10 stocks from SET50

3) Random selecting 2 stocks from each industrial sector in SET50

In the second and the third ways of selecting stocks, twenty cases of randomly selected in each way are used to study the performance of trading algorithms with data window size 10 days, 20 days, and 30 days.

The results are compared by considering wealth and RV ratio of portfolios. The RV ratio indicates investment excess return per unit of risk. The annualized RV ratio is defined as [21] :

$\text{RVratio}=\frac{\text{APY}-{R}_{f}}{\text{ASTDV}}$ (26)

where APY is annual percentage yield, ASTDV is the annualized standard deviation of the daily logarithmic returns. This value ASTDV measures an asset’s volatility (risk). The ${R}_{f}$ is risk-free return rate which here is set to be zero. The APY and ASTDV can be computed by using the following formula:

$\text{APY}={\left(\frac{{W}_{T}}{{W}_{0}}\right)}^{\frac{1}{T}}-1$ (27)

$\text{ASTDV}=\stackrel{^}{\sigma}\cdot \sqrt{252}$ (28)

where ${W}_{T}$ is the wealth of the last trading day, ${W}_{0}$ is the wealth of the first

trading day, *T* is the time for investment which is computed as
$\frac{n}{252}$ where *n* is

the number of the trading day and $\stackrel{^}{\sigma}$ is the standard deviation of the daily logarithmic returns. The number 252 is assumed to represent the number of trading days per year in the stock market. The flowchart of computing is shown in Figure 3. Some portfolio’s wealth results are shown in Figure 4. Moreover, the averages of the wealth of all cases obtained from three different ways for selecting stocks into the portfolio are shown in Table 2.

From Table 2, overall, the FK-AC method provides a higher average of wealth than other methods. Considering the window size of 10, the AC gives the higher average of wealth compared to other algorithms. In the case of 20 and 30 window sizes, the FK-AC gives a better wealth. To indicate investment excess return per unit of risk, the average of RV ratio is used to compare the performance of those algorithms. The results are shown in Table 3.

In Table 3, the FK-AC method also provides a higher RV ratio than other methods. We observe that, particularly, our algorithm provides a better portfolio performance than other methods in the case of the window size 20 and 30. However, for the window size of 10, the AC gives a higher average of RV ratio than other algorithms.

Figure 3. Flowchart of computing portfolio and comparing algorithm.

Figure 4. Wealth of portfolio from selecting all stocks in SET50 market.

Table 2. The average wealth of 3 ways of each algorithm.

Table 3. The average RV ratio of 3 ways of each algorithm.

5. Conclusions

In this research, the anticor (AC) is adjusted by replacing the raw relative price with the alternative relative price observed from Kalman filtering through fuzzy approach. This alternative price provides the direction of how far the price moves from the current price to an inherent price while the raw relative price cannot. From this point, the AC mechanism with the alternative relative price is used to transfer the optimal wealth of each stock in the portfolio for the next period.

For numerical studies, the portfolio selection based on adaptive Kalman filtering through fuzzy approach is compared with the anticor (AC) and the anticor based on Kalman filtering (K-AC). The observation data is the SET50 stock prices. The tools which are used to measure the performance of algorithms are portfolio wealth and reward-to-variability (RV) ratio of a portfolio.

The results show that, based on the dataset in this work, our method provides the higher wealth and RV ratio in most window sizes compared with the original anticor method and the anticor method based on KF in overall. Looking at the initial proportion obtained from the single index model approach, the results show that the proposed method gives both the higher wealth and the higher RV ratio at the window size 20 days and 30 days. Moreover, all methods with the single index model provide higher wealth than those with the basic method. There are two aspects of contributions from this paper. Firstly, this provides a new algorithm that considers the noise of the data. For the second aspect, this work may benefit to investors or developers who need to construct a daily speculative portfolio or efficient trading program by implementing this algorithm with a short period of historical data.

Acknowledgements

The authors appreciate the referee(s) for their helpful comments. The first authors would like to thank the Department of Mathematics, Faculty of Science, King Mongkut’s University of Technology Thonburi for financial support and thanks to the Science Achievement Scholarship of Thailand, SAST for the financial support.

Conflicts of Interest

The authors declare no conflicts of interest.

[1] | Albeverio, S. and Lao, Y.L. and Zhao, X. (2001) On-Line Portfolio Selection Strategy with Prediction in the Presence of Transaction Costs. Mathematical Methods of OR, 54, 133-161. https://doi.org/10.1007/s001860100142 |

[2] |
Ren, P. and Wu, J. (2016) On-Line Portfolio Selection for a Currency Exchange Market. Journal of Mathematical Finance, 6, 471-488. https://doi.org/10.4236/jmf.2016.64038 |

[3] | Ren, P. and Wu, J. (2017) Foreign Exchange Market Modelling and an On-Line Portfolio Selection Algorithm. |

[4] |
Chaudhuri, K. and Wu, Y. (2004) Mean Reversion in Stock Prices: Evidence from Emerging Markets. Managerial Finance, 29, 22-37. https://doi.org/10.1108/03074350310768490 |

[5] | Debondt, W.F.M. and Thaler, R. (1985) Does the Stock Market Overreact? The Journal of Finance, 40, 793-805. https://doi.org/10.1111/j.1540-6261.1985.tb05004.x |

[6] |
Lo, A.W. and Mackinlay, A.C. (1990) When Are Contrarian Profits Due to Stock Market Overreaction? The Review of Financial Studies, 3, 175-205. https://www.jstor.org/stable/2962020 https://doi.org/10.1093/rfs/3.2.175 |

[7] |
Wang, J., Zhang, D. and Zhang, J. (2015) Mean Reversion in Stock Prices of Seven Asian Stock Markets: Unit Root Test and Stationary Test with Fourier Functions. International Review of Economics & Finance, 37, 157-164. https://doi.org/10.1016/j.iref.2014.11.020 |

[8] |
Borodin, A., El-Yaniv, R. and Gogan, V. (2004) Can We Learn to Beat the Best Stock. Journal of Artificial Intelligence Research, 21, 579-594. https://doi.org/10.1613/jair.1336 |

[9] |
Raphael, N. and Alain, K. (2013) Kalman Filtering and Online Learning Algorithms for Portfolio Selection. Economic Research Southern Africa. http://www.econrsa.org/system/files/publications/working_papers/working_paper_394.pdf |

[10] | Moghaddamjoo, A. and Kirlin, L.R. (1989) Robust Adaptive Kalman Filtering with Unknown Inputs. IEEE Transactions on Acoustics, Speech, and Signal Processing, 37, 1166-1175. https://doi.org/10.1109/29.31265 |

[11] |
Jazwinski, A.H. (1969) Adaptive Filtering. Automatica, 5, 475-485. https://doi.org/10.1016/0005-1098(69)90109-5 |

[12] | Fitzgerald, R.J. (1971) Divergence of the Kalman Filter. IEEE Transactions Automatic Control, 16, 736-747. https://doi.org/10.1109/TAC.1971.1099836 |

[13] | Escamilla-Ambrosio, P.J. and Mort, N. (2001) Development of a Fuzzy Logic-Based Adaptive Kalman Filter. 2001 European Control Conference (ECC), Porto, 4-7 September 2001, 1768-1773. https://doi.org/10.23919/ECC.2001.7076177 |

[14] |
Kamil, A.A. (2003) Portfolio Analysis Using Single Index Model. WSEAS Transactions on Mathematics, 2, 83-91. http://www.academia.edu/1771211/Portfolio_Analysis_Using_Single_Index_Model |

[15] | Maybeck, P.S. (1979) Stochastic Models, Estimation and Control. Mathematics in Science and Engineering, Vol. 141. Elsevier, Amsterdam. |

[16] | Youngjoo, K. and Hyochoong, B. (2018) Introduction to Kalman Filter and Its Applications. In: Govaers, F., Ed., Introduction and Implementations of Kalman Filter, IntechOpen, London, 7-22. |

[17] | Yahia, N., Bellamine, N. and Ghzala, H. (2012) Integrating Fuzzy Case-Based Reasoning and Particle Swarm Optimization to Support Decision Making. International Journal of Computer Science Issues, 9, 117-124. |

[18] | Mohamed, A. and Schwarz, K. (1999) Adaptive Kalman Filtering for INS/GPS. Journal of Geodesy, 73, 193-203. https://doi.org/10.1007/s001900050236 |

[19] |
Piltan, F.Z. and Rezaie, H.S. and Boroomand, B.D. and Jahed, A.M. (2012) Design Robust Backstepping On-Line Tuning Feedback Linearization Control Applied to IC Engine. International Journal of Advanced Science and Technology, 43, 127-142. http://article.nadiapub.com/IJAST/vol43/12.pdf |

[20] |
Yue, S. and Henrich, D. (2006) Manipulating Deformable Linear Objects: Fuzzy-Based Active Vibration Damping Skill. Journal of Intelligent & Robotic Systems, 46, 201-219. https://doi.org/10.1007/s10846-006-9049-1 |

[21] | Dochow, R. (2016) Online Algorithms for the Portfolio Selection Problem. Springer Gabler Wiesbaden, Berlin. https://doi.org/10.1007/978-3-658-13528-7 |

Journals Menu

Contact us

+1 323-425-8868 | |

customer@scirp.org | |

+86 18163351462(WhatsApp) | |

1655362766 | |

Paper Publishing WeChat |

Copyright © 2024 by authors and Scientific Research Publishing Inc.

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.