Goal:

Test different state of art time series forecasting models for stock price prediction combining it with additional data from news feed to define the winner and build trading strategy on top.

SCOPE: AMZN, TSLA, AAPL stocks

Success metrics:

MAPE, RMSE, MAE, Theil's U-statistic, Mean Absolute Scaled Error (MASE)

Define the trading strategy for the best model/ensemble of models

Define the forecasting method and strategy that is better than buy and hold

1. Stock Price Data Gathering with Yahoo Finance

Steps:

Code Example:

import yfinance as yf

# Define the stock ticker and time period
ticker = 'AAPL'
start_date = '2010-01-01'
end_date = '2023-12-31'

# Fetch historical data
stock_data = yf.download(ticker, start=start_date, end=end_date)

# Preview the data
print(stock_data.head())

2. Data Gathering from The GDELT Project for Sentiment Analysis

Steps:

Code Example:

from gdeltdoc import GdeltDoc, Filters

f = Filters(
    keyword = "Amazon amzn",
    start_date = "2023-05-10",
    end_date = "2024-05-11"
)

gd = GdeltDoc()

# Search for articles matching the filters
articles = gd.article_search(f)

# Get a timeline of the number of articles matching the filters
timeline = gd.timeline_search("timelinevol", f)

3. Prepare Data