GithubHelp home page GithubHelp logo

230t2-group3's Introduction

230T2 - Deep Learning for Time Series project

This repository includes the different work files of the project that was conducted as part of the requirements for 230T2 courses. The paper that is replicated is the following: Constructing Financial Sentimental Factors in Chinese Market Using Natural Language Processing, available on ArXiv here.

The requirements for the project can be installed through the following command line:

$ pip install -r requirements.txt

Part 1: data retrieval and data engineering

This part focuses on getting the data and inputting it into a dataframe for easier manipulation in the next steps of the projects. The data set is included in the folder reuters.

The code in the notebook is also taking care of performance retrieval and labelling of the different headlines.

The notebook is named 230T2-data-exploration.ipynb.

Part 2: benchmark model

This part focuses on training naïve bayes classifier with tf-idf features, and compute the correlation of various benchmark variables with S&P500 price/returns.

The data set is included in the folder data

The notebook is named is 230T2-baseline-model.ipynb

Part 3: BERT model

This part is dedicated to using the data that was preprocessed in the first section and to train the final layer of a BERT model to have access to sentimental analysis.

The requirements are already including in the top of this document.

The notebook is named 230T2-bert-model.ipynb.

Part 4: backtest strategy

In order to simulate predictive prowess of the sentiment factor calculated above, we implement a simple paper portfolio backtest strategy. There were quite a few alternatives in order to implement paper portfolios. Few of the things we came up with were:

  • Act on the instantaneous sentiment signal calculated everyday,
    • Hold for 1 day
    • Hold for 5 days
  • Act o the instantaneous sentiment signal, calculated based on weighting given to different news depending on its impact on a given day
    • Act on the Momentum of the sentiment signal
      • Transact S & P 500
      • Transact VIX
    • Act on the persistent sentiment signal (rolling average of X days)
      • Transact S & P 500
      • Transact VIX

We calculate the sentiment signal based on the previous 20 days for a given day. Then we adjust by bias, and take sign of signal where we buy if signal > 0 and sell if signal < 0. We hold for one day and calculate daily pnl without transaction cost. With these returns we assess performance of the sentiment signal such as mean, vol, sharpe ratio.

The notebook is named 230T2-backtest-strategy.ipynb.

230t2-group3's People

Contributors

loicdiridollou 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.