Wednesday, July 25, 2018

Finance Prediction for Humans.

Introduction and Goals
KöbyFinace is a small frontend for Stocker. A module that is used for stock, securities analysis, and prediction using a variety of algorithms as well as machine learning. However, the stocker module hasn't been updated to python 3 and pandas 2019, so I took it upon myself to update it to the best of my ability.
First use.
You are greeted with a CLI that prompts you with four options.
1.     Analysis of one stock.
2.     Download the latest data and analyze that stock.
3.     Analysis of all stocks.

4.     Download the latest data and analyze all stocks.
(fig 1. Home Screen)
Making Predictions one a stock.
Select Option 1 When making a prediction of one stock, you must specify the ticker to analyze. In this case, we previously downloaded a csv file corresponding to each ticker on the S&P 500, (e.g. AMZN for Amazon Inc.). If you need to download the latest daily stock values as a csv. Select Option 2 instead. You can download the latest daily stock market values from AlphaVantage’s API or Quandl’s API.

NOTE: Quandl only sends data upto the latest fiscal quarter. I prefer AlphaVantage because it is more current.
(fig 2. Selecting Option 1 and specifying a ticker.)

When selecting Option 1 the stock’s ticker, its respective CSV file will be read and the following processes can begin:

      0.   Simple, Graph the history to the stock in both price and overall demand.

Plot the [High, Close, Low] stock prices for the last 90 days. (Short Term)
Plot the [Volume, Daily Change] stock demand for the last 90 days. (Short Term)
Basic, CPU intensive analysis of the stock.

Checkpoint Date Analysis: Calculate the most optimal point in times to buy or sell the shares. Taking into account search trends and public perception of a company. (AKA Sentiment Analysis.) [NOTE: Search functionality doesn’t work at the moment.]

Buy and Hold: an implementation of the Buy and Hold Method of trading in the market. Simply wait x Days before selling. [NOTE: Buy and hold doesn’t graph properly.]

Evaluate Prediction: Evaluate our current set of analysis and see if we need to try again with different hyperparameters. [NOTE: This method won’t actually evaluate our CPU predictions because we haven’t made any yet.]

Basic, CPU intensive predictions of a stock.
Create Prophet Model: Calling the Facebook. CreateProphetModel method to do some predictions.

Plotting recurring trends throughout the [Overall Trend, Year, Month]
Use the Naïve prediction algorithm to project these recurring trends for the next x days.
Evaluate Prediction: Evaluate our current set of predictions and see if we need to try again with different hyperparameters.
Advanced, GPU intensive predictions of a stock.
Tensorflow linear regression version 1: A simple implementation of linear regression using the tensorflow backend. We run it multiple times with differing hyperparameters and average the results. [NOTE: I haven't gotten the trendline to work yet.]
More to come.


The Following is this experiment Running when we choose to analyze "AMZN.csv"
AMZN Stock history in terms of High, Low, Close
AMZN Stock history in terms of Volume and Daily Change.
Changepoint charts demonstrate the optimal dates to buy or sell shares of the stock. [NOTE: I cannot get the sentiment analysis to be plotted in this chart yet.
Projected Profits using the Buy and Hold Strategy.
CPU predictions compared to Buy and Hold. [NOTE: The 0 point on the y axis is in the wrong place. This is a bug.]
Naïve Prediction for the next 90 days of AMZN stock. Notice the increased uncertainty as the prediction goes further into the future.
I used a Tensorflow implementation of Simple Linear Regression to make multiple predictions based on the data and randomized hyperparameters.

2 comments:

  1. To solve some of the issues related to buying and selling real estate, startup founders are thinking of implementing blockchain technology in the real estate industry. Here is a list of real estate blockchain companies.

    ReplyDelete