Yoontae6719
Stop-loss-adjusted-labels
Jupyter Notebook

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

Last updated Feb 16, 2026
20
Stars
3
Forks
1
Issues
0
Stars/day
Attention Score
10
Language breakdown
Jupyter Notebook 99.6%
Python 0.4%
Files click to expand
README

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

  • Install Python 3.6, PyTorch 1.9.0.
  • Download data.
  • Run Stop-loss adjusted labels.

Reproduce with Docker

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

  • Initialize the docker image using: make init.
  • Download the datasets using: make data.
  • Download the datasets using: make coin data.
  • Run each script in runfile/ using make runmodule module="bash runfile/btcrunfile.sh" for each script.
  • 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:

  • [x] SVM
  • [x] KNN
  • [x] MLP
  • [x] Catboost
  • [x] Random Forest
  • [x] 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 yoontae@unist.ac.kr

SPDX-FileCopyrightText: © 2023 yoontae hwang

SPDX-License-Identifier: BSD-3-Clause

🔗 More in this category

© 2026 GitRepoTrend · Yoontae6719/Stop-loss-adjusted-labels · Updated daily from GitHub