Giter Club home page Giter Club logo

rat's Introduction

Table of Contents

Introduction

This repo is the Pytorch code for our paper “Relation-Aware Transformer for Portfolio Policy Learning”[1] in IJCAI 2020.

Differences from the article version

Note that this library is a part of our main project, and it is several versions ahead of the article.

  • In decision-making layer, we construct the leverage operation through two softmax heads, and it's performance is similar to the result of using three softmax heads.

Dependencies

python 3.7.3 (Anaconda)

pytorch 0.4.1.post2

cudnn 7.4.1

Dataset

The raw data of Crypto-A is accessed with Poloniex[2]. We provide the Crypto-A dataset in link[3], where data selection is based on the method in [4]. Please download ./database to the same directory as the main.py. The statistics of Crypto-A are summarized as below.

Dataset Assets Training Test
Crypto-A 12 2016.01-2017.11 2017.11-2018.01

Build

File main.py mainly contains the construction of RAT network, data preprocessing, the fitting model process and testing process. File run_mian.sh mainly contains the parameter configurations of training RAT.

Running

cd ${RAT_ROOT}/RAT-master

./run_main.sh

Configurations

The figure shows the entire structure of RAT, and we detail some related parameter configurations in run_main.sh as below.

--x_window_size

The length of the price series.

--local_context_length

The length of local price context.

--daily_interest_rate

The interest rate of the loan for one day.

--log_dir

The directory to save the log.

--model_dir

The directory to save the model.

--model_index

Set a unique ID for the model.

Logging

After training process, the model is saved in ${SAVE_MODEL_DIR}/${MODEL_INDEX}.pkl. After testing process, the backtest results are saved in ${LOG_DIR}/train_summary.csv. It contains metrics such as fAPV, SR, CR and basktest_history.

Model

We provide a model with 495.28 fAPV in https://drive.google.com/drive/folders/11MK2QSj30G9pYE8qx_-80zgCDmJOHS9U?usp=sharing. You can download the model to ${SAVE_MODEL_DIR}/ and test it. When testing the given model, please comment out line 1443 in main.py to avoid the training process.

Acknowledgement

This project is constructed based on the open source project:

Citation

If you use this code for your research, please consider citing:

@inproceedings{xu-relation,
  title = {Relation-Aware Transformer for Portfolio Policy Learning},
  author = {Xu, Ke and Zhang, Yifan and Ye, Deheng and Zhao, Peilin and Tan, Mingkui},
  booktitle = {Proceedings of the Twenty-Ninth International Joint Conference on Artificial Intelligence}, 
  pages = {4647--4653},
  year = {2020},
  month = {7},
  note = {Special Track on AI in FinTech}
}

References

rat's People

Contributors

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