Code Monkey home page Code Monkey logo

tomespel / kairos-volatility-prediction Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 17.95 MB

Advanced machine learning techniques for volatility prediction on financial markets. The Kairos package was developed for CFM’s ENS DataChallenge 2018.

Home Page: https://challengedata.ens.fr/en/challenge/34/volatility_prediction_in_financial_markets.html

License: Apache License 2.0

Python 0.22% Jupyter Notebook 99.78%
financial-analysis volatility machine-learning

kairos-volatility-prediction's Introduction

Volatility Prediction in Financial Markets

Build Status codecov License FOSSA Status

A repository for the Kairos package developed for CFM's ENS Data Challenge. Further information about this challenge is available at the following link. The official leaderboard is available at this address.

Table of Contents

Background

Volatility is a fundamental metric in modern finance. In this challenge, we use past volatilities and price changes of financial instruments to predict future volatility and control the risk of financial portfolios. Here is the video of the challenge's presentation at Collège de France.

Kairos refers to an ancient Greek deity. The word καιρός itself means opportune moment. In modern greek, it means the weather.

Features

We have developed the Kairos package for predicting volatility at the end of the day. The package has been developed for the Python 3.7 language. Dependencies are specified in the package itself.

Installation

Usage

Loading the package

In order to use the Kairos package functions, you must import it in your Python 3.7 project.

from kairos import *

Make sure that all the dependencies are installed. When imported correctly, the package should print the following in the Python console.

Kairos features provider imported.
Kairos engine imported.
Kairos succesfully loaded in your project.

Input Files

The input files should be using the .csv format and have the following structure. We recommend using ',' as separator in the file.

ID date product_id volatility 09:30:00 ... volatility 13:55:00 return 09:30:00 ... return 13:55:00
1 1 1 0.6627 ... 0.0523 -1 ... -1
2 1 2 0.2853 ... 0.0711 1 ... -1
3 1 3 1.1516 ... 0.1179 -1 ... 1

In order to import a csv file in Kairos, use the following command.

myData = kairos.input.from_csv('/csvFilePath/myFile.csv')

You can specify the csv delimiter by adding the parameter contentsDelimiter in the function.

File system

Kairos uses a dedicated file system .krf to store the data in their current state. In order to store the data, use the following command.

kairos.output.freeze(myData, '/pathToFile/myFile.krf')

You can restore the data later on using the following command.

myData = kairos.input.release('/pathToFile/myFile.krf')

The data is structured in one or several KairosBucket objects which include KairosAsset objects with similar properties. Each KairosAsset includes several KairosDay objects.

Credits

The team includes the following members, with the associated GitHub identifiers.

Name GitHub id
Mehdi Tomas mehditomas
Thomas Espel tjespel

License

Apache 2

FOSSA Status

kairos-volatility-prediction's People

Contributors

tomespel avatar

Watchers

Mehdi Tomas avatar

kairos-volatility-prediction's Issues

Lay out main structure

Lay out the main file structure.

Main task Primal Component Secondary Component
Asset Classifier High Average Volatility High Local Volatility
Medium Local Volatility
Low Local Volatility
Medium Average Volatility High Local Volatility
Medium Local Volatility
Low Local Volatility
Low Average Volatility High Local Volatility
Medium Local Volatility
Low Local Volatility
Asset Extractor Main Asset Extractor n/a: Main Component
High Local Volatility Raw Data Processing
Medium Local Volatility Raw Data Processing
Local Local Volatility Raw Data Processing
Features Engineering High Local Volatility Features Engineering Provider
Features Engineering Selector
Medium Local Volatility Features Engineering Provider
Features Engineering Selector
Low Local Volatility Features Engineering Provider
Features Engineering Selector
Predictive Engine High Local Volatility Features Engineering Collector
Training Network
Medium Local Volatility Features Engineering Collector
Training Network
Low Local Volatility Features Engineering Collector
Training Network
Output Processor High Local Volatility Predictions Collector
Medium Local Volatility Predictions Collector
Low Local Volatility Predictions Collector
Main Output Delivery n/a: Main Component

Define the list of elements in the KairosDay class

Following #4 . Here are the elements of the class KairosDay.

  • __id (int) corresponds to the target id.
  • _asset (int) corresponds to the asset id.
  • __date (int) corresponds to the date.
  • __volatility corresponds to the list of double with the volatility values.
  • __returns corresponds to the list of double with the returns values.
  • __isClassified (bool) indicates if the asset has received it local volatility classification.
  • __localClassification (string) specifies the local classification hlv, mlv or llv. States None otherwise.
  • __classificationDetails (dict) specifies the local classification probabilities in the form of a dictionary {'method': double(probability)}.
  • __features (dict) specifies the features list in the form of a dictionary {'featureName': list(featureValuesList)}.

Adding possibility to store predictions individually

We'd need to keep them individually for sakekeeping.

We could also try to find a way to name those predictions to understand which models we are using because we might use the same model but with different parameters or input dataset.

Raw data preprocessing and class KairosDay

**Dealing with raw data **

The notebooks were implemented with data in its original form, which was easy to manipulate. It might not be necessary to reformat the time stamp format of the different assets given that. It might add more complexity and force us to modify code.

What do you think?

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.