I am creating a bunch of Algorithmic Trading AI’s to predict the price of stocks based on past datasets and other data points. I have nothing to do atm as COVID-19 is out and about.
LET’S DO SOME RESEARCH.
As always, research is key. Gotta fill in the knowledge gaps now to prevent multiple screw-ups.
FINANCE TRADING STRATEGIES
I can use the following to help develop training models.
To build the best model I will need to use a bunch of data points, these will be originally derived from this fine flowchart of Algorithmic Trading (a good place to start with a model).
TYPES OF TRADING
Each type of trading will require a different approach to building different models.
- Day trading – Buying and selling on the same day.
- Swing trading – Buys and selling in a few days to a few months.
- Long Term Trading – Holding onto a share for over a year.
PATTERNS & STRATEGIES
Specific to the type of trading, lets you know what to buy.
The graph below shows it in its simplest form, though there are many calculation methods.
The general process is you use scanners to pick up stocks that are fluctuating high. This can be caused by big investors buying and other big factors. You then apply resistance and support lines to buy at breakout and sell at different points, sometimes based on the golden cross.
This includes triangle patterns and trend lines
To find a volatile stock VOLUME and FLOAT are used as a %. The float should be around 10,000.
- Volume – How many share there are in total
- Float – How many shares are available
- Turnover Ratio – This indicated the volatility of a stock.
So for example:
v = 1,059,000 #volume f = 14,650 #float tr = v / f tr = 72.28% #turnoverRatio
If a stock has a high turnover ratio and a float of stock over 10,000 it appears good for day trading.
- Pre-market Scanning – Using an app to scan and analyse for good shares to apply breakout.
- Gap Screening – Analysing the close of the stock market to the next day open price.
- Momentum Training – This would be a good use for AI to look for patterns in the ups and downs to create successful resistance and support lines. There are plenty of pre-defined patterns that calculate this that could be implemented into the AI.
- finviz.com – A free stock scanner website.
- trade-ideas.com – a paid trading site with a scanner that has AI.
WHEN TO BUY
- Real-time News Services
- Candlestick Charts
We could use numerical and textual here.
- Buy or Sell. The price will go up or down.
- Sentiment Analysis – Compile all posts and use textual data to define good or bad. Or even further textual information, off the top of the head possibilities, include ‘ok’, ‘excellent’, ‘good for the next week’ or others I am sure are out there. Using a pre-trained network (NLP) trained on pieces of text that know if something is good or bad is a good start.
Variable problem using numerical data only.
- Stock Price
- Financial Datapoints such as returns, dividends and price.
We can use classification data here by converting the sentiment textual info derived from a classification network.
bad = 0 good = 1
LINEAR REGRESSION NETWORK
Y = a + bX where X is the explanatory variable and Y is the dependent variable. The slope of the line is b, and a is the intercept (the value of y when x = 0). One data point looks like this.
Additional data points could be plotted on the 2 axes and weighed via regression is that right? Or are they pre-weighed and plotted as one? or can both techniques work?
SUPPORT VECTOR NETWORK
These can do both linear (and other) regression and textual classification – https://en.wikipedia.org/wiki/Support-vector_machine. The use case for this project is regression or comparing past data.
Siraj let me know that a long-short term memory network has been shown to outperform other networks in the field of stock analysis. so the above (which I am happy I revisited from him and others) is null and void for this project.
Why are they so good? Well, imagine feeding previous days datapoints results back into the network! I am getting excited.
It is an RNN. A Recurrent Neural Network that can handle multiple datapoints. LSTM adds the ability to analyse the history of datapoints to spit out a single value, your price prediction.
There is a real easy Tensorflow/Keras way of doing this.
Check how your models are doing. This is also easy to do the with Sairen, check it out – https://doctorj.gitlab.io/sairen/
Q learning is a way of implementing reinforcement learning. I must research this more, but first I will check out the Sairen Reinforcement method. https://github.com/llSourcell/Q-Learning-for-Trading.
WHERE TO FROM HERE?
From the above research and my jack of all trades knowledge, I have decided that these are the steps I am taking.
GET A BROKER
Looking for low or no commission, lots of stocks and forex. Must have an API that has depth and good documentation. I might need two brokers, one that has no commission and good visualisation data for manual and another that utilises my AI with APIs best for full automation in the future.
From this and above research I have deduced that I will need, more to the point, try to use; the following categories of data points.
|Past Prices of the stock. This obviously includes seasonal factors, I wanted to say that.|
|Availability of the stock and my Budget.|
|Market Data from the market or Industry of the stock you are tracking.|
|Company Data the stock you are tracking – Income Statement, Balance Sheet, Cash Flow reports, 10Q & 10K|
|Sentiment – Blogs and other information from social media and reliable sources such as Tweets, Reddit posts and News Headlines.|
|Financial Metadata such as dividends and financial reports.|
There are most likely opportunities here, I might come back to it.