This document is a project report submitted by Ashail Maharaj to partially fulfill the requirements for a Bachelor of Science in Engineering degree. It focuses on designing an agent-based simulation of trading on the Johannesburg Stock Exchange. The report describes initial plans to model a share price based on various factors, but findings indicate only trading volume strongly correlates with price. This led to a supply and demand-based model where agents decide to buy or sell a share based on whether their intrinsic value calculation is higher or lower than the market value. The model components and initial validations are discussed, along with recommendations to improve the model's realism.
This document is a research project report submitted by Ashail Maharaj to the University of the Witwatersrand in partial fulfillment of a bachelor's degree. The report examines the correlation between various factors and the share price of Richemont, with the objectives of determining influential factors on the price, relationships between factors and price, and factors that can predict price. Eight factors were analyzed at different time intervals against the share price. Data processing included correlation, regression, and residual analysis to identify the most relevant predictive factor.
The document is a draft presentation by Jackson Mao on statistical measurements, analysis, and research. It includes sections on self-introduction, education background, and three parts of the presentation: summary, market research report, and appendix. The summary discusses what was learned in class about statistical analysis used in marketing. The market research report outlines sessions on finding a new dataset and reproducing capstone project milestones related to research design, hypothesis testing, regression, and clustering. The appendix includes revised versions of previous submissions.
IRJET- Stock Market Prediction using Financial News ArticlesIRJET Journal
Β
This document presents a system for predicting stock prices using financial news articles and machine learning. It first extracts data from trusted news sources and cleans it using natural language processing. Sentiment analysis determines if the news is positive or negative. This polarity is input to a machine learning model, which uses an algorithm like linear regression to predict if a stock's price will increase in the next 10 minutes. The system was tested on a dataset divided into 70% for training and 30% for testing. Accuracy, specificity and precision metrics showed the system could successfully predict stock price movements based on analyzing financial news sentiment.
Indian Stock Market Using Machine Learning(Volume1, oct 2017)sk joshi
Β
This document summarizes a research paper that uses machine learning and financial ratios to classify stocks traded on the Indian stock market as either "outperformers" or "underperformers" based on their rate of return. The study uses quarterly data from 50 large market capitalization companies over one year. A support vector machine model achieved 80% accuracy in predicting stock performance on a sector-by-sector basis. While promising, the author acknowledges limitations and outlines areas for further improvement, such as incorporating more external factors like macroeconomic data.
I. Smart experiment design is critical to draw valid conclusions about causal relationships. Experiments must be Specific, Measurable, Achievable, Relevant, and Time-bound.
II. Properly conducted randomized experiments can establish causality but have limitations like cost and feasibility. Natural and quasi-experiments are alternatives but need to account for selection bias.
III. Many ideas fail to improve metrics, so a test-and-learn approach is needed to identify the few successful initiatives. Statistical analysis helps ensure results aren't due to chance.
This document discusses an integrated model for sensitivity analysis and scenario analysis using breakeven analysis for operational and investment risk analysis. It was developed by Prof. Sreedhara Ramesh Chandra and Dr. Krishna Banana. The model aims to address limitations in existing sensitivity, scenario, and breakeven analysis models by integrating the three approaches. It introduces proportions and percentages to more precisely determine variable values. It also establishes relationships between scenario values and measures sensitivity through changes from a predetermined relational constant value (sales revenue). The model allows consideration of all cash flow determinants and provides a direct link between operational and investment risk measurements to improve investment decisions.
This paper examines using different textual representations of financial news articles - bag of words, noun phrases, and named entities - to predict stock prices 20 minutes after an article is released, using support vector machines. The study finds that named entities outperform bag of words, the typical representation used. It introduces the topic of using textual analysis to predict stock prices and reviews prior literature on stock prediction using both fundamental and technical analysis approaches as well as textual data.
This document is a research project report submitted by Ashail Maharaj to the University of the Witwatersrand in partial fulfillment of a bachelor's degree. The report examines the correlation between various factors and the share price of Richemont, with the objectives of determining influential factors on the price, relationships between factors and price, and factors that can predict price. Eight factors were analyzed at different time intervals against the share price. Data processing included correlation, regression, and residual analysis to identify the most relevant predictive factor.
The document is a draft presentation by Jackson Mao on statistical measurements, analysis, and research. It includes sections on self-introduction, education background, and three parts of the presentation: summary, market research report, and appendix. The summary discusses what was learned in class about statistical analysis used in marketing. The market research report outlines sessions on finding a new dataset and reproducing capstone project milestones related to research design, hypothesis testing, regression, and clustering. The appendix includes revised versions of previous submissions.
IRJET- Stock Market Prediction using Financial News ArticlesIRJET Journal
Β
This document presents a system for predicting stock prices using financial news articles and machine learning. It first extracts data from trusted news sources and cleans it using natural language processing. Sentiment analysis determines if the news is positive or negative. This polarity is input to a machine learning model, which uses an algorithm like linear regression to predict if a stock's price will increase in the next 10 minutes. The system was tested on a dataset divided into 70% for training and 30% for testing. Accuracy, specificity and precision metrics showed the system could successfully predict stock price movements based on analyzing financial news sentiment.
Indian Stock Market Using Machine Learning(Volume1, oct 2017)sk joshi
Β
This document summarizes a research paper that uses machine learning and financial ratios to classify stocks traded on the Indian stock market as either "outperformers" or "underperformers" based on their rate of return. The study uses quarterly data from 50 large market capitalization companies over one year. A support vector machine model achieved 80% accuracy in predicting stock performance on a sector-by-sector basis. While promising, the author acknowledges limitations and outlines areas for further improvement, such as incorporating more external factors like macroeconomic data.
I. Smart experiment design is critical to draw valid conclusions about causal relationships. Experiments must be Specific, Measurable, Achievable, Relevant, and Time-bound.
II. Properly conducted randomized experiments can establish causality but have limitations like cost and feasibility. Natural and quasi-experiments are alternatives but need to account for selection bias.
III. Many ideas fail to improve metrics, so a test-and-learn approach is needed to identify the few successful initiatives. Statistical analysis helps ensure results aren't due to chance.
This document discusses an integrated model for sensitivity analysis and scenario analysis using breakeven analysis for operational and investment risk analysis. It was developed by Prof. Sreedhara Ramesh Chandra and Dr. Krishna Banana. The model aims to address limitations in existing sensitivity, scenario, and breakeven analysis models by integrating the three approaches. It introduces proportions and percentages to more precisely determine variable values. It also establishes relationships between scenario values and measures sensitivity through changes from a predetermined relational constant value (sales revenue). The model allows consideration of all cash flow determinants and provides a direct link between operational and investment risk measurements to improve investment decisions.
This paper examines using different textual representations of financial news articles - bag of words, noun phrases, and named entities - to predict stock prices 20 minutes after an article is released, using support vector machines. The study finds that named entities outperform bag of words, the typical representation used. It introduces the topic of using textual analysis to predict stock prices and reviews prior literature on stock prediction using both fundamental and technical analysis approaches as well as textual data.
Factor analysis is a statistical technique used to simplify large sets of variables into underlying factors or subsets. It analyzes all variables together without distinguishing between dependent and independent variables. Factor analysis can help understand media habits, identify price-sensitive customer segments, determine important brand attributes, and understand distribution channel selection criteria. The technique benefits research by providing a more concise representation of the situation, potentially reducing future survey questions, and enabling perceptual maps.
IRJET- Prediction of Stock Market using Machine Learning AlgorithmsIRJET Journal
Β
The document discusses predicting stock market prices using machine learning algorithms. It reviews past research applying algorithms like KNN, neural networks, ARIMA and random forest to stock price prediction. The paper aims to compare the performance of supervised learning algorithms like logistic regression, KNN and random forest on stock market datasets to determine the most accurate for predicting future prices. It reviews literature on the topic and discusses the methodology and algorithms that will be used to make predictions on datasets from five companies.
Presentation for Information Retrieval / Extraction Project on Yelp Data set. The project utilizes various Information Retrieval and Natural Language Processing concepts to build the models.
This document provides a summary of a mystery shopping service quality research program conducted in August 2018 at locations of the Mosigra network. 3 mystery shoppers conducted visits and evaluated service quality based on objective and subjective indices. The objective index score of 80/100 indicates an unsatisfactory level of strict manager behavior that did not accommodate special requests. However, all locations agreed to pack a dish in a special container, gaining a 100/65 score. The document concludes with analysis of managers' emotional states in responding to requests.
Ridge and random forest regression techniques were used to develop a mathematical model to calculate the cross-validation score and predict stock price volatility of companies. The model aims to determine if a firm's stock prices remain fluctuating or stable and analyze trends in price changes over time. Researchers found directional stock price movements were over 90% predictable given past opening and closing prices, though the magnitude of price changes could not be determined with certainty.
Graphical Analysis of Simulated Financial Data Using RIRJET Journal
Β
This document summarizes research analyzing simulated financial data using the R programming language. The researchers developed tools to calculate basic financial ratios using publicly available company data to help investors determine a company's true market value. They performed DuPont analysis on real data from a London company and ANOVA analysis on simulated data generated in large amounts. The document describes the analytical techniques used, including the assumptions and methodology for two-way ANOVA testing. The researchers concluded their study of simulated data and DuPont analysis helped develop an understanding of how financial ratios behave in both efficient and inefficient markets.
- The document provides details about Ye Tian's final presentation, including an introduction, past internship experiences, and links to his GitHub, Kaggle, and LinkedIn profiles.
- It then outlines the topics that will be covered in the presentation, including statistical analysis used in marketing, applying statistical techniques to maximize customer relationships and profitability, and designing market research surveys.
- Research design and data sources are discussed next, along with a customer value analysis link.
- The presentation concludes with an executive summary of a dataset on a bank's customers and analysis performed, including that there is no linear correlation between certain variables.
IOSR Journal of Business and Management (IOSR-JBM) is an open access international journal that provides rapid publication (within a month) of articles in all areas of business and managemant and its applications. The journal welcomes publications of high quality papers on theoretical developments and practical applications inbusiness and management. Original research papers, state-of-the-art reviews, and high quality technical notes are invited for publications.
The document proposes the BIUSPP project to develop and validate a mathematical model for analyzing the success of urban strategic planning processes in cities and metropolitan areas. It involves:
1) Validating the proposed model through surveys of professionals across Europe and statistical analysis to identify key factors.
2) Defining legal responsibilities for metropolitan governance through surveys and statistical analysis.
3) Establishing baseline operational criteria for public organizations through case studies and consensus criteria.
4) Developing interfaces to integrate existing decision-making tools.
The goal is to introduce standardized, evidence-based processes for strategic urban governance and management across Europe.
2013 Red Cross Blood Bank - Rajkot Contract JIGAR VYAS
Β
This document is a letter appointing Jigar Sudhirbhai Vyas as the Public Relations Officer of the Red Cross Blood Bank in Rajkot, Gujarat, India from October 1, 2013 to March 31, 2014. The letter outlines the terms of the contractual appointment, including payment of Rs. 15,000 per month, expected work hours and duties, leave policies, and conditions for termination of employment.
O documento descreve os 4 principais regimes de trabalho para docentes no ensino superior: 1) Horista, onde o docente leciona mas não faz pesquisa; 2) Tempo Parcial, com pelo menos 12 horas semanais e 25% do tempo para outras atividades; 3) Tempo Integral sem DE, com 40 horas semanais e pelo menos 20 horas para pesquisa; 4) Tempo Integral com DE, com 40 horas exclusivas e sem outras atividades. O texto ressalta que a modalidade depende das atribuiçáes, não só da carga horÑria.
This poster was a proposal for a festival to tak place this past summer here in Richmond. I thought it would be fun to use clean and simple typography, while only using the circular element to show depth and form.
El celular se ha convertido en una de las tecnologΓas mΓ‘s utilizadas a nivel mundial, evolucionando constantemente durante casi 30 aΓ±os. ComenzΓ³ utilizando ondas de radio analΓ³gicas en los 40s para realizar llamadas, y desde entonces ha incorporado funcionalidades como mensajes de texto y conectividad a Internet. Los avances tecnolΓ³gicos como la digitalizaciΓ³n y el desarrollo de sistemas como GSM han mejorado considerablemente la calidad, seguridad y capacidades de la telefonΓa mΓ³vil.
Aman Kumar is seeking an opportunity to utilize his knowledge and experience in a thriving environment. He has a bachelor's degree in electronics and control engineering from Sathyabama University with a CGPA of 6.95. His areas of interest include digital systems, Boolean algebra, and communication engineering. He has experience with internships in telecommunications, locomotives, and steel manufacturing. Additionally, he has participated in various workshops and competitions related to robotics, cyber security, and Android development.
Mohinani Group aims to be among the top 50 organizations worldwide by 2018. The document discusses how the individual can contribute to their department and company to achieve this goal. It outlines specific strategies like reducing costs, improving customer service and information sharing. Challenges of managing change and resistance are also addressed, with solutions like communication, training, and addressing employee concerns.
Prabhat Kumar tiene mΓ‘s de 10 aΓ±os de experiencia trabajando para TCS en proyectos bancarios y de mercados de capitales. Ha trabajado en varios proyectos implementando y dando soporte a sistemas de back office para bancos en Chile, Arabia Saudita, Bahrein, Kuwait y Europa. Actualmente trabaja en TCS Santiago implementando y dando soporte al sistema Quartz para el Banco Penta en Chile.
El documento describe la estrategia de Computadores para Educar en Colombia. Se ha entregado equipos a 1.6 millones de estudiantes y se han capacitado a 265,528 docentes, lo que ha generado un impacto positivo en la calidad educativa segΓΊn un estudio del CNC. Computadores para Educar estΓ‘ transformando las realidades educativas en el paΓs.
El documento resume los resultados de una investigaciΓ³n de mercado realizada para la marca Florette. Se llevaron a cabo diversos estudios cualitativos y cuantitativos, incluyendo encuestas, observaciΓ³n en supermercados, y un focus group con estudiantes universitarios. El focus group arrojΓ³ insights sobre los estilos de vida saludables y las necesidades de los consumidores de comida rΓ‘pida. La investigaciΓ³n ayudarΓ‘ a Florette a desarrollar una estrategia que enfatice los vΓnculos emocionales con los clientes.
English Biscuit Manufacturers SCM ASSIGNMENT EBMFurqan Aslam
Β
The document discusses the supply chain management of English Biscuit Manufacturers (EBM). It describes EBM's supply chain structure which includes procurement, sourcing, warehousing, and distribution. Procurement is divided into domestic procurement of direct materials like flour, sugar, and packaging materials, as well as imports. Warehousing includes separate stores for raw materials, packaging materials, and finished goods. The supply chain process involves forecasting demand, planning production, manufacturing biscuits, deploying finished goods to warehouses, marketing, suppliers, distribution to over 350 retailers nationwide, and consumers purchasing the products.
Factor analysis is a statistical technique used to simplify large sets of variables into underlying factors or subsets. It analyzes all variables together without distinguishing between dependent and independent variables. Factor analysis can help understand media habits, identify price-sensitive customer segments, determine important brand attributes, and understand distribution channel selection criteria. The technique benefits research by providing a more concise representation of the situation, potentially reducing future survey questions, and enabling perceptual maps.
IRJET- Prediction of Stock Market using Machine Learning AlgorithmsIRJET Journal
Β
The document discusses predicting stock market prices using machine learning algorithms. It reviews past research applying algorithms like KNN, neural networks, ARIMA and random forest to stock price prediction. The paper aims to compare the performance of supervised learning algorithms like logistic regression, KNN and random forest on stock market datasets to determine the most accurate for predicting future prices. It reviews literature on the topic and discusses the methodology and algorithms that will be used to make predictions on datasets from five companies.
Presentation for Information Retrieval / Extraction Project on Yelp Data set. The project utilizes various Information Retrieval and Natural Language Processing concepts to build the models.
This document provides a summary of a mystery shopping service quality research program conducted in August 2018 at locations of the Mosigra network. 3 mystery shoppers conducted visits and evaluated service quality based on objective and subjective indices. The objective index score of 80/100 indicates an unsatisfactory level of strict manager behavior that did not accommodate special requests. However, all locations agreed to pack a dish in a special container, gaining a 100/65 score. The document concludes with analysis of managers' emotional states in responding to requests.
Ridge and random forest regression techniques were used to develop a mathematical model to calculate the cross-validation score and predict stock price volatility of companies. The model aims to determine if a firm's stock prices remain fluctuating or stable and analyze trends in price changes over time. Researchers found directional stock price movements were over 90% predictable given past opening and closing prices, though the magnitude of price changes could not be determined with certainty.
Graphical Analysis of Simulated Financial Data Using RIRJET Journal
Β
This document summarizes research analyzing simulated financial data using the R programming language. The researchers developed tools to calculate basic financial ratios using publicly available company data to help investors determine a company's true market value. They performed DuPont analysis on real data from a London company and ANOVA analysis on simulated data generated in large amounts. The document describes the analytical techniques used, including the assumptions and methodology for two-way ANOVA testing. The researchers concluded their study of simulated data and DuPont analysis helped develop an understanding of how financial ratios behave in both efficient and inefficient markets.
- The document provides details about Ye Tian's final presentation, including an introduction, past internship experiences, and links to his GitHub, Kaggle, and LinkedIn profiles.
- It then outlines the topics that will be covered in the presentation, including statistical analysis used in marketing, applying statistical techniques to maximize customer relationships and profitability, and designing market research surveys.
- Research design and data sources are discussed next, along with a customer value analysis link.
- The presentation concludes with an executive summary of a dataset on a bank's customers and analysis performed, including that there is no linear correlation between certain variables.
IOSR Journal of Business and Management (IOSR-JBM) is an open access international journal that provides rapid publication (within a month) of articles in all areas of business and managemant and its applications. The journal welcomes publications of high quality papers on theoretical developments and practical applications inbusiness and management. Original research papers, state-of-the-art reviews, and high quality technical notes are invited for publications.
The document proposes the BIUSPP project to develop and validate a mathematical model for analyzing the success of urban strategic planning processes in cities and metropolitan areas. It involves:
1) Validating the proposed model through surveys of professionals across Europe and statistical analysis to identify key factors.
2) Defining legal responsibilities for metropolitan governance through surveys and statistical analysis.
3) Establishing baseline operational criteria for public organizations through case studies and consensus criteria.
4) Developing interfaces to integrate existing decision-making tools.
The goal is to introduce standardized, evidence-based processes for strategic urban governance and management across Europe.
2013 Red Cross Blood Bank - Rajkot Contract JIGAR VYAS
Β
This document is a letter appointing Jigar Sudhirbhai Vyas as the Public Relations Officer of the Red Cross Blood Bank in Rajkot, Gujarat, India from October 1, 2013 to March 31, 2014. The letter outlines the terms of the contractual appointment, including payment of Rs. 15,000 per month, expected work hours and duties, leave policies, and conditions for termination of employment.
O documento descreve os 4 principais regimes de trabalho para docentes no ensino superior: 1) Horista, onde o docente leciona mas não faz pesquisa; 2) Tempo Parcial, com pelo menos 12 horas semanais e 25% do tempo para outras atividades; 3) Tempo Integral sem DE, com 40 horas semanais e pelo menos 20 horas para pesquisa; 4) Tempo Integral com DE, com 40 horas exclusivas e sem outras atividades. O texto ressalta que a modalidade depende das atribuiçáes, não só da carga horÑria.
This poster was a proposal for a festival to tak place this past summer here in Richmond. I thought it would be fun to use clean and simple typography, while only using the circular element to show depth and form.
El celular se ha convertido en una de las tecnologΓas mΓ‘s utilizadas a nivel mundial, evolucionando constantemente durante casi 30 aΓ±os. ComenzΓ³ utilizando ondas de radio analΓ³gicas en los 40s para realizar llamadas, y desde entonces ha incorporado funcionalidades como mensajes de texto y conectividad a Internet. Los avances tecnolΓ³gicos como la digitalizaciΓ³n y el desarrollo de sistemas como GSM han mejorado considerablemente la calidad, seguridad y capacidades de la telefonΓa mΓ³vil.
Aman Kumar is seeking an opportunity to utilize his knowledge and experience in a thriving environment. He has a bachelor's degree in electronics and control engineering from Sathyabama University with a CGPA of 6.95. His areas of interest include digital systems, Boolean algebra, and communication engineering. He has experience with internships in telecommunications, locomotives, and steel manufacturing. Additionally, he has participated in various workshops and competitions related to robotics, cyber security, and Android development.
Mohinani Group aims to be among the top 50 organizations worldwide by 2018. The document discusses how the individual can contribute to their department and company to achieve this goal. It outlines specific strategies like reducing costs, improving customer service and information sharing. Challenges of managing change and resistance are also addressed, with solutions like communication, training, and addressing employee concerns.
Prabhat Kumar tiene mΓ‘s de 10 aΓ±os de experiencia trabajando para TCS en proyectos bancarios y de mercados de capitales. Ha trabajado en varios proyectos implementando y dando soporte a sistemas de back office para bancos en Chile, Arabia Saudita, Bahrein, Kuwait y Europa. Actualmente trabaja en TCS Santiago implementando y dando soporte al sistema Quartz para el Banco Penta en Chile.
El documento describe la estrategia de Computadores para Educar en Colombia. Se ha entregado equipos a 1.6 millones de estudiantes y se han capacitado a 265,528 docentes, lo que ha generado un impacto positivo en la calidad educativa segΓΊn un estudio del CNC. Computadores para Educar estΓ‘ transformando las realidades educativas en el paΓs.
El documento resume los resultados de una investigaciΓ³n de mercado realizada para la marca Florette. Se llevaron a cabo diversos estudios cualitativos y cuantitativos, incluyendo encuestas, observaciΓ³n en supermercados, y un focus group con estudiantes universitarios. El focus group arrojΓ³ insights sobre los estilos de vida saludables y las necesidades de los consumidores de comida rΓ‘pida. La investigaciΓ³n ayudarΓ‘ a Florette a desarrollar una estrategia que enfatice los vΓnculos emocionales con los clientes.
English Biscuit Manufacturers SCM ASSIGNMENT EBMFurqan Aslam
Β
The document discusses the supply chain management of English Biscuit Manufacturers (EBM). It describes EBM's supply chain structure which includes procurement, sourcing, warehousing, and distribution. Procurement is divided into domestic procurement of direct materials like flour, sugar, and packaging materials, as well as imports. Warehousing includes separate stores for raw materials, packaging materials, and finished goods. The supply chain process involves forecasting demand, planning production, manufacturing biscuits, deploying finished goods to warehouses, marketing, suppliers, distribution to over 350 retailers nationwide, and consumers purchasing the products.
The document is an appointment letter appointing Jigar Vyas to the position of Public Relations Officer Incharge at the Indian Medical Scientific Research Foundation (IMSRF). Some key details:
- Jigar Vyas will be paid a consolidated salary of Rs. 14,000 per month. He will have an annual performance-based increment and be governed by the organization's leave rules.
- He will initially be posted at IMSRF but may be transferred anywhere in India depending on organizational needs.
- He will be on a six-month probation period and his employment can be terminated without notice if particulars provided are found to be false.
- His employment can also be terminated with one
A predictive system called "INSIGHT" was built using structured and unstructured data from various sources to identify potential buyers and sellers for large block trades. The system analyzed data like daily block trades, shareholder patterns, holdings, and market news to predict fund behavior. Additionally, the author learned quantitative research including technical analysis, building pair trading strategies, and value-at-risk models to analyze stock predictions and portfolio risk. The internship provided valuable experience in institutional equities trading and quantitative analysis techniques.
This document discusses using machine learning techniques to forecast financial time series and predict stock market prices. It provides an overview of various machine learning and statistical methods that have been used for stock prediction, including regression, support vector machines, decision trees, neural networks, and random forests. The authors aim to formulate short-term and long-term predictions of stock price direction, changes in price, and actual price. They collect historical stock price and technical indicator data and use feature selection and scaling before applying classification and regression models to achieve 81% accuracy for trend direction and RMSE errors of 0.0117 and 0.0613 for next day price and change, respectively.
1) The document provides an overview of a webinar on conducting discrete choice conjoint analysis projects using SurveyAnalytics software.
2) It discusses key aspects of setting up a conjoint analysis study such as defining attributes and levels, sample size considerations, and best practices for survey design.
3) The webinar demonstrates how to interpret conjoint analysis outputs including relative importance scores and market simulations.
IRJET- Slant Analysis of Customer Reviews in View of Concealed Markov DisplayIRJET Journal
Β
This document summarizes a research paper that proposes a method for sentiment analysis of customer reviews using a Hidden Markov Model. It first discusses how online retailers receive large numbers of customer reviews for products and how it is difficult to analyze the overall sentiment from all reviews. The proposed method involves using a Hidden Markov Model to analyze each review sentence and determine if it expresses a positive or negative sentiment. The model is trained on a dataset of customer reviews that have been part-of-speech labeled. Experimental results found that the trained Hidden Markov Model achieved high precision and accuracy in classifying the sentiment of reviews.
This document discusses using artificial neural networks for trading stocks and other financial assets. It explains that neural networks are well-suited for financial markets which are noisy and unpredictable. The document outlines what is required to develop a neural network trading system, including selecting important input variables from fundamental and technical analysis. Fundamental analysis variables discussed include company size, valuation ratios, and attributes identified by Benjamin Graham that may indicate an undervalued stock. Technical analysis techniques covered are charting, indicators, and oscillators. The document aims to discuss how to develop a neural network trading strategy that can operate given real-world constraints.
Project report on Share Market applicationKRISHNA PANDEY
Β
This is the proposal document for AVS Group of Technology service offering in the website design and development and custom web application development space. The document details our understanding of the brief, the objectives of the services suite, the methodology, and deliverable and commercials.
The document discusses using a genetic algorithm to create an optimized portfolio of energy stocks from the NASDAQ and NYSE exchanges. It aims to analyze stocks based on fundamentals and dividends to determine the best combination. The project will select individual stocks, generate random initial portfolios, and use a genetic algorithm to evolve the portfolios over generations until the optimal one is found based on predefined criteria. Related work on genetic algorithms and their potential to rationally analyze stock movements based on variables is reviewed.
This thesis investigates two optimization problems: portfolio optimization with transaction costs and online display advertising allocation. For portfolio optimization, the author improves the statistical input data using a factor model and includes a transaction cost function in the objective. Two solution methods are applied: conditional value at risk and reliability based optimization. For advertising allocation, a stochastic revenue optimization model is developed. Revenues consider guaranteed contracts and unguaranteed spot markets. The conditional value at risk algorithm is used to maximize revenue while ensuring long-term market stability.
IRJET- Stock Market Prediction using Machine Learning TechniquesIRJET Journal
Β
This document discusses using machine learning techniques to predict stock market prices. It proposes building a machine learning model that uses historical stock data to predict future stock prices. The model would go through preprocessing, processing, and regression analysis of the dataset to make predictions. Predicting stock market movements accurately is challenging, but this model aims to generate results using machine learning and deep learning algorithms on the dataset to help investors make trading decisions.
Now knowledge pre-processing, model and reasoning issues, power metrics, quality
issues, post-processing of discovered structures, visualization, and on-line change is best challenge.
In this paper Neural Network based forecasting of stock prices of selected sectors under Bombay
Stock Exchange show that neural networks have the power to predict prices albeit the volatility in the
markets[9]. The motivation for the development of neural network technology stemmed from the
desire to develop an artificial system that could perform βintelligent" tasks similar to those performed
by the human brain. Artificial Neural Networks are being counted as the wave of the future in
computing. They are indeed self-learning mechanisms which donβt require the traditional skills of a
programmer. Back propagation is one of the approaches to implement concept of neural networks.
Back propagation is a form of supervised learning for multi-layer nets. Error data at the output layer
is back propagated to earlier ones, allowing incoming weights to these layers to be updated. It is most
often used as training algorithm in current neural network applications. In this paper, we apply data
mining technology to stock market in order to research the trend of price; it aims to predict the future
trend of the stock market and the fluctuation of price. This paper points out the shortage that exists in
current traditional statistical analysis in the stock, then makes use of BP neural network algorithm to
predict the stock market by establishing a three-tier structure of the neural network, namely input
layer, hidden layer and output layer. Finally, we get a better predictive model to improve forecast
accuracy
STOCK MARKET PREDICTION USING MACHINE LEARNING IN PYTHONIRJET Journal
Β
This document discusses using machine learning techniques to predict stock market prices. Specifically, it evaluates using support vector machines, random forests, and regression models. It finds that support vector regression with an RBF kernel performed best compared to other models at accurately predicting stock prices based on historical data. The paper also reviews several related works applying machine learning methods like neural networks and support vector machines to financial time series data for stock prediction.
The document discusses using fuzzy logic and data mining techniques to predict rainfall based on temperature, humidity, and wind factors. It also covers past works that have used clustering techniques like K-means clustering to analyze weather data and predict temperatures and humidity. The document then discusses different methodologies for weather forecasting, including causal models, simulation models, and leading economic indicators.
Impact and Implications of Operations Research in Stock Marketinventionjournals
Β
The motivation of this article is to advocate the administrative routine of settling on choices construct in light of instinct, as well as instinct combined with quantitative investigation. Operations Research (OR) is one of the main administrative choice science instruments utilized by benefit and charitable, for example, stock market. Gauging stock return is an important financial subject that has attracted researchers' consideration for a long time. It includes a supposition that basic data openly accessible in the past has some prescient connections to the future stock returns. This review tries to help the financial specialists in the stock market to choose the better planning for purchasing or offering stocks based on the information extricated from the chronicled costs of such stocks. The choice taken will be founded on choice tree classifier which is one of the Operations Research techniques.
Impact and Implications of Operations Research in Stock Marketinventionjournals
Β
The motivation of this article is to advocate the administrative routine of settling on choices construct in light of instinct, as well as instinct combined with quantitative investigation. Operations Research (OR) is one of the main administrative choice science instruments utilized by benefit and charitable, for example, stock market. Gauging stock return is an important financial subject that has attracted researchers' consideration for a long time. It includes a supposition that basic data openly accessible in the past has some prescient connections to the future stock returns. This review tries to help the financial specialists in the stock market to choose the better planning for purchasing or offering stocks based on the information extricated from the chronicled costs of such stocks. The choice taken will be founded on choice tree classifier which is one of the Operations Research techniques.
[Project] Customer experience and buying behaviour in e-commerce sitesBiswadeep Ghosh Hazra
Β
The growing usage of internet in India provides an extremely lucrative market for many retailers and businesses. If e-retailers get to know the factors that broadly affect online behaviour, and the corresponding relationships between the type of online buyers and these factors, then they can further fine tune their marketing strategies to convert potential customers into permanent customers, while keeping the existing online ones.
This project on consumer behaviour is a part of a study, that broadly focuses on the factors which Indian online buyers keep in mind while they are shopping online. The research conducted found that Customer Service, Customer Review/Recommendations and Discount/Offers are the three dominant factors that influence online consumer perception. Consumer behaviour is an applied discipline because some decisions are significantly affected by their expected actions. The two perspectives that demand application of its knowledge are societal and micro perspectives. Internet is changing the very method consumers shop, buy goods and services, and has rapidly become a global phenomenon.
Today all companies must use the Internet with the goal of cutting marketing costs, and at the same time, received quantitative information; thereby reducing the price of the services and products, the companies offer. High competition compels companies to continuously look for cost cutting measures. Companies also use internet to communicate, convey and disseminate information, to take feedback, conduct satisfaction surveys with customers and most importantly, to sell the product.
Identifying Malicious Reviews Using NLP and Bayesian Technique on Ecommerce H...IRJET Journal
Β
This document summarizes a research paper that proposes a method called PSGD (Partially Supervised Graph-based Detection) to identify spammer groups on e-commerce platforms. The method first labels some known spammer groups as positive examples. It then uses these examples along with unlabeled groups and extracted negative examples to train a Naive Bayesian classifier to identify spammer groups. The proposed PSGD method is evaluated on real data from Amazon.cn and is shown to outperform existing spammer group detection techniques.
Now knowledge pre-processing, model and reasoning issues, power metrics, quality
issues, post-processing of discovered structures, isualization, and on-line change is best challenge.
In this paper Neural Network based forecasting of stock prices of selected sectors under Bombay
Stock Exchange show that neural networks have the power to predict prices albeit the volatility in the
markets[9]. The motivation for the development of neural network technology stemmed from the desire to develop an artificial system that could perform βintelligent" tasks similar to those performed by the human brain. Artificial Neural Networks are being counted as the wave of the future in computing. They are indeed self-learning mechanisms which donβt require the traditional skills of a
programmer. Back propagation is one of the approaches to implement concept of neural networks. Back propagation is a form of supervised learning for multi-layer nets. Error data at the output layer is back propagated to earlier ones, allowing incoming weights to these layers to be updated. It is most often used as training algorithm in current neural network applications. In this paper, we apply data
mining technology to stock market in order to research the trend of price; it aims to predict the future trend of the stock market and the fluctuation of price. This paper points out the shortage that exists in current traditional statistical analysis in the stock, then makes use of BP neural network algorithm to predict the stock market by establishing a three-tier structure of the neural network, namely input layer, hidden layer and output layer. Finally, we get a better predictive model to improve forecast accuracy.
The document describes several case studies completed as part of a business analytics course. The case studies covered topics like social media metrics for a gym, car performance analysis, employee salary prediction, fraud detection, stock price prediction, product recommendations, online marketing campaigns, and demand forecasting for a bicycle rental company. Machine learning techniques like regression, neural networks, support vector machines, and ensemble models were applied to solve problems in various domains like healthcare, retail, and transportation.
Big Data Analytics for Predicting Consumer BehaviourIRJET Journal
Β
This document discusses using big data analytics and machine learning techniques to predict consumer behavior and sales trends. It begins with an introduction to consumer behavior and an overview of how analyzing customer data can provide insights. The document then discusses using data mining methods on customer data to build predictive models for tasks like sales forecasting. It proposes using a combination of random forest and linear regression algorithms on a dataset from various stores. The implementation section outlines the steps, including data preprocessing, feature extraction, applying algorithms to the data, comparing results and building the best predictive model. The goal is to determine the most accurate approach for understanding customer behavior and how they will respond in different situations.
Prediction system report and results-Jay VoraJay Vora
Β
This document provides a project report on predicting company stock prices using data mining techniques. It includes sections on requirements, UI design, architecture, datasets, data flow, algorithms used, and testing. The project aims to analyze twitter data and historical stock prices to predict future stock performance for companies in the IT sector. Data mining techniques like k-means clustering, TF-IDF, SVD, and vector space modeling are implemented and visualized to analyze sentiment and relevance of tweets to predict stock price changes.
1. MECN4005 β Design Project
Agent Based Simulation of the JSE
Name: Ashail Maharaj
Student Number: 536684
Supervisor: Dr Ian Campbell
2 November 2016
A project report submitted to the Faculty of Engineering and the Built Environment, University
of the Witwatersrand, Johannesburg, in partial fulο¬lment of the requirements for the degree of
Bachelor of Science in Engineering.
Johannesburg, November 2016
2. ii
DECLARATION
UNIVERSITY OF THE WITWATERSRAND, JOHANNESBURG
SCHOOL OF MECHANICAL, INDUSTRIAL AND
AERONAUTICAL ENGINEERING
I Ashail Maharaj Student Number: 536684, am registered for the course No. MECN 4005 - in the
year 2016.
I herewith submit the following task, βDesign Project: Agent Based Simulation of The JSEβ in partial
fulfilment of the requirements of the above course.
I hereby declare the following:
ο· I am aware that plagiarism (the use of someone elseβs work without their permission and/or
without acknowledging the original source) is wrong;
ο· I confirm that the work submitted herewith for assessment in the above course is my own
unaided work except where I have explicitly indicated otherwise;
ο· This task has not been submitted before, either individually or jointly, for any course
requirement, examination or degree at this or any other tertiary educational institution;
ο· I have followed the required conventions in referencing the thoughts and ideas of others;
ο· I understand that the University of the Witwatersrand may take disciplinary action against me
if it can be shown that this task is not my own unaided work or that I have failed to acknowledge
the sources of the ideas or words in my writing in this task.
Signature: ________________________________ Date: 2/11/2016
3. iii
EXECUTIVE SUMMARY
This project focuses on the simulation of trading on the Johannesburg Stock Exchange (JSE). For the
purpose of this project, one share had been selected to be traded in the simulation. The share that was
chosen was Richemont CFR, which is one of the top five companies listed on the JSE. The simulation
designed in this report initially aimed at modelling the share price as a function of multiple factors, the
factors that were initially considered were:
ο· Fundamental pricing information including dividends.
ο· Distribution of knowledge.
ο· Economic conditions such as exchange rate, overseas market closing levels, inflation, interest
rates and commodity prices that may be correlated to the share.
ο· Market perceptions of the company including company ethics.
ο· Risk profiles and time views (e.g. buy and hold, day trading, etc.)
ο· Competition and alternatives in the market.
ο· Financial level (and size of trades).
Prior research found that only the volume traded was strongly correlated to the share price. The volume
traded however showed strong correlations with the Rand-Euro and Rand-Dollar exchange rate as well
as the platinum price. This finding led to the idea of modelling the market through supply and demand
due to the strong relationship between the share price and volume traded.
After concept selection was done, simplifying assumptions were made to start building the model. The
chosen model had agents that entered the market, and made decisions on whether to buy or sell a share.
This decision was based on whether their intrinsic value was less than or greater than the market value.
If the intrinsic value was greater, then the agent would buy. If the intrinsic value was less, the agent
would sell.
The model was then broken down into two major components, namely the agent and the trading system.
The agent logic comprised of agent decisions to transact, intrinsic value estimation, agent logic and the
agent attributes. The trading system was broken down into the matching of orders, exchange of shares
and cash, expiration of orders, maintaining trading hours and creating an overreaction in the market.
While validating the components, it was found that the neural network function created in Anylogic,
which was used for the estimation of the intrinsic value for the agents, did not perform as required,
although it was still responsive and changed values with given inputs. Using the neural network resulted
in incorrect values which did not change much from day to day. The model was also found to be too
slow if too many agents were used. Validating the model using historic data was not possible as the
simulation created very high frequency intraday data, for which actual data was not available.
4. iv
However, as part of the validation, the simulationsβ price series was tested to see if the presence of
stylized facts existed. These stylized facts show that the model can represent reality to some degree.
This resulted in the finding that the returns were non-normally distributed and leptokurtic. It was then
recommended that a software called Matlabcontrol should be used to link Matlab with Anylogic. Using
as this would allow the user to get exactly the function created in Matlab. A number of other
recommendations pertaining to the decision logic and further building of the model, to make it more
realistic, were noted in Section 9.
5. v
Acknowledgements
I would like to acknowledge and thank my parents for always supporting me, no matter the
circumstance.
I would also like to thank Dr Ian Campbell for supervising me through this period. His guidance and
advice has been invaluable to me.
6. vi
TABLE OF CONTENTS
DECLARATION....................................................................................................................................ii
ACKNOWLEDGEMENTS....................................................................................................................v
TABLE OF CONTENTS.......................................................................................................................vi
LIST OF FIGURES ................................................................................................................................x
LIST OF TABLES...............................................................................................................................xiii
1. INTRODUCTION ..........................................................................................................................1
1.1 Background.............................................................................................................................1
1.2 Motivation...............................................................................................................................2
1.3 Task as given...........................................................................................................................3
1.4 Task as understood..................................................................................................................3
2 LITERATURE REVIEW ...............................................................................................................4
2.1 Agent based Simulation ..........................................................................................................4
2.2 Discrete Event Simulation ......................................................................................................4
2.3 System Dynamics Simulation.................................................................................................4
2.4 Johannesburg Stock exchange ................................................................................................5
2.5 Option trading.........................................................................................................................5
2.6 Double auction market............................................................................................................5
2.7 Limit order book .....................................................................................................................5
2.7.1 Limit order ......................................................................................................................5
2.7.2 Market order....................................................................................................................6
2.8 Supply and Demand................................................................................................................6
2.9 Market Efficiency ...................................................................................................................9
2.10 Martingales .............................................................................................................................9
2.11 Stylized facts...........................................................................................................................9
2.12 Agent Learning and Artificial Intelligence ...........................................................................10
2.12.1 Neural Networks ...........................................................................................................10
2.12.2 Feed-Forward Back Propagation (FFBP) neural network.............................................11
7. vii
2.12.3 Fuzzy Logic ..................................................................................................................13
2.12.4 Genetic Algorithms.......................................................................................................13
2.13 Fundamental analysis............................................................................................................13
2.14 Technical Analysis................................................................................................................14
2.14.1 Trend Analysis..............................................................................................................15
2.14.2 Support and Resistance Analysis ..................................................................................15
2.14.3 Volume Analysis...........................................................................................................15
2.15 Kurtosis.................................................................................................................................16
2.16 Skewness...............................................................................................................................17
2.17 Normality..............................................................................................................................17
2.18 Stationarity............................................................................................................................18
2.18.1 Difference stationarity...................................................................................................18
2.18.2 Trend Stationarity .........................................................................................................18
2.18.3 Difference and Trend Stationary...................................................................................18
2.18.4 Testing for Trend stationarity and Difference Stationarity...........................................18
2.19 Homoscedasticity..................................................................................................................20
2.19.1 Engle test for residual heteroscedasticity......................................................................20
2.20 Random Walk Hypothesis ....................................................................................................20
2.20.1 Pure Random Walk.......................................................................................................20
2.20.2 Random walk with drift ................................................................................................21
2.20.3 Deterministic trend........................................................................................................21
2.20.4 Random walk with drift and deterministic trend...........................................................21
2.21 Related studies ......................................................................................................................21
2.21.1 Chan et al. 1999 ............................................................................................................21
2.21.2 Preyen Nair 2014 .........................................................................................................22
3 HIGH LEVEL PRODUCT REQUIREMENT SPECIFICATION ...............................................23
3.1 Requirements ........................................................................................................................23
3.2 Constraints ............................................................................................................................23
3.3 Criteria ..................................................................................................................................23
8. viii
3.4 Assumptions..........................................................................................................................23
4 CONCEPT GENERATION..........................................................................................................24
4.1 Concept Creation ..................................................................................................................26
4.1.1 Concept 1 ......................................................................................................................27
4.1.2 Concept 2 ......................................................................................................................28
4.1.3 Concept 3 ......................................................................................................................29
4.2 Concept Selection .................................................................................................................30
5 THE DESIGN PROCESS.............................................................................................................33
6 DESIGN DEVELOPMENT OF THE MODEL ...........................................................................34
6.1 Agents (Traders) ...................................................................................................................34
6.1.1 Product Requirement Specification...............................................................................34
6.1.2 Concept Development and Specification......................................................................35
6.1.3 Validation......................................................................................................................44
6.2 Trading platform ...................................................................................................................59
Product Requirement Specification...............................................................................59
Concept Development and Specifications ....................................................................60
6.2.2 Validation......................................................................................................................69
6.3 Assumptions Made for the Model.........................................................................................78
6.4 Limitations of the model.......................................................................................................79
7 VALIDATION OF MODELβS PERFORMANCE AS A WHOLE.............................................79
8 CRITICAL ANALYSIS OF DESIGN..........................................................................................82
8.1 Comparing Completed model with the criteria.....................................................................83
8.1.1 Accuracy of prediction..................................................................................................83
8.1.2 Data Presentation and collection...................................................................................83
8.1.3 Ease of use ....................................................................................................................83
8.1.4 Speed.............................................................................................................................83
8.1.5 Realistic behaviour........................................................................................................83
8.1.6 Ease of creating the concept in Anylogic......................................................................83
8.1.7 Modular building and interactions ................................................................................83
9. ix
8.2 Shortcomings in representing the market..............................................................................84
9 RECOMMENDATIONS..............................................................................................................84
9.1 Representing the market........................................................................................................84
9.2 Neural network......................................................................................................................84
10 REFERENCES .........................................................................................................................85
APPENDIX A:......................................................................................................................................90
10. x
LIST OF FIGURES
Figure 1: Demand Relationship[15]........................................................................................................6
Figure 2: Supply Relationship[15]..........................................................................................................7
Figure 3: Economic Equilibrium [15].....................................................................................................7
Figure 4: Excess Supply[15]...................................................................................................................8
Figure 5: Excess Demand [15]................................................................................................................8
Figure 6: Graphical Explanation of Kurtosis and Skewness[21]..........................................................10
Figure 7: Perceptron Configuration[28]................................................................................................11
Figure 8: Moods of the masses according to technical analysis[38].....................................................14
Figure 10: Concept 1 Flow Chart..........................................................................................................27
Figure 11: Concept 2 Agent State Chart ...............................................................................................28
Figure 12: Concept 2 Activity Cycle Diagram .....................................................................................28
Figure 13: Concept 3 Agent State Chart ...............................................................................................29
Figure 14: Concept 3 Activity Cycle Diagram .....................................................................................30
Figure 15: Agent Logic Flowchart........................................................................................................37
Figure 16:Flowchart for Decisions to Buy or Sell ................................................................................38
Figure 17: Flowchart of the general logic for creation of Intrinsic Value ............................................39
Figure 18: Flowchart of the Feedforward Back Propagation used to create a function in Anylogic....40
Figure 19: Structure of neural network used in Matlab ........................................................................41
Figure 20: An Increase in Demand [64]................................................................................................42
Figure 21: Flowchart of The Logic Used for The Buy and Sell Buttons Which Are Used to Represent
an Overreaction in The Market .............................................................................................................43
Figure 22: Validation that Changing of states occurs...........................................................................44
Figure 23: Validation That the Share Price is Never Below Zero ........................................................45
Figure 24:Validation That the Minimum Amount of Shares an Agent Can Hold is Zero....................45
Figure 25:Validation That Cash held is Always Positive .....................................................................46
Figure 26:Validation That Cash Never Goes Below Zero....................................................................46
Figure 27: Validation That the Number of Shares in The System Stays Constant Throughout ...........47
Figure 28: Screenshot of Simulation Before Pressing Buy Button.......................................................48
Figure 29:Screenshot of Simulation After Pressing Buy Button ..........................................................48
Figure 30: Screenshot of Simulation Before Pressing Sell Button .......................................................49
Figure 31: Screenshot of Simulation After Pressing Sell Button..........................................................49
Figure 32: Screenshot of simulation before (left side) and after (right side) pressing Buy Now button
..............................................................................................................................................................50
Figure 33: Screenshot of simulation before (left side) and after (right side) pressing Sell Now button
..............................................................................................................................................................51
11. xi
Figure 34: Screenshot of Simulation Before (Left Side) And After (Right Side) Increasing the Share
Price ......................................................................................................................................................52
Figure 35: Screenshot of Simulation Before (Left Side) And After (Right Side) Decreasing the Share
Price ......................................................................................................................................................52
Figure 36: Plot of Output and Error of Feed Forward Backpropagation Neural Network as well as the
Actual Data ...........................................................................................................................................53
Figure 37:R2
Values Between Target and the Output of the Neural Network, for the Training,
Validation, Test and All 3 Runs............................................................................................................54
Figure 38: Sum Squared Error for training, testing and validation runs...............................................54
Figure 39: Validation of Neural Network Using Newer Data ..............................................................54
Figure 40: Screenshot of Simulation Before (Left Side), After Decreasing (Middle) and After Increasing
(Right) the Platinum Price ....................................................................................................................55
Figure 41: Screenshot of Simulation Before (Left Side), After Increasing (Middle) and After Decreasing
(Right) the Rand-Dollar Exchange Rate...............................................................................................56
Figure 42: Screenshot of Simulation Before (Left Side), After Increasing (Middle) and After Decreasing
(Right) the Rand-Euro Exchange Rate..................................................................................................56
Figure 43: Output from neural network in Matlab................................................................................57
Figure 44:Inputs and output to neural network in Anylogic.................................................................57
Figure 45:Price Sensitivity to Platinum Price.......................................................................................58
Figure 46: Price Sensitivity to Change in the Rand-Euro Exchange Rate............................................58
Figure 47:Price Sensitivity to Rand-Dollar Exchange Rate..................................................................58
Figure 48: Queuing System Used in Model..........................................................................................60
Figure 49: Flowchart of The Logic Used for The Exchange of Share and Money...............................61
Figure 50: Calculations Done in The False Then False Action Box in The Flowchart of The Logic Used
for The Exchange of Shares and Money...............................................................................................62
Figure 51: Calculations Done in The False Then True Action Box in The Flowchart of The Logic Used
for The Exchange of Shares and Money...............................................................................................62
Figure 52: Calculations Done in The True Action Box in The Flowchart of The Logic Used for The
Exchange of Shares and Money............................................................................................................63
Figure 53: Flowchart of The Expiration of Orders ...............................................................................64
Figure 54: Screenshot of The Trading Hours Schedule........................................................................65
Figure 55: Screenshot of the βTradingHoursβ Parameter .....................................................................66
Figure 56: Screenshot of βevent1β........................................................................................................67
Figure 57: Screenshot of the Logic Used in the βEvalEventβ Function................................................68
Figure 58: Screenshot of the SelectOuput4 logic..................................................................................68
Figure 59: Screenshot of the Queuing System Used in the Model .......................................................69
12. xii
Figure 60:Validation That Continuous Match Will Occur till The Entire Number of Shares to Trade Has
Been Traded..........................................................................................................................................70
Figure 61: Screenshot of Simulation Before Agent Buys Shares .........................................................73
Figure 62: Screenshot of Simulation After Agent Buys Shares............................................................74
Figure 63: Screenshot of Simulation Before Agent Sells Shares..........................................................75
Figure 64: Screenshot of Simulation After Agent Sells Shares ............................................................76
Figure 65: Validation That After Expiry Agents Leave the Matching Queue......................................77
Figure 66: Validation That After Trading Hours No Shares are Traded ..............................................78
Figure 67: Frequencies of The Share Prices from The Simulation Model............................................82
Figure 68: Frequency Plot of the Returns .............................................................................................82
13. xiii
LIST OF TABLES
Table 1: Agent logic for price, logic and order types[2].......................................................................22
Table 2: Concept Creation Matrix ........................................................................................................26
Table 3: Concept Rating Table .............................................................................................................30
Table 4: Summary of Data from Buying Screenshots ..........................................................................71
Table 5: Summary of Data from Selling Screenshots...........................................................................72
Table 6: Comparison of Model Data with Actual Data ........................................................................80
Table 7: Summary of tests done on the outputs of the simulation........................................................81
14. 1
1. INTRODUCTION
1.1 Background
A stock market is a network of buyers and sellers, each of whom are trading stocks. Stocks represent a
shareholding in the company that issued the share. Companies issue shares to raise capital, and initially
the stock is valued by the amount of capital require divided by the number of shares issued. The capital
is exchanged for holdings in the company.
This project focuses around the simulation of the trading that occurs on the JSE. For the purpose of this
project, one share has been selected to be traded in the simulation. The share that was chosen is
Richemont CFR which is listed in the top five companies on the JSE. The simulation designed in this
report initially aimed at modelling the share price as a function of multiple factors. The factors that were
initially considered were:
ο· Fundamental pricing information including dividends.
ο· Distribution of knowledge.
ο· Economic conditions such as exchange rate, overseas market closing levels, inflation and
interest rates as well as commodity prices that may be correlated to the share.
ο· Market perceptions of the company including company ethics.
ο· Risk profiles and time views (e.g. buy and hold, day trading, etc.)
ο· Competition and alternatives in the market.
ο· Financial level (and size of trades).
The project was then split into two components. The first being the research of factors that correlated
with the share price, which was prior research to the design of the simulation. In the research, it was
found that the Richemont share price was only strongly correlated to the volume traded. The volume
traded however showed strong correlations with the Rand-Euro and Rand-Dollar exchange rate as well
as the platinum price.
Upon finding this, the idea for the simulation had changed from the all-encompassing view to trying to
model the share price as a function of its volume, while using the other factors to forecast the share
price.
15. 2
1.2 Motivation
The modelling of a market generally requires theories to understand how the entire market will react.
The agent-based approach to simulating a market requires basic logic that can vary from trader to trader.
Each of these tradersβ logic then create reactions in the market. This is why neuroeconomics is useful.
Neuroeconomics is an interdisciplinary field that provides explanation behind the motivation of
individualsβ actions. The study of this allows for the individualism of entities to be taken into account
when modelling complex systems. For modelling these complex systems using neuroeconomics, agent-
based simulations are becoming more widely used.
One of the fields of interest for the application of agent-based simulations is the social science of
economics. Economics is defined as the study of production and trade. One of the fundamentals upon
which economics was based is the theory of supply and demand. This theory tries to create an
understanding about how buyers and sellers interact, how they make their choices according to the
quantities demanded and supplied, and how price is affected by these interactions. This design project
tries to incorporate economics of financial markets with the individualistic decision making that
neuroeconomics studies by creating an agent based model of a financial market.
Forecasting and modelling of financial markets have led to interesting discussions about accuracies and
the ability of a model to explain certain aspects of real markets. These aspects have come to be known
as stylised facts. Recently the growing trend in artificial intelligence and automation have also led to
the creation of interesting ideas such as the algobot. An algobot is a programme that makes decisions
on whether to place orders to buy or sell shares, how long to hold for or even when to buy or sell shares.
The concept of algobots, is what inspired this project.
Having an algobot does not necessarily mean that it be correct all the time. As seen with most AI
algorithms, training is needed before prediction can become accurate. This could be a problem as
inaccuracy in training could lead to financial losses. To avoid these risks, a simulation of a market that
could represent reality would be a good place to train an algobot or to test different trading strategies.
Drawing on all of the above mentioned, the idea of creating a simulation model, that could model
individual decisions based on their perception of a share and other environmental factors, was created.
16. 3
1.3 Task as given
Design, build and validate a market model of a financial trading market. The model should encompass
the influential factors which affect the market. Agent-based simulation will be used to simulate the
individual interactions of traders.
1.4 Task as understood
Design an agent-based simulation of a financial trading market. The market will be driven by the factors
within the market such as price, demand and supply of shares, and external environmental factors.
Seeing as the scope of the task is large, there will be justified simplifying assumptions made so that the
project can be completed in the time given. The simulation will be built as a foundation to creating a
more complex market structure. The factors that will be considered in the external environment are the
Platinum price(R/oz.), Rand-Euro exchange rate and the Rand-Dollar exchange rate.
The above factors were chosen due to prior research which had found a strong correlation between the
volume traded and the Richemont share price. The relationship between the volume traded had strongly
negative correlations to the factors mentioned above. Therefore, this simulation is an attempt to model
the share price based on volume traded, while trying to model the volume traded with the external
environmental factors. [1]
Due to the nature of this problem, a supply-demand formulation will be applied to this model. Where
the price will move to try to reach an equilibrium point. Validation of the model will include comparison
to the Richemont share price, comparing the volume traded with the share price to ensure that the
volume traded is creating changes in the share price, and ensuring that agents are making choices
according to the environmental factors.
17. 4
2 LITERATURE REVIEW
2.1 Agent Based Simulation
Agent based simulation is a method used for modelling complex scenarios which involve individual
decision making and interactions between individuals. Agent based models may combine elements of
game theory, complex systems, emergence or evolutionary programming. Agents may also use artificial
intelligence in their decision-making processes to learn over time[2]. Agent based models have three
elements [3]:
1. Self-contained, autonomous agents with attributes and behaviour
2. Interaction between agents
3. An environment in which the agents can interact with each other and the environment
Agent based simulations are used in a wide variety of fields. Fields including economics, finance,
military planning, city management, traffic simulations, routing problems and most social sciences.
Simulations are used to test a hypothesis by changing factors in the real world, as this cannot be done
feasibly, it is best to test these in a simulation. ABMs are also used to confirm theoretical results or
when a problem is too complex to be solved analytically[3], [4].
2.2 Discrete Event Simulation
A discrete event simulation is a method of explaining behaviour of a complex system as a sequence of
ordered events. Discrete event simulations are stochastic as each of the events that occur introduce
randomness to the system. A discrete event simulation must include the following properties[5], [6]:
1. Predetermined starting and ending points
2. A method of keeping track of the time that has passed since the start of the process.
3. A list of events that have occurred
4. A list of events that are expected
2.3 System Dynamics Simulation
System dynamics is used to understand nonlinear complex systems over time using feedback loops,
stocks and flows. When modelling system dynamics it is recommended that one[5] :
ο· models the system as a causally closed structure which defines its own behaviour
ο· discovers the circular causality balancing or reinforcing
ο· identifies stocks and flows that affects the system
18. 5
2.4 Johannesburg Stock Exchange
The Johannesburg Stock Exchange (JSE) is the 19th
largest stock exchange in the world and the largest
in Africa, by market capitalisation. The JSE offers secure and efficient primary and secondary capital
markets across a diverse range of securities[7]. The JSE provides a market where securities can be
traded and regulated. The exchange raises primary capital by channelling cash resources into productive
economic activity.
2.5 Option Trading
An option is a contract which gives the buyer the right to buy or sell an asset at a specified price before
a specified date. There are two types of options, namely; calls and puts. A put order gives the holder
the option to sell their assets at a given price within the period stipulated by the contract. The buyer of
a put hopes that the stock falls before the option expires. A call order gives the holder the option to buy
an asset at a given price within the specified period. The buyer of the call hopes that the stock increases
before the option expires[8].
2.6 Double Auction Market
A double auction market is the system which is used to buy and sell securities through brokers on stock
exchanges. The double auction market consists of many buyers and many sellers[9]. In a double auction
market buyers and sellers enter competitive offers with their orders, as opposed to the over the counter
method which uses negotiation to reach a deal. Double auction markets can also use the outcry method,
which is characterised by buyers and sellers calling out prices till a transaction occurs when a buyer and
a seller call out the same price[10].
2.7 Limit Order Book
A limit order book is a list of unexecuted limits orders which is maintained by a member of the stock
exchange, who acts as the market maker. This member posts the bid and ask prices, manages limit
orders and executes trades between the buyers and sellers. It is the duty of the market maker to ensure
that during large movements in the demand or supply, it reaches an equilibrium. If not for this market
maker, prices would rise or fall during large movements in the demand and supply respectively[11].
2.7.1 Limit Order
A limit order, as the name states, is an order that states the limit that the buyer or seller is willing to
trade at. For example, if a buyer wants to buy a share at a maximum price of R2 per share, he will place
a buy limit order. A sell limit sets the minimum price the seller is willing to sell at[12]. Limit orders
have to have an expiration date which is usually a 90-day period at maximum.
19. 6
2.7.2 Market Order
A market order is an order that is made immediately at the best available current price. In the trading
system, a market order is guaranteed to be executed as there are no time constraints like options or price
restrictions as there are with limit orders. For this reason, the market order is also known as an
unrestricted order. There is also one other difference between the order limit and the market order, this
is the price of the transaction. In general, the price of a limit order transaction is higher than the cost of
the market order. It is also important to note that is some markets, market orders are not allowed.[13],
[14]
2.8 Supply and Demand
Supply is defined as the quantity of a commodity that is available to be sold in a market. Demand is
defined as the total quantity of a commodity that is wanted by the traders in the market. Supply and
demand are the fundamentals behind the study of a market economy. The law of demand states that
there is a negative relationship between price and the quantity demanded. In Figure 2 the relationship
between price and quantity for demand is shown. The law of demand basically states that as the price
of some commodity decreases; the more people would want to buy.
Figure 1: Demand Relationship[15]
The law of supply, has a positive relationship between the price and the quantity. This is due to suppliers
seeing higher opportunity at higher prices, this results in more suppliers wanting to sell. In Figure 2, the
relationship between price and quantity supplied is shown.
20. 7
Figure 2: Supply Relationship[15]
Economic equilibrium is said to be reached when the quantity supplied and the quantity demanded are
equal. As seen in Figure 3, when the quantities of supply meet that of the demand there is a single price
that the commodity is worth. The equilibrium can only be reached in theory and as a result the price
keeps fluctuating.
Figure 3: Economic Equilibrium [15]
When the market is not in equilibrium there are two possibilities that could occur, excess demand or
excess supply. If the price is set too high, an excess in supply will be created as the buyers would not
want to buy and the sellers would want to sell. In Figure 4, it can be seen that an excess supply is created
by both, the buyers and sellers moving away from the equilibrium point due to the high price. In order
to reach equilibrium, the price of the commodity would need to decrease. This can be seen by shifting
the the price till the supply line meets the demand line.
21. 8
Figure 4: Excess Supply[15]
On the other extreme, if the price is too low, the quantity supplied would decrease and the quantity
demanded would increase. As seen in Figure 5, shifting the price upward would allow the market to
reach equilibrium.
Figure 5: Excess Demand [15]
It is also important to note that the demand and supply curves can both be shifted, keeping the price
constant but changing the quantity and thus creating a new equilibrium relationship. These shifts can
be created on the demand due to the lack of substitutable commodities and as a result people are willing
to pay the set price. A change in supply would result from a shortage of sellers in the market [14].
Supply and demand relationships can be exploited to understand markets, for example most share prices
are highly correlated with the volume traded, this is often seen by chartists.
22. 9
2.9 Market Efficiency
Market efficiency is derived from the Efficient Market Hypothesis (EMH), which states that at any
given time, the prices fully reflect all available information on the stock or market involved. There are
three degrees of efficiency in the market[16]:
1. Strong Efficiency
This states that all information about the stock or the market are accounted for in the stock price and
that insider information wouldnβt even give the trader an advantage.
2. Semi-Strong Efficiency
This form of the EMH states that all public information about the stock or market are included in the
share price and that technical or fundamental strategies would not give the user superior gains.
3. Weak Efficiency
This type of EMH states that all of the previous prices of the price series are reflected in the stock price
currently and therefore technical analysis would not gain the user an advantage in beating the market.
2.10 Martingales
The martingale property states that the conditional expectations of a sequence of partial sums is its
current value. The martingale property ensures that, in a fair game, knowledge of the past is of no use
to predicting the future outcomes[17].
2.11 Stylized Facts
A stylised fact refers to empirical findings that are consistent across different instruments, markets and
time periods. Stylised facts are presented as a truth or a generalisation about the properties of the subject
matter. Theories and model must fit these empirical findings in order to validly explain these
phenomena, the absence of these empirical finding may then be attributed to inaccuracies in the theories
or models[18], [19].
Some of the stylized facts relating to share price prediction are[20];
1. Non-Normal Return Distributions
This can be tested by doing a Kolmogorov-Smirnov test to check whether the distribution is normal or
not. The kurtosis and skewness need to be tested. Kurtosis above a value of 3 is known to be leptokurtic
whereas kurtosis below 3 is said to be platykurtic. In Figure 6 below the shapes of the graphs are shown
for each of the skewness and kurtosis cases. Skewness can also be measured to indicate if the return
data is identically distributed.
23. 10
Figure 6: Graphical Explanation of Kurtosis and Skewness[21]
2. Volatility clustering of returns
Volatility clustering, as defined by Benoit Mandelbrot, refers to βlarge changes in returns tend to follow
large changes in returnsβ and that βsmall changes in returns would be followed by small changes in
returnsβ [22]. This can be tested by testing if the returns are autocorrelated followed by testing if the
series is heteroscedastic using the Engleβs ARCH test[23].
3. High and persistent trading volume
4. Existence of technical trading
2.12 Agent Learning and Artificial Intelligence
Artificial intelligence is defined as intelligence displayed by computer programs or machines. It also
generally describes the ability of a non-living entity to exhibit cognitive ability. Cognitive ability is
generally defined by problem solving and learning abilities. The field draws on knowledge from the
computer science, mathematics, psychology, linguistics, philosophy, neuroscience and artificial
psychology backgrounds. Commonly used AI algorithms are; Neural networks, decision trees, fuzzy
logic and genetic algorithms[24].
2.12.1 Neural Networks
A neural network is derived from the way biological nervous systems process information. Neural
networks are large networks that connect inputs to outputs using links. Each link has its own weight
which changes as the neural network is trained (this is synonymous to learning as it is trial and error,
until the correct method is learnt from previous mistakes or errors). Just like in the brain, training helps
24. 11
improve connections between the nodes in order to better the result. Figure 7 shows the structure of a
perceptron neural network, note that there are three layers; an input layer, hidden layer and an output
layer. Between the input and the hidden layers are connections and each connection has a weight
annotated by the letter w. Weights are also found on the connections between the hidden layer and the
output layer[25]β[27].
Figure 7: Perceptron Configuration[28]
For the purpose of this report only one type of neural networks is specifically important, this is the Feed
Forward Back Propagation (FFBP) method.
2.12.2 Feed-Forward Back Propagation (FFBP) Neural Network
The FFBP neural network is identical to the neural network in Figure7. The calculations required by
the neural network, assuming that there are no biases, that the delta learning rule is applied and that the
inputs and outputs are scaled between 0 and 1, are listed below.
ο· Step 1
Create a set of weights between the values of 0.2 and 0.8 for the all the connections in the network.
ο· Step 2
Calculate the effective input into the hidden layer using Equation 1.
πβ = β(π₯πΓπ€πβ)
π
π=1
(1)
Where
πβ is the Effective input
π₯π is the input of the network
π€πβ is the matrix of weights between input i and hidden node h
25. 12
ο· Step 3
Calculate the outputs of the hidden layer using Equation 2. This uses the log sig activation function as
the inputs and outputs are between 0 and 1.
πβ =
1
1 + πβπβ
(2)
Where
πβ is the vector of outputs from the hidden layer
ο· Step 4
Calculate the outputs of the neural network using Equation 3.
ππ = β(π¦βΓπ€βπ)
π
π=1
(3)
Where
ππ is the vector of outputs from the neural network.
ο· Step 5
Calculate the error between the target and the output of the neural network using Equation 4.
πππππ = π‘πππππ‘ β ππ (4)
ο· Step 6
Adjust the weights between the outputs and the hidden layer using Equation 5 to find the amount that
the weights need to be adjusted by and Equation 6 to update the weights.
βπ€βπ =β (πππππ)Γπβ (5)
π€βπ = π€βπ + βπ€βπ (6)
Where
βπ€βπ is the amount that the weights need to be updated by
β is the learning rate, usually set to 0.5
26. 13
ο· Step 7
Update the weights between the input and the hidden layer using Equation 7 to calculate the error,
Equation 8 to calculate the amount that the weights need to updated by and Equation 9 to calculate the
and update the weights.
πΏβ = πΏ πΓ (β π€βπ) Γ2ΓπβΓ(1 β πβ) (7)
βπ€πβ =βΓπΏβΓπ₯π (8)
π€πβ = π€πβ + βπ€πβ (9)
Where
πΏβ is the error propagated back to the connections between the input and the hidden layer
πΏ π = error
2.12.3 Fuzzy Logic
Fuzzy logic makes use of degrees of truth rather than having Boolean decisions. For example, making
use of fuzzy logic helps generate truth about agents belonging to a number of states rather than strictly
one. A good example of this is having hard logic of whether an object is hot or cold compare to having
fuzzy logic with states that lay between the two, warm, room temperature or cool[24], [27], [29]β[31].
2.12.4 Genetic Algorithms
Genetic algorithms are used for solving constrained and unconstrained optimisation problems. They ae
based upon the process of natural selection, in which only the strongest survive and pass their genetics
to the future generation. Genetic algorithms are used in agent based simulations to get populations that
are more adapted to the situations that occurred in the past. The ability of an agent to survive is measured
by the fitness of each agent. In the context of a financial market, genetic algorithms could be used to
identify which strategies are most suited to which situations in the market [23], [26], [31], [32].
2.13 Fundamental analysis
Fundamental analysis is a method of evaluating the value of a share through company performance and
reactions to economic conditions. Fundamental analysis seeks to understand more about the company
and the actions taken by the company to essentially answer the question βDoes the company make a
good investment?β. [34]
Fundamental analysis is not limited to using purely qualitative or purely quantitative data. News about
a company can usually be helpful in evaluating a company. Quantitative analysis usually includes
27. 14
looking at the companyβs finances to create an intrinsic value of the share. Revenue, debt, dividends,
and company performance ratios are used to measure intrinsic value [35].
The objectives of fundamental analysis are [36]:
ο· To predict the performance of economies that impact a company. This is done because the financial
performance of the company is dependent upon the economy is resides within.
ο· To estimate the intrinsic value of the stock and try to predict when changes in this value will occur.
ο· To select the right time to buy and sell stocks to maximise investment returns.
2.14 Technical Analysis
Technical analysis is the analysis of statistics generated by market activity. These statistics are generally
past prices or volumes traded[37]. The aim of technical analysis is to identify patterns that can suggest
future activity. Technical analysis typically depends on the use of charts patterns, technical indicators,
oscillators or some combination of the above mentioned[38]. Technical analysts believe that charts
show the moods of the crowds and therefore focus on the analysis of mass human psychology.
Emotional risk is inversely correlated to financial risk; Figure 1 below displays the moods associated
with the different price trends.
Figure 8: Moods of the masses according to technical analysis[38]
People are generally motivated by greed and optimism when buying and are driven by fear or pessimism
when selling. It is believed that people formulate scenarios based on their emotional state in order to
rationalise their emotions. Investors will try to sell at the top or as close to the top, and buy at the bottom
or as close to the bottom as possible[38].
28. 15
2.14.1 Trend Analysis
Trend analysis is one of the most important and most used techniques in technical analysis. In trend
analysis, trends are classified according to their direction into three sets; uptrends, horizontal trends and
downtrends. An uptrend is characterised by a series of higher highs and higher lows whereas a
downtrend is characterised by lower lows and lower highs[39][38].
Trends can then be classified into a further set of three; a long-term trend, an intermediate trend and a
short-term trend. A long-term trend is one that last longer than a year, an intermediate trend lasts
between one and three months and a short-term trend is considered to last up to a month. Channel lines
are the addition of two parallel trend lines which act as areas of support and resistance[38].
2.14.2 Support and Resistance Analysis
Support is defined as the price level which the stock seldom falls below and resistance is the price level
which the stock seldom increases above. Support and resistance are governed by the psychology behind
supply and demand. Where the support is the price level which the market is willing to buy at and the
resistance level is the price at which the market is willing to sell at. When the price breaches the support
or the resistance level this means that there has been a shift in the supply or demand curves for the
shares. Once the resistance or support level is breached, itβs role will be reversed, i.e. the resistance
level will become the support level if the resistance level is broken and vice versa for the support
level[39][40].
2.14.3 Volume Analysis
Volume analysis is important to technical analysis because it is used to confirm chart trends and
patterns. In most scenarios, a change in volume precedes a change in price. The exception to this is
when the volume and price relationship starts to deteriorate[40][41].
2.3.4 Pearsonβs Product Moment Correlation Coefficient
Pearsonβs Product moment correlation (PPMC) also referred to as the Pearsonβs correlation coefficient
is a measure of how well two variables are related linearly. It enables the user to know whether fitting
a straight line to the data accurately represents the relationship between the variables in question. The
equation below is used to calculate the coefficient of correlation. A strong correlation is represented by
an r value within the intervals [0.7; 1] or [ -1; -0.7]. Where an absolute value of 1 represents a perfect
linear relationship. A moderate strength correlation would fall within the intervals [0.3;0.7] or [-0.7; -
0.3]. Low correlation is represented with a value within the ranges [0.1;0.3] or [-0.3; -0.1]. No
correlation results in an r value of 0. [1]
29. 16
π =
π(β π₯π¦) β (β π₯)(β π¦)
β(π β π₯2 β (β π₯)2)(π β π¦2 β (β π¦)2)
(10)
π =
πππ£(π₯, π¦)
π π₯ π π¦
(11)
Where
π is the number of observations in the sample
π₯ is the independent variable
π¦ is the dependant variable
πππ£(π₯, π¦) is the covariance between the two variables
π π₯ is the sample standard deviation of the independent variable
π π¦ is the sample standard deviation of the dependent variable
2.15 Kurtosis
Kurtosis is used as a statistical tool to evaluate a probability distribution. Kurtosis describes the shape
of the distribution, more specifically it measures the weight of the tails of a distribution. There are three
states of kurtosis. Mesokurtic describes a distribution with a kurtosis value of 3, which is the same as a
standard normal curve. Leptokurtic distributions have a kurtosis value of above 3, this describes a
distribution with a higher peak than the normal curve and has fatter tails than the standard normal curve.
A Platykurtic distribution has a kurtosis value of less than 3, it describes the distribution as a flatter,
more spread out distribution of the data[42].
Sample kurtosis is calculated using the Equation 12.
πΎ =
π(π + 1)Γ(π β 1)
(π β 2)Γ(π β 3)
Γ
β (π₯π β π₯ ππ£π)
4π
π=1
(β (π₯π β π₯ ππ£π)
2π
π=1 )
2 (12)
Where
π₯π is the ith
value of the dataset
π is the sample size
πΎ is the kurtosis
30. 17
The population kurtosis is calculated using Equation 13
πΎ = πΓ
β (π₯π β π₯ ππ£π)
4π
π=1
(β (π₯π β π₯ ππ£π)
2π
π=1 )
2 (13)
2.16 Skewness
Skewness is the measure how identical a distribution is. A non-zero value of skewness means that the
data is skewed. Sample skewness is calculated using Equation 14.
π =
πβπ β 1
π β 2
Γ
β (π₯π β π₯ ππ£π)
3π
π=1
(β (π₯π β π₯ ππ£π)
2π
π=1 )
3
2
(14)
Population skewness is calculated using Equation 15.
π = β πΓ
β (π₯π β π₯ ππ£π)
3π
π=1
(β (π₯π β π₯ ππ£π)
2π
π=1 )
3
2
(15)
2.17 Normality
Normality is the measure of how data is distributed and if the normal distribution can be fit to the data
significantly. The statistical methods that can be used to test this, are the Kolmogorov-Smirnov Test
[29] (see Equation 16 for test statistic) and the Shapiro-Wilk test (see Equation 17 and 18 for test
statistic) [30].
π = πππ₯|πΉβ(π₯) β π(π₯)| (16)
Where
π is the test statistic used for the Kolmogorov-Smirnov test
πΉβ(π₯) is the data being tested
π(π₯) is the empirical distribution data (data from the normal distribution for normality tests)
π = (
π
π βπ β 1
)
2 (17)
π = β ππ = β π(π β π + 1)(π πβπ+1 β ππ) (18)
31. 18
Where
π is the test statistic for the Shapiro-Wilk test
π is defined by Equation 10
π is defined as a Shapiro-Wilk coefficient
(π β π + 1) is defined as a Shapiro-Wilk coefficient
π₯ is defined as the data from the series being tested
Kolmogorov-Smirnov Test uses p-values to compare the test statistic and to accept or reject the null
hypothesis of the data being normal. The Shapiro-Wilk test uses critical values from a Shapiro-Wilk
table of values to compare the test statistic and conclude if the null hypothesis is accepted or rejected.
2.18 Stationarity
2.18.1 Difference Stationarity
A series with a random walk can be transformed into a stationary process using differencing,
irrespective of whether it has drift or not. [43]
2.18.2 Trend Stationarity
A nonstationary process with a deterministic trend can be transformed into a stationary process by
detrending. [43]
2.18.3 Difference and Trend Stationary
In cases where a random walk with drift and a deterministic trend, stationarity can be achieved through
detrending but differencing needs to also be applied in order to ensure that the variance does not grow
to infinity over time. [43]
2.18.4 Testing for Trend Stationarity and Difference Stationarity
There are two preferred methods for testing for stationarity, these are the Augmented Dickey-Fuller
(ADF) test and the KwiatkowskiβPhillipsβSchmidtβShin (KPSS) test [43]β[48].
2.18.4.1 Augmented Dickey-Fuller Test (ADF)
In the ADF test Equation 17 below is used to represent an AR process [44], [49], [50]
Where πΏ β [0,1], when πΏ is 0 the process is unit root stationary, when πΏ β 0 then the process is not.
The test sets a null hypothesis that the process is unit root stationary.
π»0: πΏ = 0
π»1: πΏ β 0
βππ‘ = πΌ + πΏππ‘β1 + ππ‘ (19)
32. 19
A t-statistic is calculated for the πΏΜ which is the estimated value of πΏ. This test statistic is then compared
to the critical values from the Dickey-Fuller Distribution.
When
π‘ < π·πΉπΆπππ‘ππππ (20)
The null hypothesis is rejected. The π·πΉπΆπππ‘ππππ value can be calculated using Equation 21.
π·πΉπΆπππ‘ππππ =
πΏΜ
ππΈ(πΏΜ )
(21)
2.18.4.2 KwiatkowskiβPhillipsβSchmidtβShin (KPSS) Test
This test evaluates whether a univariate series is trend stationary as the null hypothesis and that it is a
nonstationary unit root process. It does this by first defining the series with Equation 22 below [51][52].
ππ‘ = ππ‘ + π½π‘ + π’1π‘ (22)
ππ‘ = ππ‘β1 + π’2π‘β² (23)
Where
ππ‘ is some random walk process
π’1π‘ is a stationary process
π’2π‘β² is and independent and iid process with a mean of 0 and variance π2
π»0: π2
= 0
π»0: π2
> 0
With the test statistic
ππ‘ππ π‘ =
β ππ‘
2π
π‘=1
π2 π2
(24)
Where
ππ‘ππ π‘ is the p-test statistic
π is the sample size
π2
is the Newey-West estimate of the long-run variance
And
ππ‘ = π1 + π2 + π3 + β― +ππ‘ (25)
33. 20
2.19 Homoscedasticity
Homoscedasticity describes the variance of a series, it means that the variance does not increase with
time[53]. Homoscedasticity can be tested graphically by looking at plots of residuals against actuals. It
can also be tested using the Engle test for residual heteroscedasticity.
2.19.1 Engle Test for Residual Heteroscedasticity
Residuals of the series are defined as in Equation 24
ππ‘ = π¦π‘ β π’Μ π‘ (26)
Where
π’Μ π‘ is the conditional mean of the process
ππ‘ is the residual which is identically distributed with a mean of 0 and variance of 1
π»0: πΌ0 = πΌ1 = πΌ2 = β― = πΌ π
π»1: ππ‘
2
= πΌ0 + πΌ1 ππ‘β1
2
+ πΌ2 ππ‘β2
2
= β― = πΌ π ππ‘βπ
2
+ π’ π‘
Where
π’ π‘ is a white noise error process
The null hypothesis tests that series is not heteroscedastic. The test statistic is found by using the F
statistic for regression on the squared residuals, and the critical value is found in the π³2
distribution
using m degrees of freedom and the required significance[54][55].
2.20 Random Walk Hypothesis
2.20.1 Pure Random Walk
A pure random walk is defined by the equation
ππ‘ = ππ‘β1 + ππ‘ (27)
Where
ππ‘ is white noise
ππ‘ is the series value at time t
ππ‘β1 is the series value at time t-1
White noise is stochastic; this means that this series will not become mean reverting as the variance will
evolve over time. The variance of the series will tend to infinity as time tends to infinity. This is a
difference stationary process[43].
34. 21
2.20.2 Random Walk with Drift
This series is defined by the equation below
ππ‘ = πΌ + ππ‘β1 + ππ‘ (28)
Where
πΌ is the drift term in the series
This series too has a variance that is dependent on time and hence is not mean reverting. This is a
difference stationary process. [43]
2.20.3 Deterministic Trend
This is defined by the equation below
ππ‘ = πΌ + π½π‘ + ππ‘ (29)
Where
π½π‘ is the deterministic trend
This series although it looks similar to that of a random walk with drift is different as it is a regressed
series of the time trend π½π‘. A nonstationary process with a deterministic trend has a mean that grows
around a fixed trend which is constant and independent of time. This is a trend stationary process. [43]
2.20.4 Random Walk with Drift and Deterministic Trend
This series is described by the equation below
ππ‘ = πΌ + ππ‘β1 + π½π‘ + ππ‘ (30)
This series has both a drift component and a deterministic trend. This is both difference and trend
stationary. [43]
2.21 Related Studies
2.21.1 Chan et al. 1999
Chan et al. constructed a simulation of a double auction market. The simulation modelled the complex
interactions between artificially intelligent traders. The traders had varying degrees of learning
capabilities. The price efficiency, speed of price convergence to rational equilibrium, dynamics of
wealth distribution amongst the AI trade, trading volume and the bid ask spread were monitored during
the simulation in order to tell how accurately the simulation modelled the market behaviour.
In the breakdown of the problem, Chan et al. created four major components for the simulation. These
were the economic environment, the trading systems, the types of the traders and the learning
mechanisms. The traders were also split into three groups, Insiders, partially informed and the
uninformed trader.
35. 22
The trading mechanism used was a simple double auction market, within which agents could only
submit bids and asks. The prices of subsequent bids, had to be higher than the current bid and asks had
to be lower than the current asks. The agents were also restricted to the trade of a single share at a time.
Traders were assumed to be risk neutral, and agent maximised their end-of-period expected values of
their portfolios by forecasting the liquidating dividend. The agents then bought when market prices
were low relative to their forecast and sold when market prices were higher than their forecast. Chan et
al. also created three types of traders, empirical Bayesian traders, momentum traders and nearest
neighbour traders. Each of these had different learning mechanisms.[56]
2.21.2 Preyen Nair 2014
Nair created an agent based simulation of the trading of a single share on the JSE. As part of the scope
and requirements, Nair had to design a double auction market according to the specifications used by
the JSE for creating their order matching engine. Auction periods and hidden order were outside the
scope of the model created.
Nair split up his model into three components and focused on completing these before moving on. These
components were; the orders, order processing engine and the order book. These three components were
central to his design. The orders had to validated and work in the system that he created. Upon
completion of the three components, agents were developed. The logic that was used to model the agents
decisions to buy, sell or hold was based on the risk and return of the transactions. Table 1 below
summarises the logic used to create the decisions for each agent.
Table 1: Agent logic for price, logic and order types[2]
Where
p is the price level aq
t is the best quoted ask price
bq
t is the best quoted bid price P*
is the agents comfort price level
Si
t is the current stock portfolio of agent i at time t
pM is the upper value that the agent is comfortable paying
ο°i
(p) is the demand function at p for agent I
pm is the lower value that the agent is comfortable paying
36. 23
3 HIGH LEVEL PRODUCT REQUIREMENT SPECIFICATION
3.1 Requirements
ο· Behaviour matches market behaviour
ο· Outputs share price information as a time series.
ο· Uses agent-based simulation
ο· Uses input data for agents to make decisions with
3.2 Constraints
ο· All agents are rational
ο· A single share will be used in the model
ο· Assumptions could make the model less realistic
ο· Difficult to identify and quantify all the drivers for price
3.3 Criteria
ο· Accuracy of prediction
ο· Data Presentation and collection
ο· Ease of use
ο· Speed
ο· Realistic behaviour
ο· Ease of creating the concept in Anylogic.
ο· Modular building and interactions
3.4 Assumptions
ο· All agents will be rational
ο· Agents will only transact with the cash that they have and no borrowing of money will be
allowed
ο· Prices will not be less than zero
ο· Intraday factor values will be created by using a uniform distribution between the upper and
lower values for the day.
ο· Only one share will be traded
ο· A set number of agents will be within the market (there are no new entities entering the market
or any leaving)
37. 24
4 CONCEPT GENERATION
Before concept generation, it is important to survey literature to see what has been done and how it was
done previously. In doing this it was found that when creating an agent based model the following are
considered[13], [20], [57]β[61], [33], [62], [63].
1. Agent Learning
Learning in the models generally include genetic algorithms and neural networks in order for
each agent to change over time and adapt to the situation that they are in. The learning is applied
to agentsβ decisions to buy, sell or hold shares, as well as decide what price the share is worth
or even which share to buy. These would usually be used in conjunction with different strategies
of trading. Some models use strategies like technical and fundamental trading while others use
maximisation of utility or portfolio values.
2. Zero-Intelligence traders
Zero-intelligence traders are traders who buy or sell randomly in the market with some
constraints attached to them, Farmer et al explain that zero-intelligence agents are able to
explain stylized facts on the London Stock Exchange. One of these facts being allocative
efficiency, also known as Smiths Invisible hand, which guides the market toward an
equilibrium price based on the supply demand and the price.
3. Minimal Rationality
This follows the argument that not all agents act in the interest to maximise their portfolio, and
in trying to model the market realistically, needs to be considered.
4. Replication of Stylized Facts
When building a model, there are various checks to see how realistic the model is, these checks
are done by looking for certain characteristics within the data. Characteristics such as non-
normal return distributions (described by a kurtosis greater than 3 or a Jarque-Bera test with a
p-value of 0), volatility clustering of returns, high and persistent trading volumes, and the
existence of technical trading.
5. Trading Logic (Technical traders, Fundamental traders or a combination of both)
6. Double Auction Markets
Many models use this method to create the value of the shares, the process consists of buyers
and sellers submitting bids for a share at a price they value it at, the auctioneer would then select
a price that clears the market.
7. Matching Engines
The order matching engine allows for each order to be matched by price and preference
(decided by first in first out or other such queuing criteria).
38. 25
Before the concept creation, Anylogic was used to create a few sample models to better understand the
problems that would be faced when trying to create the model. Some of the problems found were;
ο· Creation of an order book that each agent can read and then value the share
ο· Using the shares like resources, as it made it difficult to attach the shares to the agent if agents
just sent orders instead of standing going through a queuing system.
ο· Creating a population for orders and ensuring that information is copied from agent to the order
as well as keeping count of the orders and which order belonged to which trader.
ο· Creating new agents that enter the trader population and having some leave too. This created a
problem as this could create a time varying total number of shares in the market.
To deal with these problems various solutions were tried, Concepts 1 to 3 shown below solved most of
the problems. It is also important to note that due to time constraints the model will need to be
simplified. Although simplified, the model will be flexible and will be able to be developed further and
could be seen as a base for future work.
39. 26
4.1 Concept Creation
In Table 2, each concept is defined by the components that will make up the design, each component
can be made modularly and then the whole concept put together. Agent logic describes how the trader
agent creates different actions under the given scenarios. The trading system is the component that
allows for the bids and exchange of the share to occur. The evaluation of the share price would be a
subcomponent of the agent logic as this is what is used to decide what price the trader is willing to pay
according to the factors given. Intrinsic value is what the agent is willing to pay at maximum when
buying or receive at minimum when selling.
Table 2: Concept Creation Matrix
Concepts
Agent
Logic
Trading
System
Valuating
Share
Price
Intrinsic
Value
Buy/Sell/Hold
Decisions
Matching
Orders
Concept
1
State
Chart
Agent
Based
According
to Intrinsic
value
Uses linear
regression
Price based
Decision by
entity
responding to
message and
FIFO
Concept
2
State
Chart
Modelled
as
Queueing
According
to last sold
Uses linear
regression
Demand/supply
based
Modelled as
Queuing
Concept
3
State
Chart
Modelled
as
Queueing
According
to last sold
Neural
network with
scaling using
supply
demand ratio
Demand/Supply
and Price based
Modelled as
Queuing
40. 27
4.1.1 Concept 1
This concept tries to function as an agent only model, making use of only the agents logic and trading
occurs through communication between agents directly. It uses the state chart to define its behaviour
entirely. The biggest foreseen problem with this concept is the messages the sellers continue to send,
this could affect the speed of the simulation as this means there would be more event occurring at any
given time. Figure 9 below shows the state chart and the logic within each state. This logic is still basic
as this is still a concept.
Figure 9: Concept 1 Flow Chart
41. 28
4.1.2 Concept 2
This concept makes use of a queuing system to handle the exchange and matching of shares. The order
agent is sent to the queue with the details of the transaction, like the quantity and price. This method
also requires there to be a resource used for the shares. Figure 10 shows the state chart that will be used
in this concept, notice that it is similar to that of Concept 1, although this does not have as many
processes within the states. Figure 11 shows the queuing systems proposed for this concept.
Figure 10: Concept 2 Agent State Chart
Figure 11: Concept 2 Activity Cycle Diagram
42. 29
4.1.3 Concept 3
This concept uses a very similar state chart to the first two concepts, although there are more ways for
an agent to enter into the buy or sell state, as can be seen in Figure 13. Figure 14 shows the queuing
system to be used in the model, note that in this concept no agents will leave the queuing system, the
agents will be moving from state to state and while doing that will be moving in the queuing systems
according to their state.
Figure 12: Concept 3 Agent State Chart
43. 30
Figure 13: Concept 3 Activity Cycle Diagram
4.2 Concept Selection
Each concept is rated out of 5 for each of the judging criteria, note that the accuracy of the concept is
uncertain at this stage and can only be measured accurately after the model is completed as this is a
complex system. There is a chance that the observations after the model has been complete may deviate
from these ratings. As a result of this, flexibility of the model has not been added as one of the judging
criteria. All criteria will however, be kept in mind while creating the chosen concept. Extra steps will
be taken to try to ensure that the criteria have been kept at the level expected. Table 3, rates each concept
and compares them amongst each other.
Table 3: Concept Rating Table
Concepts
Data Presentation
and collection
Ease of
use
Speed
Realistic
behaviour
Ease of creating
in Anylogic
Totals
Concept
1
4 4 5 2 2 17
Concept
2
4 4 3 5 2 18
Concept
3
4 4 3 5 3 19
44. 31
ο· Data Presentation and collection
Data presentation and collection is defined by the ability to gather important information about
the model and convert it into graphs or other means of summarising the data. This would be
easy for each concept due to Anylogic being simple to use for information and statistical
gathering. The log function allows one to see in what order events are occurring. The dataset
functions allow for quick gathering of statistical data throughout a time series.
ο· Ease of use
The ease of use of the model is defined by the ability of the user to change the parameters to
better suit the scenario they are trying to create. In Anylogic these changes can be made easily
by creating either sliding bars, buttons, radio buttons, and other GUIs. The change of the data
that is needed for the environmental factors would have to be done using the databases that
have been imported from excel files. All concepts would score high on this due to the ease of
use of Anylogic.
ο· Speed
The speed is defined as the time it takes to run the simulation. This would vary according to the
method used. For example, running an agent-based simulation with lots of agents and with
complex interactions may take longer than a normal discrete time simulation. Concept 1 would
be faster than the other concepts due to the simplicity of the model. Concept 1 would use purely
agent based simulation, and transactions would occur almost instantly due to the auction
method coupled with FIFO for matching the orders. Concepts 2 and 3 are hybrid models, the
agent exists within a system while making decisions based on the environment, for this reason
these two models would take longer than the first.
ο· Realistic behaviour
The behaviour of the model would need to come close to that of the interactions in reality (with
some simplifying assumptions). There are a few stylised facts that could be simulated using the
model. The main aim is to have traders buy and sell according to supply and demand while
changing the price accordingly. Model 1 is a simple solution which bases the decisions on
whether the agent wants to accept an offer or reject it. Model 1 uses linear regression to evaluate
the intrinsic value and then if the offer is god enough it is accepted. Model 1 has one major
flaw; it only has the sellers sending out offers and the buyers react to that. For this reason, it is
not as realistic as the other two models. Model 2 also uses linear regression to create the intrinsic
value, this could lead to incorrect calculation of the shareβs intrinsic value. This makes Concept
3 the best in this category.
45. 32
ο· Ease of creating the concept in Anylogic
Concept 3 seems to be the easiest to create as the potential problems are less. Some of the
foreseen major problems for each concept are as listed below;
Concept 1
ο§ Selecting which agent sent the message to the agent who is selling first.
ο§ Sending an offer to buy the share to a specified agent.
ο§ Creating the trade between the two agents
ο§ Telling the agents when the seller has found a buyer.
ο§ Selecting which selling agent will be selected or ignored while there are many sellers
ο§ Selecting an agent when there are multiple offers to buy, at the same price at the same time.
Concept 2
ο§ Creating an order as an agent and sending this as a message which has been fully
customised according to the expiry time, price, volume.
ο§ After the order seizes the share (in the buying case), there would be a problem of attaching
the share to the trader who created the order.
ο§ Orders will be destroyed when they leave the queuing system
ο§ Selling orders would need to be attached to shares when entering the system
ο§ Orders are randomly chosen to be used by a trader, this could mean that the possibility of
leaving all shares attached to the order for each trader.
Concept 3
ο§ Creating the neural network in Anylogic
ο§ Matching orders according to the price
ο§ Having entities from a specific a population enter the system and interact with the system
according to the decisions the agents make
Concept 3 has been chosen to continue further development as it is rated the best out of the three
concepts created, as seen in Table 3.
46. 33
5 THE DESIGN PROCESS
The design process used in creating this model followed the steps listed below.
1. Literature search on how other similar models were created.
2. Break down the problem into a number of smaller problems and start finding ways to solve
each problem.
3. Create basic flow charts of how each solution can be modelled.
4. Create simplifying assumptions.
5. Try to create a basic model to find the difficulty areas.
6. Create concepts to get around the problem areas.
7. Choose a concept.
8. Develop the concept.
9. Iterate steps 1 until 8 until a possible way to model each system is found.
10. Test the model and debug.
11. Validate the model components.
12. Validate the model as a whole.
The bottom-up approach was used to design the model, this entails modelling the agents behaviour and
their interaction first. The model was developed in the order listed below. Note this is a not an
exhaustive list as there are too many components to be listed individually.
1. Create the agents and their attributes.
2. Create their states and ensure that they are able to move between states.
3. Create the queuing system and ensure that agents can move around in it according to their states.
4. Create the intrinsic value algorithm (basic).
5. Create the share price and intrinsic value comparison method.
6. Ensure that agents can change states according to the intrinsic value and the share price.
7. Ensure that the correct number of shares and cash are traded.
8. Create databases for each factor.
9. Create a schedule for each factor to change according to the day.
10. Create the neural network function.
47. 34
6 DESIGN DEVELOPMENT OF THE MODEL
The simulation has been broken down into 2 main subsystems. The subsystems are the traders and the
trading platform. Each of these needs the other to perform. The basic idea the concept should follow is
that the agents will be in the observe state initially. While in the observe state the agents will watch the
share price, they will then compare the share price to an intrinsic value. On comparing the share price
to the intrinsic value, the agent will decide whether or not to buy or sell. The agent will buy if the share
price is lower than their intrinsic value and sell if the share price is higher than their intrinsic value.
Upon making this decision, the agent will then be sent to the trading platform to trade with another
agent. The trading of the share will only occur if the price an agent is willing to sell is less than the price
the other agent wants to buy at, i.e. their price ranges must overlap. Upon doing this the agents are
matched and carry out the transaction. If one of the agents has a greater number of shares to transact,
that agent will return to the queue to be matched again, this will continue until the agent has no more
shares that they want to buy or sell. The design specifications for each component will follow under
Sections 6.1 and 6.2. Each of the subsystems will then be further broken down into the respective
components.
6.1 Agents (Traders)
The agents used in this model are only one set of traders, these traders all act to buy or sell. There are
no holding periods for the agents of this population. The only time that the agents stay within the observe
state is when the trading day has ended. Note that these traders will only trader if they perceive a as
share worth buying or selling (there is some sort of benefit that they can receive from trading). A further
population of agents could easily be generated and the frequency of transacting could be changed. The
current population are high frequency traders. In Section 6.1.1 the product requirement specifications
are listed for the creation of the agents. The agent design is split into four components namely, agent
decisions to buy or sell, agent intrinsic value creation, agent logic and the agent attributes.
6.1.1 Product Requirement Specification
6.1.1.1 Requirements
ο· Agents must be able to buy and sell shares
ο· Agents need to be able to determine when to buy shares and sell the shares they hold
ο· Agents need to be able to determine what price the shares are worth intrinsically
ο· Agents need to have different levels of income
ο· Agents will need to interact with each other when sharing information
6.1.1.2 Constraints
ο· Agents cannot have negative amounts of shares
ο· Agents cannot borrow money to buy more shares
ο· Agents have to place an order and wait till the trading system matches the order
48. 35
6.1.1.3 Criteria
ο· Agents are able to valuate a share price according to environmental factors
ο· Agents are able to buy a share when required
ο· Agents are able to sell a share when required
ο· Agents can interact if required
ο· Agents receive a fixed income every month
ο· Agents are able to act individually
ο· Ease of use in Anylogic
ο· Model created needs to be flexible.
6.1.2 Concept Development and Specification
In this section the various subcomponents of the agentsβ design will be detailed further.
6.1.2.1 Agent Parameters
Agents have various factors as attributes such as;
ο· Money held.
ο· Selling, holding or buying.
ο· Number of shares held.
ο· Expiry.
ο· Maximum price willing to buy at.
ο· Minimum price willing to sell at.
ο· Waiting in queue (Binary 0 meaning that it is waiting in a queue to transact, 1 meaning it is not).
ο· Forecasted price.
ο· Learning rate for neural network.
ο· Weights for neural network.
ο· Biases for neural network.
ο· Current time.
ο· Exited (This attribute says whether the agent has left the trading or not).
ο· Trading hours (this attribute tells the agent how long the trading should occur for).
ο· Transaction (Transaction =0 if in observe state, Transaction=1 if in waiting to buy state and
Transaction=2 if in waiting to sell state).
49. 36
6.1.2.2 Agent Logic
In Figure 14, the logic for the agent state changes as well as the logic for the entry and exit of the
queueing system is shown. Note that there are three more states than with the concepts. The states that
were added, are there for the transitions between the observe state and the buy state as well as between
the observe state and the sell state, these two were added to create a visual validation that agents are
buying, selling or waiting to carry out those transactions. The third state, called the return state in Figure
15, is there to ensure that when the buy or sell button is pressed agents enter and change their colour to
black. This too is for a visual validation of the buy and sell buttons.
When an agent is moving from the observe state to the waiting to buy state, it has to meet the condition
that the cash it has is greater than the cost of the number of shares the agent wishes to purchase. This
constraint ensures that the cash an agent has is never negative. When an agent is moving from the
observe state to the waiting to sell state, it must meet the condition that the agent must be holding more
shares than it wants to sell. This constraint ensures that the agent is always holding a non-negative
number of shares. Both transitions require the condition that it must be trading hours to move from the
observe state. Outside of trading hours all agents will not flow into the waiting to transact states.
51. 38
6.1.2.3 Agent Decisions to Buy or Sell
While agents are in the observe state, they need to evaluate whether they want to buy or sell. The logic
in Figure 15 shows what the process for deciding to buy or sell entails. This logic is basically checking
if the share price is greater than or less than the intrinsic value the agent has for the share price. If the
intrinsic value is greater than or equal the share price, the agent will sell. If the intrinsic value is less
than the share price, the agent will buy.
Figure 15:Flowchart for Decisions to Buy or Sell
52. 39
6.1.2.4 Agent Intrinsic Value Creation
In Figure 16 below, is the general flow chart for the creating of intrinsic value of the agents in the
population trader. The data is scaled linearly according to the maximum and minimum data of each
daily data set for the past 5 years. After scaling the data, it will be between 0.2 and 0.8, this was done
to account for data going below or above the historic data. After the neural network, the data is scaled
back into the share price data. From this point the share price is then scaled according to the supply and
demand with Equation 31 and Equation 32 below.
πππππππππππππππππ΄π‘ = IntrinsicValueΓ (1 + (
(ππππ’πππππ΅π’π¦ β ππππ’ππππππππ)
10000 β ππππ’ππππππππ
)) (31)
πππ₯ππππππππππ΅π’π¦π΄π‘ = IntrinsicValue β (1 + (
VolumeToBuy β VolumeToSell
10000 β VolumeToBuy
)) (32)
Figure 16: Flowchart of the general logic for creation of Intrinsic Value
In Figure 17, the flow chart for the neural network function created in Anylogic is shown. The neural
network function is adaptable to the number of hidden nodes without changing anything but the weights.
The weights that are used in to function were trained in Matlab before being used in Anylogic. This is
important as the training needed to be done for the agents to have accurate relationships between the
factors input and the share price.
Start Neural Network
Rand:
Euro
Rand:
Dollar
Platinum
Price
Scale data
Scale Output
Create randomness by
using a normal distribution
Adjust according to
Demand and supply
End
53. 40
Figure 17: Flowchart of the Feedforward Back Propagation used to create a function in Anylogic
Start Declare Variables h<3
Effective Input
Calculation
h=0
i=0
True
i<3
True
S[h]+=X[i]*Wih[i][h]
i+=i
False
S[h]+=bih[h]
h+=1
False
OutputFrom
HiddenLayer
Calculations
h=0
h<3
True
Yh[h]=1/(1+math.exp(-S[h])
h+=1
Summation Into
Output Node
Calculations
h=0
h<3
True
Yo=(Who[h]*Yh[h])+
bho
h+=1
False
Error=Target-Yo;
Changing Weights
between Output and
Hidden Layer
h=0
h<3
True
DeltaWho[h]=LearningRate*Error*Yh[h
Who[h]+=DeltaWho[h]]
h+=1
False
Error for
Weights
between Input
and hidden
layer
calculation
h=0
h<3
True
AltError[h]=2*error*Who[h]*Yh[h]*(1-Yh[h])
h+=1
False
Update
Weights
between input
and hidden
layer
h=0
i=0
i<3
True
h<3
True
DeltaWih[i][h]=LearningRate*Alterror[h]*X[i]
Wih[i][h]+=DeltaWih[i][h]
h+=1
False
i+=1
False End
54. 41
Figure 18 shows the neural network that was used in creating the intrinsic value using the factors,
platinum price, Rand-Euro and Rand-Dollar exchange rates. The neural network was trained using
1250 data points with 60% being used for training, 15% for testing and 25% for testing. After training
the weights were exporting into Anylogic and used in the neural network function created. The neural
network will be attached in the digital appendix.
Figure 18: Structure of neural network used in Matlab
Figure 19 shows the relationship between price and quantity as the demand increases. In this case as
the quantity demanded increases the price increases proportionally. This proportional increase is given
by Equation 33 and 34 below.
π π·π‘
= π π·π‘
π π·π‘
+ π π·π‘β1
(33)
πππ‘
= π ππ‘
π ππ‘
+ πππ‘β1
(34)
Assuming that the price is highly elastic and after a few iterations trying to get the price within a more
realistic range, the price elasticity was then used as 10000 as seen in Equations 31 and 32. Price
Elasticity is related to the volume and price through Equation 35
πΈ =
(
π π‘β π π‘β1
π π‘β1
)
(
ππ‘ βππ‘β1
ππ‘β1
)
(35)
55. 42
Figure 19: An Increase in Demand [64]
When the quantity supplied surpasses the quantity demanded the price will decrease to reach
equilibrium, if the price supplied is higher than the price demanded the quantity demanded will reduce
and reach equilibrium. This equilibrium is also known as allocative efficiency.
6.1.2.5 Overreaction in market
Figure 20, shows the logic used to create the overreaction in the market using two buttons, buy and
sell, these buttons send the agents into a state of βpanicβ in which they all want to buy or sell.
56. 43
Buy
On Press
delivertoallagentsInside( BuyNotSell
Transaction>0
Agent Receive
Message
SendToRandom( Buy
Transaction==1
True
True
False
Expiry=0
Exit==1
False
Agent Leaves State
and moves to
observe state
True
Agent Enters Buy
State on receiving
message buy
End
End
Sell
On Press
delivertoallagentsInside( SellNotBuyl
Transaction>0
Agent Receive
Message
SendToRandom( Sell
Transaction==2
True
True
False
Expiry=0
Exit==1
False
Agent Leaves State
and moves to
observe state
True
Agent Enters Sell
State on receiving
message Sell
End
End
Expiry=0
Timeout
On Timeout
Exit==1
End
Figure 20: Flowchart of The Logic Used for The Buy and Sell Buttons Which Are Used to Represent an Overreaction in The Market
57. 44
6.1.3 Validation
The validation has been split into 3 sections, namely; agent decisions, agent logic and agent intrinsic
value creation. This has been done to validate that each component works as required.
6.1.3.1 Agent Logic
Validation that changing of states occur
To validate that agents are able to move between states, a count of the number of agents within each
set is done at 1 second intervals as seen in Figure 21 below. The blue lines represent the agents within
the sell state, the green represents the agents within the buying state and the purple represents the
agents within the observe state. Note that this data was collected from running the simulation with
trading hours set between 8:00 am and 9:00 am and therefore the trading occurs until around 3600
seconds.
Figure 21: Validation that Changing of states occurs
Validation that share price is always positive
The share price as in reality should not decrease to zero or less as this would mean that a company is
giving shares out for free or paying people to buy the shares. This needs to be validated to ensure that
the model prices meet that requirement. In Figure 22, it is seen that the share price falls to a minimum
that is greater than 2900 cents. It can also be seen that the mean of this series does change over time by
looking at the gradient of the mean line as well as the small spikes at certain points.
58. 45
Figure 22: Validation That the Share Price is Never Below Zero
Validation that number of shares held is positive
One of the assumptions held in this model is that the number of shares that an agent can hold cannot be
less than 0. This is a practical assumption that ensures that no credit trading occurs. In Figure 23, the
minimum number of shares that any agent in the population trader holds is never less than zero.
Figure 23:Validation That the Minimum Amount of Shares an Agent Can Hold is Zero
59. 46
Validation that cash held is always positive
Another assumption that ensures that no credit trading occurs, is the assumption that the minimal cash
that an agent holds cannot go below zero. In Figure 24 is a graph of the minimum cash that any agent
holds in the population trader over time. It can be seen that the smallest value that an agentsβ money
goes to is 80000 cents. One could argue that due to the large amount of starting cash and a short run
time, the agents donβt get the chance to spend all their cash. To show that the cash does not go below
zero, a simulation was run with the starting amount of cash set to 0 for each agent. As seen in Figure
25, the minimum stays at zero and never goes below.
Figure 24:Validation That Cash held is Always Positive
Figure 25:Validation That Cash Never Goes Below Zero
60. 47
Validation that the number of shares in the system stays constant
The assumption that the total number of shares in the market is conserved and will neither grow nor
decrease over time also needs to be validated to show that this does not cause any price fluctuations. In
Figure 26 below depicts the constant number of share in the market for the simulation running for 3600
seconds.
Figure 26: Validation That the Number of Shares in The System Stays Constant Throughout
Validate that agents can leave their states on the message buy or sell
Buy and sell buttons were created to show how the model would simulate an overreaction in the market,
over reaction caused by events that make the traders want to buy or to sell. Figure 27 shows the what
states the agents are in before the buy button is pressed, note that the pink represents the buying state,
the red represents the selling state, green represents the waiting to buy state, the blue represents the
waiting to sell state and the yellow represents the observing state. Figure 28 shows the population states
after the button has been pressed, note that there are agents which have turned black, this means that
the agents have left their selling states and are leaving to move to the waiting to buy state. The black
colour could be seen as the agents moving into a panic state. On entering this βpanicβ state, agents send
messages to random agents telling them to buy the share.
Figure 29 shows the agents before the sell button has been pressed, note that there are no black coloured
agents, this means that there are no agents in the βpanicβ state before the sell button was pressed. Figure
30 shows the agents leave their states and enter a panic state and start sending messages to random
agent to sell their shares. The black colour acts as the validation that the agents are performing the
require action upon pressing the button.
NumberofSharesinMarket
61. 48
Figure 27: Screenshot of Simulation Before Pressing Buy Button
Figure 28:Screenshot of Simulation After Pressing Buy Button
62. 49
Figure 29: Screenshot of Simulation Before Pressing Sell Button
Figure 30: Screenshot of Simulation After Pressing Sell Button
63. 50
6.1.3.2 Agent Decisions to Buy, Hold or Sell
Validation that the price changes according to the supply and demand for the share
In order to validate that the price changes according to the supply and demand quantities of the share,
buttons were created to change the values of the volumes demanded and supplied. These buttons are
called βBuyNowβ and βSellNowβ. Figures 31 and 32 both have four graphs each, the graphs on the top
represent the share price series, the graphs at the bottom represent the volume to buy and volume to sell
series. The graphs on the left are prior to pressing the respective button and the graphs on the right are
the graphs post pressing the buttons.
In Figure 31, it can be seen that after pressing the button, the share price series started to have higher
highs than prior to the pressing the βBuyNowβ button. In Figure 32, it can be seen that the share price
has lower lows after pressing the βSellNowβ button. While doing this, it was observed that the
relationship is complex, due to agent buying the moment the share price is lower than they expect or
selling the moment the share price is higher than expected. Pressing the button that increases the number
of sellers, results in a decrease in the price which then results in an increase the number of buyers.
Whereas pressing the button that increases the number of buyers, results in a higher share price which
then results in an increase in the number of sellers. The price reaches equilibrium fast and as such the
overreaction or underreaction in the market creates a small impact on the market in the model.
Figure 31: Screenshot of simulation before (left side) and after (right side) pressing Buy Now button