/Market-predictor

Primary LanguageJupyter Notebook

Automated Trading System

TODO:

Deep Reinforcement Learning model

Examples:

  1. [Capturing Financial markets to apply Deep Reinforcement Learning]
  2. [A Deep Reinforcement Learning Framework for the Financial Portfolio Management Problem]
  3. [Deep Reinforcement Learning for Automated Stock Trading]

Inputs/Observation Space:

  1. Output/hidden-layer embeddings of a financial news sentiment analysis pre-trained model. [FinBERT]. Justification: such a model is able to extract valuable info from unstructured data such as financial news. Could provide important insights for trade decisions.
  2. Technical Indactors, price history (OHLCV), financial statements (all with timestamps). Pass through a Transform network (3 layers?).
  3. Portfolio State. 2D Matrix with 3 columns (price, number of shares, cash) and N rows (where N is the number of different/pre-selected assets in the portfolio)

Action Space:

The AI trader can perform 1 of 3 actions for each asset in the portfolio: buy/sell/hold

Extra Research / Brainstorm

Implement AI for predicting stock market / turning a profit on auto.

Investors look at many factors that influence markets in order to decide to invest/trade/buy/hold/sell an asset.

portfolio Factors can include (but no limited to):

  1. financial statements
  2. financial news
  3. psychology of the masses regarding the company
  4. competition
  5. stock price and history
  6. macro economic factors (i.e: interest rates, currency, country, industry, trade agreements, subsidies, local, national and foreign governments policies)
  7. style factors: momentum, volatility, value and quality etc...

Most of these require knowledge in the field which is acquired by many hours of reading and digesting public information.

The state-of-the-art NLP model (Google: GPT-3) is now able to generate text which looks generated by a human. This means that it could also be able to "digest" or interpret text information.

Perhaps an AI system to predict the stock market / inform trade decisions could be developed since AI models now have the ability to "digest" text information similarly to a human (i.e: similarly to an investor?). Such a system could comprise of multiple models (1 for each factors?) which evaluates the various factors that influence investor decisions.

One of these factors could be the sentiment/psychology of the investors regarding the stock/asset. An atempt at representing this could be the sentiment analysis of financial news and other media categories i.e. social[Twitter, FB etc...], blogs/vlogs, publications, articles. Topics related to the stock/asset price, market, competition etc. The volume of the available content is massive and choosing which data to mine is a form of human/manual feature engineering. Expanding this manually via human creativity and igenuity could be possible. Choosing which data to feed to the model is the craft. (Could a generative model learn which data to mine? Choosing which article to read and which content to consume is something an investor has to do.)

An intial draft of such a model could be as follows:

Features/Inputs:

  1. financial statements embeddings (?-dimensions)
  2. sentiment analysis embeddings
  3. stock price history embedding
  4. other?

The model takes as input a combination (concatenation?) of the listed features and outputs buy/sell decision of a given time-length (10-years?, 5-year?, 1-year?, 6months?, 1 week?, 1day?). How long would it take to process all available stock data? New data/content gets created every minute. The time between start of model training and final model prediction could be a practical challenge to reduce. Perhaps 2 models would be needed? 1st is trained on all data mined before time T (historical) and 2nd is trained on all data mined after time T.

  1. [This article] shows one method for sentiment analysis of financial news. Improvement would be to replace the sentiment analysis model with a more state-of-the-art model such as [FinBERT].

  2. This article shows how to web-scrape financial data -> https://medium.com/datadriveninvestor/use-python-to-value-a-stock-automatically-3b520422ab6

GPT-3 paper: https://arxiv.org/pdf/2005.14165.pdf

GPT-3 is a Transformer model. A Transformer model would likely be the first choice for text analysis and stock price prediction as it is the state-of-the-art sequence-sequence models

Another transformer model could be used to encode/embed stock price data.

Use this to simulate the stock market for the AI training -> https://github.com/dchrostowski/investopedia_simulator_api Google/Find other APIs for Investopedia

Website that appears to have a successful implementation -> https://iknowfirst.com/

gamification of web platform?: could use human/expert input as imitation learning? imitate warren buffet? collection of "experiences" for experience replay which are human-driven such as the historical investing performance of known succesful traders/investors?

could extend this openAI gym environment -> https://awesomeopensource.com/project/AminHP/gym-anytrading