SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2209.05559 · 2022

Deep Reinforcement Learning for Cryptocurrency Trading: Practical Approach to Address Backtest Overfitting

arXiv · PDF · Open in the Atlas

Code that ran

5 of 13 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 4 have no contract verdict; 0 failures of our instrument; 8 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2209.05559.json · badge: /api/ran/2209.05559.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
Burntt/FinRL_Crypto community (classifier label)
classifier basis not recorded on the link
5 ran · 8 no recorded run
FunctionStatusWhere it lives
calculate_start_end_dates Ran
ran on a synthesized input
Burntt/FinRL_Crypto/config_main.py
code served (permissive licence) · get_code("bfcd8b95a88a92f8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from datetime import datetime, timedelta

def calculate_start_end_dates(candlewidth):
    no_minutes = int
    candle_to_no_minutes = {'1m': 1, '5m': 5, '10m': 10, '30m': 30, '1h': 60, '2h': 2 * 60, '4h': 4 * 60, '12h': 12 * 60}
    no_minutes = candle_to_no_minutes[candlewidth]
    trade_start_date_datetimeObj = datetime.strptime('2022-04-30 00:00:00', '%Y-%m-%d %H:%M:%S')
    train_start_date = (trade_start_date_datetimeObj - timedelta(minutes=no_minutes * (20000 + 5000))).strftime('%Y-%m-%d %H:%M:%S')
    train_end_date = (trade_start_date_datetimeObj - timedelta(minutes=no_minutes * (5000 + 1))).strftime('%Y-%m-%d %H:%M:%S')
    val_start_date = (trade_start_date_datetimeObj - timedelta(minutes=no_minutes * 5000)).strftime('%Y-%m-%d %H:%M:%S')
    val_end_date = (trade_start_date_datetimeObj - timedelta(minutes=no_minutes * 1)).strftime('%Y-%m-%d %H:%M:%S')
    return (train_start_date, train_end_date, val_start_date, val_end_date)

ARGS = {
    'candlewidth': '1h'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
embargo Ran
ran on a synthesized input
Burntt/FinRL_Crypto/function_CPCV.py
code served (permissive licence) · get_code("84d4e470e8c98400")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family int, shape (3,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import pandas as pd
from abc import abstractmethod
import numbers

class BaseTimeSeriesCrossValidator:
    """
    Abstract class for time series cross-validation.
    Time series cross-validation requires each sample has a prediction time pred_time, at which the features are used to
    predict the response, and an evaluation time eval_time, at which the response is known and the error can be
    computed. Importantly, it means that unlike in standard sklearn cross-validation, the samples X, response y,
    pred_times and eval_times must all be pandas dataframe/series having the same index. It is also assumed that the
    samples are time-ordered with respect to the prediction time (i.e. pred_times is non-decreasing).
    Parameters
    ----------
    n_splits : int, default=10
        Number of folds. Must be at least 2.
    """

    def __init__(self, n_splits=10):
        if not isinstance(n_splits, numbers.Integral):
            raise ValueError(f'The number of folds must be of Integral type. {n_splits} of type {type(n_splits)} was passed.')
        n_splits = int(n_splits)
        if n_splits <= 1:
            raise ValueError(f'K-fold cross-validation requires at least one train/test split by setting n_splits = 2 or more, got n_splits = {n_splits}.')
        self.n_splits = n_splits
        self.pred_times = None
        self.eval_times = None
        self.indices = None

    @abstractmethod
    def split(self, X: pd.DataFrame, y: pd.Series=None, pred_times: pd.Series=None, eval_times: pd.Series=None):
        if not isinstance(X, pd.DataFrame) and (not isinstance(X, pd.Series)):
            raise ValueError('X should be a pandas DataFrame/Series.')
        if not isinstance(y, pd.Series) and y is not None:
            raise ValueError('y should be a pandas Series.')
        if not isinstance(pred_times, pd.Series):
            raise ValueError('pred_times should be a pandas Series.')
        if not isinstance(eval_times, pd.Series):
            raise ValueError('eval_times should be a pandas Series.')
        if y is not None and (X.index == y.index).sum() != len(y):
            raise ValueError('X and y must have the same index')
        if (X.index == pred_times.index).sum() != len(pred_times):
            raise ValueError('X and pred_times must have the same index')
        if (X.index == eval_times.index).sum() != len(eval_times):
            raise ValueError('X and eval_times must have the same index')
        self.pred_times = pred_times
        self.eval_times = eval_times
        self.indices = np.arange(X.shape[0])


def embargo(cv, train_indices, test_indices, test_fold_end):
    if not hasattr(cv, 'embargo_td'):
        raise ValueError('The passed cross-validation object should have a member cv.embargo_td defining the embargotime.')
    last_test_eval_time = cv.eval_times.iloc[test_indices[test_indices <= test_fold_end]].max()
    min_train_index = len(cv.pred_times[cv.pred_times <= last_test_eval_time + cv.embargo_td])
    if min_train_index < cv.indices.shape[0]:
        allowed_indices = np.concatenate((cv.indices[:test_fold_end], cv.indices[min_train_index:]))
        train_indices = np.intersect1d(train_indices, allowed_indices)
    return train_indices


# Create a concrete subclass of BaseTimeSeriesCrossValidator
class ConcreteTimeSeriesCrossValidator(BaseTimeSeriesCrossValidator):
    def split(self, X, y=None, pred_times=None, eval_times=None):
        super().split(X, y, pred_times, eval_times)
        yield (np.arange(0, 3), np.arange(3, 5))


# Create sample data
n_samples = 5
index = np.arange(n_samples)

# Create pred_times and eval_times as pandas Series
pred_times = pd.Series([1.0, 2.0, 3.0, 4.0, 5.0], index=index)
eval_times = pd.Series([1.5, 2.5, 3.5, 4.5, 5.5], index=index)

# Create the cross-validation object
cv = ConcreteTimeSeriesCrossValidator(n_splits=2)
cv.pred_times = pred_times
cv.eval_times = eval_times
cv.indices = np.arange(n_samples)
cv.embargo_td = 0.5  # The function checks for embargo_td attribute

# Create train and test indices
train_indices = np.array([0, 1, 2])
test_indices = np.array([3, 4])
test_fold_end = 4

ARGS = {
    'cv': cv,
    'train_indices': train_indices,
    'test_indices': test_indices,
    'test_fold_end': test_fold_end
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family int, shape (3,) — shape (3,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
nCr Ran
ran, honoured the contract we drafted
Burntt/FinRL_Crypto/config_main.py
code served (permissive licence) · get_code("9a79d1f3fd9c514a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import operator as op
from functools import reduce

torch_imported = False
try:
    import torch
    torch_imported = True
except:
    pass

# The function nCr computes binomial coefficients
# Parameters: n (non-negative integer), r (non-negative integer where r <= n)
# The function uses:
# - n: passed to range(n, n - r, -1)
# - r: passed to range(1, r + 1, -1) and used in min(r, n - r)
# Both are used as integers in arithmetic and range operations

ARGS = {
    "n": 10,
    "r": 3
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
purge Ran
ran on a synthesized input
Burntt/FinRL_Crypto/function_CPCV.py
code served (permissive licence) · get_code("e6e6d9ed0b7aea01")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family int, shape (6,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
import pandas as pd
from numbers import Integral

class BaseTimeSeriesCrossValidator:
    """Minimal implementation for testing"""
    def __init__(self, n_splits=10):
        if not isinstance(n_splits, Integral):
            raise ValueError(f'The number of folds must be of Integral type. {n_splits} of type {type(n_splits)} was passed.')
        n_splits = int(n_splits)
        if n_splits <= 1:
            raise ValueError(f'K-fold cross-validation requires at least one train/test split by setting n_splits = 2 or more, got n_splits = {n_splits}.')
        self.n_splits = n_splits
        self.pred_times = None
        self.eval_times = None
        self.indices = None

# Create sample data
n_samples = 10
index = np.arange(n_samples)

# Create pred_times (non-decreasing, time-ordered)
pred_times = pd.Series(
    data=np.array([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0]),
    index=index
)

# Create eval_times (posterior to pred_times)
eval_times = pd.Series(
    data=np.array([2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0]),
    index=index
)

# Create cv instance
cv = BaseTimeSeriesCrossValidator(n_splits=2)
cv.pred_times = pred_times
cv.eval_times = eval_times
cv.indices = np.arange(n_samples)

# Create train_indices (indices to filter)
train_indices = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])

# Define test fold boundaries
test_fold_start = 3
test_fold_end = 6

ARGS = {
    'cv': cv,
    'train_indices': train_indices,
    'test_fold_start': test_fold_start,
    'test_fold_end': test_fold_end
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family int, shape (6,) — shape (6,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
set_Pandas_Timedelta Ran
ran on a synthesized input
Burntt/FinRL_Crypto/1_optimize_wf.py
code served (permissive licence) · get_code("83a988b7d6e02ef9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Timedelta. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import pandas as pd

ARGS = {
    'TIMEFRAME': '1h'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Timedelta — a Timedelta output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Timedelta output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
add_samples_equify_array_length Not yet run
unverified (harvested, no recorded run)
Burntt/FinRL_Crypto/5_pbo.py
code served (permissive licence) · get_code("9c3fe6a9374df75e")
How it ran

no invocation recorded.

compute_fold_bounds Not yet run
unverified (harvested, no recorded run)
Burntt/FinRL_Crypto/function_CPCV.py
code served (permissive licence) · get_code("bd9ff206dbed2b00")
How it ran

no invocation recorded.

load_saved_data Not yet run
unverified (harvested, no recorded run)
Burntt/FinRL_Crypto/1_optimize_cpcv.py
code served (permissive licence) · get_code("53ddf63ca4975d48")
How it ran

no invocation recorded.

load_validated_model Not yet run
unverified (harvested, no recorded run)
Burntt/FinRL_Crypto/4_backtest.py
code served (permissive licence) · get_code("a4b0cde717d5aa81")
How it ran

no invocation recorded.

load_validated_model Not yet run
unverified (harvested, no recorded run)
Burntt/FinRL_Crypto/5_pbo.py
code served (permissive licence) · get_code("b56a679309a89ea6")
How it ran

no invocation recorded.

main_metric_pbo_analysis Not yet run
unverified (harvested, no recorded run)
Burntt/FinRL_Crypto/5_pbo.py
code served (permissive licence) · get_code("e84ca249d84ebfb7")
How it ran

no invocation recorded.

sample_hyperparams Not yet run
unverified (harvested, no recorded run)
Burntt/FinRL_Crypto/1_optimize_cpcv.py
code served (permissive licence) · get_code("22b9e09cfef8550b")
How it ran

no invocation recorded.

set_Pandas_Timedelta Not yet run
unverified (harvested, no recorded run)
Burntt/FinRL_Crypto/1_optimize_cpcv.py
code served (permissive licence) · get_code("2e0561841040a252")
How it ran

no invocation recorded.

Also present in other papers' code

Of 13 samples lifted from this paper's linked repositories, 13 carry a function identity and 0 do not. Of the 12 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 11 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
nCr 1 other paper
1 dated earlier
1912.00682 (2019-12)
GeoTrackNet-A Maritime Anomaly Detector using Probabilistic Neural Network Representation of AIS Tracks and A Contrario Detection

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Designing profitable and reliable trading strategies is challenging in the highly volatile cryptocurrency market. Existing works applied deep reinforcement learning methods and optimistically reported increased profits in backtesting, which may suffer from the false positive issue due to overfitting. In this paper, we propose a practical approach to address backtest overfitting for cryptocurrency trading using deep reinforcement learning. First, we formulate the detection of backtest overfitting as a hypothesis test. Then, we train the DRL agents, estimate the probability of overfitting, and reject the overfitted agents, increasing the chance of good trading performance. Finally, on 10 cryptocurrencies over a testing period from 05/01/2022 to 06/27/2022 (during which the crypto market crashed two times), we show that the less overfitted deep reinforcement learning agents have a higher return than that of more overfitted agents, an equal weight strategy, and the S&amp;P DBM Index (market benchmark), offering confidence in possible deployment to a real market.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2209.05559")
get_code_for_paper("2209.05559")
have("2209.05559")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2209.05559.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2209.05559.svg)](https://syntology.ai/paper/2209.05559)

Connect an agent — have() is free.