Code Monkey home page Code Monkey logo

yoontae6719-stop-loss-adjusted-labels's Introduction

Stop-loss adjusted labels for machine learning-based trading of risky assets

This is the origin Pytorch implementation of stop-loss adjusted label in the following paper: Stop-loss adjusted labels for machine learning-based trading of risky assets

News(July 31): Accepted to Finance Research Letters, 2023.

image

Get Started

  1. Install Python 3.6, PyTorch 1.9.0.
  2. Download data.
  3. Run Stop-loss adjusted labels.

Reproduce with Docker

To easily reproduce the results using Docker, conda and Make, you can follow the next steps:

  1. Initialize the docker image using: make init.
  2. Download the datasets using: make data.
  3. Download the datasets using: make coin data.
  4. Run each script in runfile/ using make run_module module="bash runfile/btc_runfile.sh" for each script.
  5. Alternatively, run all the scripts at once:
for file in `ls scripts`; do make run_module module="bash runfile/runfile"; done

Stop-loss adjusted labels (Python Code Description)

def ST_labels(data, delta):
    """
    Calculate the stop-loss adjusted label.

    Parameters:
    - data: DataFrame containing historical asset prices.
    - delta: Maximum tolerance level for stop-loss trading.

    Returns:
    - Index of rows where the label is 1.
    """

    return data[
        (data["Close"] / data["Close"].shift(1) > 1) & 
        ((data["Low"] / data["Close"].shift(1) - 1) * 100 >= -delta)
    ].index

Baselines

We will keep adding Predicting movements of asset prices models to expand this repo:

  • SVM
  • KNN
  • MLP
  • Catboost
  • Random Forest
  • Extra tree

Citation

If you find this repo useful, please cite our paper.

Hwang, Y., Park, J., Lee, Y., & Lim, D. Y. (2023). Stop-loss adjusted labels for machine learning-based trading of risky assets. Finance Research Letters, 104285.

Contact

If you have any questions or want to use the code, please contact [email protected]

SPDX-FileCopyrightText: © 2023 yoontae hwang [email protected]

SPDX-License-Identifier: BSD-3-Clause

yoontae6719-stop-loss-adjusted-labels's People

Contributors

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