TimeFork For Stock Market Data
For information related to our user study, please look into the user-study branch.
[Please note that this repository is not being maintained. Contact the developer for updates.]
TimeFork is a technique for interactive prediction of time-series data. To showcase this technique, we developed a stock market analytics tool (StockFork) using data from the Yahoo Finance API. With TimeFork, you can predict the future of stocks through an interactive dialogue with the interface (through 3 steps).
- The interface first provides prediction suggestions for each stock based on its past trends (temporal predictions).
- Based on these suggestions and other stock market data, an analyst can interact to make his/her own prediction for one or more stocks.
- Following the analyst's interactions for specific stocks, the interface recalculates the predictions for other stocks (conditional predictions). In essence, this step answers "what if" questions that an analyst can have. For example, what if Tesla increases by 5% over the next ten days. The dialogue goes back to Step 1 or 2 after this.
The analyst can go through these steps iteratively till he/she has enough information to make a decision regarding investment in the stocks.
In this repository, we provide two main things for developers and researchers interested in contributing to this project.
The "master" branch contains our implementation of the stock market analytics tool, StockFork, including its server and client components (described below).
The "user-study" branch contains the implementation including the code and data specifically used for a user study conducted to understand if TimeFork is successful at improving the predictions and when/how it does do.
Beyond the implementations, our repository also offers sample stock market data in public/data/ folder and the corresponding trained neural network files (containing fitted weights) in public/data/train/.
Evaluation: User Study
For implementations, data, and training files specific to our user study, take a look into the user-study branch.
npm installto install dependencies.
node app.jsto start the application at port 3000. Now, you can try it out by opening
localhost:3000in your browser.
To support the TimeFork technique for stock market prediction, we used neural network models for temporal and conditional predictions. More specifically,
The temporal predictions (predictions based on past performance of a stock) are generated using a multilayer perceptron (one model per stock) trained on sets of past 6 relative stock price changes (input) to predict the future change. This model had five layers: input layer of 6 neurons, hidden layers of sizes (50, 60, 70), and an output layer of one neuron, with Sigmoid activation function. The models are trained on historical stock market data using the standard backpropagation algorithm. Alternative predictions for each temporal prediction are generated by changing one or more input values by a 10% fixed margin. This model is implemented using Brain.
The conditional predictions (predictions for a stock based on a trend for other stocks) are generated using a self-organizing map trained on all co-occurrences in the dataset (e.g., Apple and Tesla increased by a 5% and 3% relative change respectively on a particular day). The neurons in the model capture these co-occurrence patterns and are clustered. So, we can easily look up the SOM neurons to find the ones matching a particular prediction from the analyst and generate conditional predictions for others (e.g., if the analyst says Apple might increase by 5% in the next 3 days, what will happen to Tesla?). This model is implemented using ML-SOM.
The client interface provides overview and detail visualizations for stock market data built using D3. It also accesses the trained neural networks (recreated from the JSON files) and provides prediction suggestions while supporting user interaction.
How to use
Please watch our video demo for this prediction tool.
To learn more, visit the wiki.