• 沒有找到結果。

CHAPTER 3 Proposed Approach

3.3 The Proposed Algorithm

Input Data:

A set of stocks S = {si | 1  i  n}, which includes the following information on every trading day t : the stock prices SPt, the balance of margin loan BMLt , the balance of stock loan BSLt, the trading volume Vt, the buying volume of institutional investors BIt, the selling volume of institutional investors SIt, the proportion of day-trades DTt, the cash dividends of stocks CD, the industry category of stocks C and the variations of cash dividends varCD.

Parameter Setting:

A predefined maximum number of purchased stocks in a portfolio numCom, a predefined maximum investment capital maxInves, a predefined maximum number of purchased units of a stock maxUnit, a number of groups K, a population size pSize, a crossover rate pc, a mutation rate pm, an inversion rate pI, a number of generations numGene and a number of minimum holding stock days H.

Output:

A diverse group stock portfolio DGSP = {Gi | 1  i  K}.

STEP 1: Generate the trading signal on every stock using the following sub-steps:

Sub-step 1.1: Calculate the BSIt on every trading days using the formula (1) to (4).

Sub-step 1.2: Calculate the high BSI threshold and low BSI threshold using the f sub-steps:

Sub-step 1.2.1: Rank all BSIt, and get the PR value of all BSIt.

Sub-step 1.2.2: Get the PR90 of BSIt and the PR10 of BSIt to be the high BSI threshold and low

BSI threshold.

Sub-step 1.2: Calculate the difference between DTt-1 and DTt on every trading days.

Sub-step 1.3: Generate the original trading signal on every trading days. The trading flag F = {F | 0, 1, -1} is used to control three possible cases. Note that the initial value of F is 0. The three cases are stated as followed.

Case F=0 and F=1: Inspect whether the following conditions of the trading day are met.

BSIt is less than low BSI threshold, changes of DTt >0 and H>3.

If it meets, generate a buying signal on that trading day, translate F to -1 and make H to 0. If it does not meet, add one to H.

Case F= -1: Inspect whether the following conditions of the trading day are met.

BSIt is more than high BSI threshold, changes of DTt <0 and H>3

If it meets, generate a selling signal on that trading day, translate F to 1 and make H to 0. If it does not meet, add one to H.

STEP 2: Record prices of the trading day with first buying signal and trading day with last selling signal on every stock.

STEP 3: Generate initial population with pSize using the following sub-steps:

Sub-step 3.1: Generate grouping part with K randomly. Note that constraints for the grouping part, G1G2…Gk = S, Gi   and i  j, GiGj = should be reached.

Sub-step 3.2: Calculate average cash dividend of each group Gi according to cash dividend of each stock yh using the following formula:

|

where avgCD(Gi) is the average cash dividend of each group Gi,

Sub-step 3.4: Randomly generate numCom values from the range [0, 1] and collect them in a set R = {ri | 1  i  numCom}.

Sub-step 3.5: For each element in R, if the random value ri is between proportionAvgCD(Gi-1) and proportionAvgCD(Gi), then group Gi is put into the candidate portfolio.

Sub-step 3.6: Generate stock portfolio according to the candidate portfolio. For each selected group Gi, set its bi in the chromosome larger than 0.5. Otherwise, set it less than 0.5. Randomly generate the corresponding number of purchased units of each group from the range [0, maxUnit].

step 3.7: If pSize chromosomes are generated, go to the next step. Otherwise, go to Sub-step 3.1.

STEP 4: Calculate fitness value of each chromosome using the following sub-steps:

Sub-step 4.1: Calculate the risk of investor sentiment (RIS) of each chromosome Cq using the following sub-steps:

Sub-step 4.1.1: Generate possible stock portfolios using the group part represented in each chromosome Cq. All of them are collected in a set S = {SPi | 1 < i <

|G1|*|G2|*...*|GK|}.

Sub-step 4.1.2: Get the minimal difference of trading price minDTP(si) on stock si, from every transactions which are decided by trading signals.

Sub-step 4.1.3: Rank all minDTP(si) and get the maximum to be MAXminDTP and the minimum to be MINminDTP.

Sub-step 4.1.4: Calculate the nomalDTP(si) of each stock using the formula (6).

Sub-step 4.1.5: Calculate the subRIS of the stock portfolio SPi using the formula (7)

Sub-step 4.1.6: Repeat Sub-steps 4.1.1 to 4.1.5 to calculate the subRIS of all stock portfolios.

Sub-step 4.1.7: Set the RIS of each chromosome Cq using the formula (8).

Sub-step 4.2: Calculate portfolio satisfaction of each chromosome Cq using following sub-steps:

Sub-step 4.2.1: Calculate ROI of each stock portfolio SPi using the formula (11).

Sub-step 4.2.2: Calculate suitability of each stock portfolio SPi using the formula (15).

Sub-step 4.2.3: Set the portfolio satisfaction of the stock portfolio SPi using the formula (10).

Sub-step 4.2.4: Repeat Sub-steps 4.2.1 to 4.2.3 to calculate the portfolio satisfaction of all stock portfolios.

Sub-step 4.2.5: Set portfolio satisfaction of each chromosome Cq using formula (9).

Sub-step 4.3: Calculate group balance of each chromosome using formula (16):

Sub-step 4.4: Calculate diversity factor of each chromosome using formula (19):

Sub-step 4.5: Set fitness value of each chromosome Cq using formula (23).

Step 5: Execute selection operation on the population to form the next population. Here, elitist or roulette wheel selection strategies can be used. In this paper, the elitist selection strategy is utilized for generating next population.

Step 6: Execute crossover operation on the population.

Step 7: Execute mutation operation on the population.

Step 8: Execute inversion operation on the population.

Step 9: If the stop criterion is satisfied, go to the next step. Otherwise, go to Step 4.

Step 10: Output the best diverse GSP with Investor Sentiment Index.

相關文件