Git Product home page Git Product logo

stockpricefluctuations's Introduction

A Percolation Model of Stock Price Fluctuations

This project is based on the paper written by Tanaka Hisatoshi.In his paper, he wrote that the Gaussian model predicts that in order for NIKKEI 225 to experience change more than 7% for 6 occasions, it would need 2000 years, but in fact, the same scenario happened in just 11 years. The author then showed that by assuming that traders have bounded sight, and by using percolation theory, such phenomena can be explained.This project applies data from S&P 500 to the model.

Theory

For the model I have programmed, I first created a 2D torus L*L and then filled it with 1s and 0s randomly. One signifies that at that site, a trader holds a particular stock and zero means the trader does not hold that particular stock. Then it proceeds to calculate the influence rate PU and PD. PU and PD is a function of closing price, ๐›ผ and ๐›ฟ. The value of ๐›ผ and ๐›ฟ were calculated by equating ๐‘๐‘ข (๐‘†ฬ…) = ๐‘๐‘‘ (๐‘†ฬ…), this equation requires the average price, minimum price and maximum price. Based on the average annual return rate for S&P 500, I made and educated guess on the maximum price and set the current price as the minimum price. Since the author did not mention how the values were obtained, I reversed the process by finding the floor and ceiling price before running the simulation. After calculating the influence rate. A random number will then decide which influence rate to use. The influence rate will be either PU or PD, if it is PU, the trader at a chosen site will buy and affects its neighbor and opposite for the other case. A random site (can be viewed as a trader) will then be chosen, if at the chosen site, the value is 0, the program will then find another site until the value found at a site is 1. The trader at that site will buy or sell, the probability that its neighbor will follow his or her action depends on the influence rate. This process will then spread to the neighbors. At the end of the process, the number of people influenced will directly affect the return per day calculation. If the influence rate is PU then the return per day will be positive if its equals to PU, the influence rate will be negative. The return per day calculated will produce a new value for the price; this new value for price will then be used to calculate the PU and PD value for the next day. For more information about the theory please read the review paper or the original paper.

Usage

To run the program, download it, and run it using MATLAB.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

stockpricefluctuations's People

Contributors

zhuohann avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.