Coder Social home page Coder Social logo

margin-trader's Introduction

Margin Trader (ICAIF 2023)

Implementation of Margin Trader: A Reinforcement Learning Framework for Portfolio Management with Margin and Constraints.

Dependency

  • FinRL
  • Python 3.10
  • torch

Training

python trading_margin_a2c.py

The dataset will be automatically downloaded on the first run.

Citation

If you use this code for your research, please kindly cite our paper:

@inproceedings{gu2023margin,
  title={Margin Trader: A Reinforcement Learning Framework for Portfolio Management with Margin and Constraints},
  author={Gu, Jingyi and Du, Wenlu and Rahman, AM Muntasir and Wang, Guiling},
  booktitle={Proceedings of the Fourth ACM International Conference on AI in Finance},
  pages={610--618},
  year={2023}
}

margin-trader's People

Contributors

jingyigu avatar xyznjit avatar

Stargazers

Inyeol Choi avatar  avatar Wenlu Du avatar

Watchers

Wenlu Du avatar  avatar

margin-trader's Issues

Issue with regenerating results in trading_margin_a2c.py

I am having trouble generating the expected results using the trading_margin_a2c.py script. When I run the script, I get the following output:
Annual return -0.283977
Cumulative returns -0.357725
Annual volatility 0.251660
Sharpe ratio -1.200733
Calmar ratio -0.679167
Stability 0.317685
Max drawdown -0.418125
Omega ratio 0.764102
Sortino ratio -1.412423
Skew NaN
Kurtosis NaN
Tail ratio 0.731687
Daily value at risk -0.032905
dtype: float64
[100%%] 1 of 1 completed
Shape of DataFrame: (334, 8)
==============Compare to DJIA===========
hit end!
Annual return -0.033163
Cumulative returns -0.095863
Annual volatility 0.226954
Sharpe ratio -0.035414
Calmar ratio -0.078212
Stability 0.446307
Max drawdown -0.424017
Omega ratio 0.994021
Sortino ratio -0.049710
Skew NaN
Kurtosis NaN
Tail ratio 0.913350
Daily value at risk -0.028625
dtype: float64
[100%%
] 1 of 1 completed
Shape of DataFrame: (754, 8)
==============Compare to DJIA===========
Annual return 0.128900
Cumulative returns 0.437304
Annual volatility 0.172500
Sharpe ratio 0.790368
Calmar ratio 0.587491
Stability 0.337695
Max drawdown -0.219408
Omega ratio 1.144252
Sortino ratio 1.117012
Skew NaN
Kurtosis NaN
Tail ratio 1.018332
Daily value at risk -0.021192
dtype: float64

Process finished with exit code 0

Steps to Reproduce:

dl trading_margin_main.zip
Run trading_margin_a2c.py with the provided configuration.
Observe the results.

Environment:

Python version: [3.10]
Relevant libraries and versions

profit_trade
profit_test
perf_stats_trade.csv

Expected Behavior:

I expected the script to generate results that align more closely with those reported in the original paper.
Actual Behavior:

The script generates results with significant discrepancies, particularly in terms of the annual return and Sharpe ratio.
perf_stats_test.csv

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.