Close
About
FAQ
Home
Collections
Login
USC Login
Register
0
Selected
Invert selection
Deselect all
Deselect all
Click here to refresh results
Click here to refresh results
USC
/
Digital Library
/
University of Southern California Dissertations and Theses
/
Asset price dynamics simulation and trading strategy
(USC Thesis Other)
Asset price dynamics simulation and trading strategy
PDF
Download
Share
Open document
Flip pages
Contact Us
Contact Us
Copy asset link
Request this asset
Transcript (if available)
Content
ASSET PRICE DYNAMICS SIMULATION AND TRADING STRATEGY Conghuan Xu Advisor: Ricardo Mancera A thesis submitted for the degree of Master of Science in (APPLIED MATHEMATICS) DEPARTMENT OF MATHEMATICS UNIVERSITY OF SOUTHERN CALIFORNIA May 2015 2 Contents Abstract 3 1. Introduction 3 2. The Mathematic frame work 3 2.1. The Simulated Market 4 2.2. Analysis for the Simulated Market 6 3. Trading Strategy 8 3.1. Drawbacks of the original strategy 8 3.2. Modified trading strategy 10 4. Use the Trading Strategy 10 4.1. Trading signals 10 4.2. Training the data 11 4.3. Compare to the real market 12 5. Conclusion 13 References 13 ASSET PRICE DYNAMICS SIMULATION AND TRADING STRATEGY CONGHUAN XU Abstract. In this paper, we simulate an artificial stock market and develop some trading strategies. The objective is to use our simulated market to make some decisions of trades for our trading strategy gain some money. In partic- ular, we use the neural network of machine learning to help us make decisions. Through the analysis, we explore the trading signals and get a much better gain when we use these signals to help us decide the trading. 1. Introduction StockMarketpricesarerandomlychangedovertimeduetothebehaviorofevery individual traders. They buy and sell stocks at different time with various size. In particular, these traders have their own trading strategies. The behaviors of the traders are too complex. As the consequence, the price dynamics are difficult to predict. Inthispaper,oneofourgoalsistousetheframeworkdevelopedby(James A. Primbs & Muruhan Rathinam 2009)[1] to simulated a stock price dynamic and see how the traders’ strategies will affect the price dynamic. Next, we want to develop some basic trading strategy to make some money. One approach is to use the Robust Control Paradigm proposed by (B. Ross Barmish, 2008)[2]. Since this is some trading strategy independent from our mathematic framework, we can apply it to both simulated market and real market. Motivated by this paradigm, we develop several trading strategies of our own. Last, we want to have some trading signals to tell us if we should conduct our strategy. Concretely, if these signals appear, we will start our investment, other- wise, we do nothing. Here, what we can do is to simulate the trading process in our artificial stock market generated by James A. Primbs & Muruhan Rathinam’s mathematic framework. And we use neural networktechnique to train the data we choose and test it if it will work in other situations. 2. The Mathematic frame work InJamesA.Primbs&MuruhanRathinam’smathematicframework,themarket is consisted of four types of traders: Key words and phrases. finance, markets, trading of stock, price dynamics, machine learning, neural network. Thanks to my advisor Dr. Ricardo Mancera. 3 4 CONGHUAN XU (1) ExtraneousTradersarethosewhotraderstradeindependentofthestock price, time and each other. (2) Value Traders are those who believe the stock has its true value at each time. And if the current price is lower than its true value they will buy, otherwise they will sell. Here we assume the bigger the gap is the more they will buy or sell. (3) MomentumTraders arethosewho buyorsellaccordingto the historical price of the stock. (4) Hedge Traders are those use options to reduce their risk. Here, we only consider the stock market is consisted of Extraneous Traders, Value Traders, Momentum Traders. Moreover, in this framework, we need a price formation rule to connect traders’ behaviors and stock price. (2.1) p t −p 0 = 1 λ n X i=1 (X i t −X i 0 ) This equation connects log price to the aggregatedemand (Avellaneda and Lipkin, 2003; Farmer, 2000; Farmer and Joshi, 2002). By diffusion limit, James A. Primbs & Muruhan Rathinam have the following Ito-SDE model: (2.2) dp= [ R e C e 1 λ + R v C v (v−p) λ + R m C m ξ λ ]dt + s R e nβ e C e 2 λ dB e + s R v nβ v C v (v−p) λ dB v + s R m nβ m C m ξ λ dB m (2.3) dv =σ 0 dW, (2.4) dξ =Gγdp−γξdt. where p is the log price, t is the time, v is the value of value trader, and B e , B v , B m and W are independent standard Brownian motions. Since we do not consider the hedge trader, our function are slightly different and easier. 2.1. The Simulated Market. Same as James A. Primbs & Muruhan Rathinam, we choose 3M(MMM) to simulate. After calibrating the parameter we simulate 1000 trading days. The FIGURE1 is what the market like without momentum trader, we can see from it that the market looks almost the same as the value dynamics of the value trader. However, in the FIGURE2, we add the momentum trader, this changes everything. First we can see fluctuation of the market is much bigger then the previous one. And although the market has some trend of the value dynamics, it dose not look like it at all. Also the volatility is much bigger. ASSET PRICE DYNAMICS SIMULATION AND TRADING STRATEGY 5 Figure 1. Stock markets is consisted of Extraneous Traders and Value Traders Figure 2. Stock markets is consisted of Extraneous Traders, Value Traders and Momentum Traders 6 CONGHUAN XU 2.2. AnalysisfortheSimulatedMarket. Aftergivingthesimulation,onething we want to see is if the simulated market is satisfied. Taylor Stephen J. in his book Asset Price Dynamics Volatility and Prediction[3] mentioned there should be some stylized facts for daily returns. And we study the following two facts: (1) The daily return distribution is approximately symmetry and with fat tail and high peak compared to normal. (2) The autocorrelationsof returnsareall closeto zero, e.g. the returnsshould be independent. Forthe first point, wecandrawthe histogramofthe returnto see howit lookslike, compute the skewness and the kurtosis. Figure 3. Histogram of the returns By computing the skewness, we have skewness is -0.0890 which means the return distribution is approximately symmetry. Also the kurtosis is 2.8886, which means this distribution has a high peak. Next we draw the qqplot to see the fat tail and we draw the autocorrelation with different time lags. We can see from FIGURE.4 the return distribution has a one side fat tail, since the model does not consider the hedge trader and is a simplified model, we can say it is satisfied. There is another approachto see the independence of the returns. First we need to give four categories: (1) ρ< −0.15 (2) −0.15<ρ< 0 (3) 0<ρ<0.15 ASSET PRICE DYNAMICS SIMULATION AND TRADING STRATEGY 7 Figure 4. Autocorrelation and QQplot (4) ρ> −0.15 where ρ is the daily return. Next we can draw a matrix of the returns, e.g. the element of (1,2) means the first day ρ < −0.15 and the next day is −0.15<ρ < 0. It is similar to the transi- tionmatrix. Our tableis TABLE1. After having this table, wecando Chi-Squared Table 1. Return transition matrix of 999 days 1 2 3 4 1 72 56 61 71 2 56 59 60 49 3 68 52 61 66 4 64 57 65 82 test to see the independence.We have the null hypothesis that the return are inde- pendent. Then by Chi-Squared test, we have X-squared value is 8.2413,the degree offreedomis9,andp-valueis0.51. Sincethep-value0.51isgreaterthanthe.05sig- nificancelevel,wedonotrejectthenullhypothesisthatthereturnareindependent. 8 CONGHUAN XU Herewe choosethe 0.15, 0, and -0.15 asthe threshold to get the category, however, we can choose 0.1, 0, -0.1 as well. If we choose later, we will get the p-value is 0.2027. Thus we can say the returns are independent. From the analysis of the return, our simulated market are generallysatisfied. Thus we can rely on it and do some experiment of our trading strategies. 3. Trading Strategy By now, we only havethe artificial market.Inthis part, wewill focus on momen- tum traders, and see how we can make some money from the artificial market. All these things are based on our simplified model and since we study the momentum traders, our trading strategies do not involve many parameters, which may cause inaccuracy. But here we want to present an idea of how we can study the strategy. Once we have more complex and efficient strategy and a more accurate simulated market, we may do this in similar way and get a much better and accurate result. Our motivation of the strategyis presented byB. Ross Barmishfrom the paper On Trading of Equities: A Robust Control Paradigm[2]. The author use the control theory to support his trading strategy. Basicideaiseverytimeweinvest,wewillhaveagainorlossdynamic,thisdynamic can be a trading feedback strategy. The author gives dynamic update equations: (3.1) g(k+1)=g(k)+ρ(k)I(k); (3.2) I(k+1)= (1+Kρ(k))I(k). where I(k) is investment and g(k) is gain of time k. K is the feedback constant, the bigger it is the more intense we will feedback. And we have a saturation point of I max , which means the money we invested cannot exceed such limit. The author gives proof that for a round trip, e.g. the price of the end time are the same as the price of the beginning, the feedback strategy are better than the buyand holdstrategy. In our word,for a loop, the trader usefeedbackstrategyare better than those buy at the beginning and do nothing (similar to the extraneous trader). 3.1. Drawbacks of the originalstrategy. However,this strategy cannot be ap- pliedtotherealmarketforthesimplereasonthatitassumethereisnocommission. If we consider the commission, we cannot trade unlimited times. From FIGURE.5, we can clearly see this feedback strategy works perfectly if we do not consider the commission. However, if we consider each time we trade, we will pay $ 4.95, which is the commission of TradeKing. It makes sense, because if we trade by interactive brokers, we sill need to pay the gap between buy price and the actual price. We can see from the FIGURE.6, our trading strategybecome less reliable. ASSET PRICE DYNAMICS SIMULATION AND TRADING STRATEGY 9 Figure 5. Feedback V.S. Buy and hold without commission Figure 6. Feedback V.S. Buy and hold with commission 10 CONGHUAN XU 3.2. Modified trading strategy. As the consequence, we need modify this feed- back strategy. We have two approaches here, one is stop trading when investment is small. But this approachconflicts with the feedback strategy, thus if we use this approach, we will get a figure similar to buy and hold strategy. Another approach is still use the basic idea of the original feedback strategy. The originalfeedbackstrategyfeedbackdaily,thismaybethereasonwetradetoomuch and pay a lot of money on commission. We can modify the the feedback strategy as feedback with different time windows. Figure 7. Gain with different feedback time lag 0 2 4 6 8 10 12 14 16 18 20 −1000 −500 0 500 1000 1500 2000 Feedback time lags Income at the end of trading inverval FIGURE.7 we use the commission of $4.95. We can see if we feedback every 2, 3, 4, 5 ,6 day, we will have a better gain. In the following part, we can choose from these strategies above and try to gain some money. 4. Use the Trading Strategy Our idea is for a fixed length of trading days, we cannot guarantee we can make money in every situation. We only prove we can use the feedback strategy when thereisaclosedloop. Thuswefixedthe tradingdaysas100here. And wesimulate 10,000 trading days. For each day, we wish to find some signals that tells if we should begin our trading strategy. 4.1. Trading signals. Here we consider several trading signals: (1) stock price of today (2) stock price of yesterday ASSET PRICE DYNAMICS SIMULATION AND TRADING STRATEGY 11 (3) 3 days exponential moving average (EMA) (4) 5 days exponential moving average (EMA) (5) 10 days exponential moving average (EMA) (6) 20 days exponential moving average (EMA) (7) new high price (8) new low price For EMA, we have following equation: (4.1) EMA(t)=EMA(t−1)+α(price(t)−EMA(t−1)) Expanding it each time results in following power series, and we can see the reason why it is called exponential moving average. (4.2) EMA(t) =α(p 1 +(1−α)p 2 +(1−α) 2 p 3 +(1−α) 3 p 4 +···) New high and new low means if the new high or new low price appears during this time. These are the signals that may tell us if we should trade today. But we do not know what value of these signals means it is a good opportunity to invest, one way we can do is to teach the computer by the simulated data and let the compute tells when we can invest. This is what we do in the next part. 4.2. Training the data. Now, we have artificial market, trading strategy, and trading signals, so finally we can try to gain some money. Our approach here is to treat the trading signals as parameters and use some of our simulated market price as the training data. Our goal is to find some weights Θ that tells us if we should trade. And we set the goal: if the final gain is larger than $350, then it is good. It is because our initial investment is $7,500 and $350 is 5%. This method is motivated by the machine learning (code is introduced by Andrew Ng from Coursera Machine Learning class[4]. I modified the original code to adapt to my problem). We use neural network to help us find potential trading signals. Our trading signals and simulated market are some simplified version of the real market, once again, we want to say is if we have some more accurate market, and moreefficient trading signals, we can still use this machine leaning method, and we will have a good result if we have enough data. Here we simulate 10,000 days of market price data, we divide it into two parts: 8,000 days in the first part as the training data and 2,000 days in the second part as the test data. Since we have trading strategy of different feedback window time, we want to choose the best one here. And we use the average income or loss to measure the strategy. Here is the table. where ’average income of yes’ means the averagegain if the machine tells us we should invest, ’averageincome of no’ means he average gain if the machine tells us we should not invest. From TABLE2 we can see the trading accuracy for these strategy are not significantly changed, but if we use the 6 day feedback strategy will get a better average income. If we do not make decision and use the strategy everyday, the averageincome will be about $-15.3900. 12 CONGHUAN XU Table 2. The behaviors on the test set of different strategy 2 day lags 3 day lags 4 day lags 5 day lags 6 day lags ave. gain of yes 349.6299 506.3685 502.7658 543.3011 575.3019 ave. gain of no -456.2543 -313.9581 -292.9791 -248.9038 -241.9509 training accuracy 77.6433 76.7491 72.6986 72.4882 72.8564 If we use the 6 day feedback strategy we will have the following figure. Figure 8. The gains that the computer tells us to do the trade If we see more details beyond FIGURE.8, we will find that the machine says yes 527 times. And if we trade all these time, there will be 421 times we can make money,and 267times wecangainmorethan$500,127times winmorethan $1000. If we count the total times we lose more than $500, the number will be 35. This tells us we can be a momentum trader using this trading strategy and gain some money when the machine tells us yes. 4.3. Compare to the real market. Last we apply our strategy to the real mar- ket, we choose data from 2011-01-03 to 2015-03-18, after processing the data, we have 1056 days of data. We use 656 days of data to train and use the last 400 days as the test set. Also we set feedback constantK = 4, and we set the feedback window time as 6 days. FIG.9 shows us most of the time if the computer says ’yes’ we will have a bet- ter gain. To be more prices, the average gain of trading decision is 865.1313, and the average gain of not trading decision is 474.7621. This means we may double our income if we do as exactly the machine tells to do. And we can see after machine learning, we can accept the result that the gain from the trading decision are better than gain of not trading. Thus our strategy works. ASSET PRICE DYNAMICS SIMULATION AND TRADING STRATEGY 13 Figure 9. The gains of machine says ’Trade’ v.s. ’Not trade’ 5. Conclusion In this paper, we simulate an artificial stock market, and find some trading strategies. Instead of theoretical analysis, we use the neural network from machine learningtohelpusfindsomepotentialtradingsignalstohelpusdecideifweshould trade or not. In this paper we get a better income when we listen to the trading signal we trained from the past data both in our simulated data and the real stock market. Finally, it should be mentioned our model is a simplified stock market model and the choice of good trading signals and trading strategy strategy are deemphasized here. If we have more accurate model we should find better trading signals and get a bigger gain. References [1] James A. Primbs, and Muruhan Rathinam, trader Behavior and its Effect on Asset Price Dynamics , Applied Mathematical Finance, 16:2, 151-181, DOI: 10.1080/13504860802583444, 2009. [2] B. Ross Barmish, On Trading of Equities: A Robust Control Paradigm, Proceedings of the 17th World Congress The International Federation of Automatic Control Seoul, Korea, July 6-11, 2008 [3] Taylor, Stephen J, Asset price dynamics, volatility, and prediction, Princeton University Press, New Jersey, 2005. [4] Andrew Ng, Machine Learning, https://www.coursera.org/course/ml 1140 W 27th Street Apt 3, Los Angeles, CA, 90007 E-mail address: conghuax@usc.edu
Abstract (if available)
Abstract
In this paper, we simulate an artificial stock market and develop some trading strategies. The objective is to use our simulated market to make some decisions of trades for our trading strategy gain some money. In particular, we use the neural network of machine learning to help us make decisions. Through the analysis, we explore the trading signals and get a much better gain when we use these signals to help us decide the trading.
Linked assets
University of Southern California Dissertations and Theses
Conceptually similar
PDF
Finding technical trading rules in high-frequency data by using genetic programming
PDF
Non-parametric multivariate regression hypothesis testing
PDF
Automatic tracking of protein vesicles
PDF
Improvement of binomial trees model and Black-Scholes model in option pricing
PDF
The application of machine learning in stock market
PDF
On the simple and jump-adapted weak Euler schemes for Lévy driven SDEs
PDF
Elements of dynamic programming: theory and application
PDF
Multi-population optimal change-point detection
PDF
Return time distributions of n-cylinders and infinitely long strings
PDF
On stochastic integro-differential equations
PDF
Asymptotic problems in stochastic partial differential equations: a Wiener chaos approach
PDF
Large deviations rates in a Gaussian setting and related topics
PDF
Supervised learning algorithms on factors impacting retweet
PDF
Theoretical foundations of approximate Bayesian computation
PDF
Equilibrium model of limit order book and optimal execution problem
PDF
Second order in time stochastic evolution equations and Wiener chaos approach
PDF
On spectral approximations of stochastic partial differential equations driven by Poisson noise
PDF
A survey on the computational hardness of linear-structured Markov decision processes
PDF
Tamed and truncated numerical methods for stochastic differential equations
PDF
Empirical approach for estimating the ExB velocity from VTEC map
Asset Metadata
Creator
Xu, Conghuan
(author)
Core Title
Asset price dynamics simulation and trading strategy
School
College of Letters, Arts and Sciences
Degree
Master of Science
Degree Program
Applied Mathematics
Publication Date
04/22/2015
Defense Date
03/25/2015
Publisher
University of Southern California
(original),
University of Southern California. Libraries
(digital)
Tag
finance,machine learning,Markets,neural network,OAI-PMH Harvest,price dynamics,trading of stock
Format
application/pdf
(imt)
Language
English
Contributor
Electronically uploaded by the author
(provenance)
Advisor
Mancera, Ricardo (
committee chair
), Lototsky, Sergey V. (
committee member
), Mikulevičius, Remigijus (
committee member
)
Creator Email
conghuax@usc.edu,conghuaxxx@gmail.com
Permanent Link (DOI)
https://doi.org/10.25549/usctheses-c3-556444
Unique identifier
UC11298768
Identifier
etd-XuConghuan-3367.pdf (filename),usctheses-c3-556444 (legacy record id)
Legacy Identifier
etd-XuConghuan-3367.pdf
Dmrecord
556444
Document Type
Thesis
Format
application/pdf (imt)
Rights
Xu, Conghuan
Type
texts
Source
University of Southern California
(contributing entity),
University of Southern California Dissertations and Theses
(collection)
Access Conditions
The author retains rights to his/her dissertation, thesis or other graduate work according to U.S. copyright law. Electronic access is being provided by the USC Libraries in agreement with the a...
Repository Name
University of Southern California Digital Library
Repository Location
USC Digital Library, University of Southern California, University Park Campus MC 2810, 3434 South Grand Avenue, 2nd Floor, Los Angeles, California 90089-2810, USA
Tags
machine learning
neural network
price dynamics
trading of stock