Giter Club home page Giter Club logo

delafo-deep-learning-approach-for-portfolio-optimization's Introduction

DELAFO : DeEp Learning Approach for portFolio Optimization

Applications

Predict the optimized portfolio (based on Sharpe ratio) in future:

  • Formulate the portfolio optimization as a supervise problem.
  • With input is the past event(Default is price and volume of market in 64 days ago).
  • Predict the tickers should be in our portfolios in future . Evaluate by the Sharpe ratio (Default is next 19 working days~ around one next month).
  • All the tickers have same proportion in this portfolio.
  • The number of tickers will be constrainted by the constraint_value in loss function.

Training

All the data will be preprocessed before using to train our models.(preprocess_data.py):

  • With input is the past event(price and volume of market in 64 days ago).

  • predict the future tickers should be in our portfolios. (next 19 working days~ around one next month).

  • We do the ForWard Chain to train and evaluate the models like picture below:

    Forward Chain. The Blue block is training data, the Red block is evaluating data.

  • The result will write in logs folder and plot folder.

  • The model will be saved in pretrain_model folder. You can download our pretrained model Additive Attention with GRU

Usage

Firstly, you need to download data and put it in data folder, you can download from Link download data from Entropy Contest 2019.

$ python main.py --data_path path/to/data --model model/name --load_pretrained True/False --model_path '' --timesteps_input time/window/input --timesteps_input time/window/output

--data_path: path to dataset.

--load_pretrained Bool value. True if you want to load pretrained model. Default False.

--model_path : if --load_pretrained == True . You have to specify the path to pretrained model.

--model_name : all available models at the moment are:

  • ['ResNet' , 'GRU' , 'LSTM' , 'AA_GRU' , 'AA_LSTM' , 'SA_GRU' , 'SA_LSTM'] with corresponding configuration file in config folder. RNN model with attention mechanism.

ResNet model.(b) is the first residual block. (c) is the architecture of second and third blocks. (d) is the final block.

Additive Attention with RNN model

Self Attention with RNN model

  • You can change the configuration of these models by changing the config file in config folder (We do not recommend to do it, because these hyperparameters had been tuned for these models).
  • You can design your own model by put it in models folder.

--timesteps_input : time window for the input.

--timesteps_input : time window for the output.

DATA

  • Must be in csv file.
  • Now all the models just support for data have 4 fields ['ticker','date','price','volume'] like in picture:

Requirements

  • python 3.6.2
  • scikit-learn 0.21.3
  • Keras 2.3.1
  • pandas 0.25.1
  • tensorflow 1.13.2

References

We recommend you to cite our following paper when using these codes for further investigation:

@inproceedings{hieu2020,
  title={DELAFO: An Efficient Portfolio Optimization Using Deep Neural Networks},
  author={Cao Ky Hieu, Cao Ky Han, and Nguyen Thanh Binh},
  booktitle={Proceedings of the 24th Pacific-Asia Conference on Knowledge Discovery and Data Mining, PAKDD 2020, Singapore},
  year={2020}
}

delafo-deep-learning-approach-for-portfolio-optimization's People

Contributors

caokyhieu avatar

Watchers

 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.