GithubHelp home page GithubHelp logo

msc_thesis's Introduction

MSc Computational Finance module CF981: CCFEA MSc Dissertation

A work-in-progress

Comparing ANNs to traditional forecasting methods

The project implements a Recurrent Neural Network (RNN) in the form of two Long Short-Term Memory (LSTM) layers to attempt to predict future closing prices for stocks.

Data

Data is pulled via the tiingo API, which includes daily values for open, high, low, close and trading volume of a wide variety of symbols. We chose symbols listed under the New York Stock Exchange.

Methodology, so far...

Predictions are made using raw data, even though we computed other composite metrics like Stochastic Oscillator indices, weighted averages, Bollinger bands. More work is needed to incorporate those metrics in the network which will hopefully result in more accurate predictions. The 3 features in the data are open, high and low values which are used to attempt to predict how the close price will look like at the end of the trading day. The data aren't scaled, though future work will probably involve a scaling transformation.

Our model currently is a sequential single layer LSTM RNN + Dense, though future work will add one more LSTM layer. 100 LSTM nodes are currently used. Rectified Linear Units (ReLU) are used as activation functions and Adam as the optimiser.

model = Sequential()
model.add(LSTM(100, activation="relu", input_shape=(n_steps, n_features)))
model.add(Dense(n_features))
opt = Adam(learning_rate=0.001)
model.compile(optimizer=opt, loss="mae", metrics=["mse"])

Results, so far...

Predictions on the testing set of a stock dataset

Trying to fit the model onto the testing data seems to work, not as accurate as I would like it to be. Reported MAE and MSE for WFC dataset:

History Item [loss] reports value of 0.016902789101004602
History Item [mse] reports value of 0.0005050316685810685

Will further tinker with learning rate, loss function, activation function, node count, etc.

AAPL training loss

Comparing the two networks

LSTM pulls ahead of ARIMA with lower Mean Squared Errors and Mean Absolute Errors:

LSTM mean: 0.000331696789897865
ARIMA mean: 0.0005229507475626473

This is exactly what we wanted to show in the paper, so far so good.

Tech used

The usual python data stack is used in this project:

  • pandas
  • numpy
  • sklearn
  • statsmodels

For deep learning we are using:

  • Keras
  • TensorFlow

msc_thesis's People

Contributors

antoniouaa avatar dependabot[bot] avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.