paint-brush
How FinRL's Backtesting Module Enhances Trading Strategy Validationby@reinforcement

How FinRL's Backtesting Module Enhances Trading Strategy Validation

tldt arrow

Too Long; Didn't Read

FinRL's Backtesting Module, leveraging Quantopian pyfolio, automates trading strategy evaluation with considerations for market frictions, liquidity, and risk-aversion parameters, enhancing strategy validation for optimal performance.
featured image - How FinRL's Backtesting Module Enhances Trading Strategy Validation
Reinforcement Technology Advancements HackerNoon profile picture

Authors:

(1) Xiao-Yang Liu, Hongyang Yang, Columbia University (xl2427,[email protected]);

(2) Jiechao Gao, University of Virginia ([email protected]);

(3) Christina Dan Wang (Corresponding Author), New York University Shanghai ([email protected]).

Abstract and 1 Introduction

2 Related Works and 2.1 Deep Reinforcement Learning Algorithms

2.2 Deep Reinforcement Learning Libraries and 2.3 Deep Reinforcement Learning in Finance

3 The Proposed FinRL Framework and 3.1 Overview of FinRL Framework

3.2 Application Layer

3.3 Agent Layer

3.4 Environment Layer

3.5 Training-Testing-Trading Pipeline

4 Hands-on Tutorials and Benchmark Performance and 4.1 Backtesting Module

4.2 Baseline Strategies and Trading Metrics

4.3 Hands-on Tutorials

4.4 Use Case I: Stock Trading

4.5 Use Case II: Portfolio Allocation and 4.6 Use Case III: Cryptocurrencies Trading

5 Ecosystem of FinRL and Conclusions, and References

4 HANDS-ON TUTORIALS AND BENCHMARK PERFORMANCE

We provide hands-on tutorials and reproduce existing works as use cases. Their configurations and commands are available on Github.

4.1 Backtesting Module

Backtesting plays a key role in evaluating a trading strategy. FinRL library provides an automated backtesting module based on Quantopian pyfolio package [36]. It is easy to use and consists of various individual plots that provide a comprehensive image of the performance. In order to facilitate users, FinRL also incorporates market frictions, market liquidity and the investor’s degree of risk-aversion.


4.1.1 Incorporating Trading Constraints. Transaction costs incur when executing a trade, such as broker commissions and the SEC fee. We allow users to treat transaction costs as parameters in the environments: 1). Flat fee is a fixed amount per trade; and 2). Per share percentage is a percentage rate for every share, e.g., 0.1% or 0.2% are most commonly used.


Moreover, we need to consider market liquidity for stock trading, e.g., the bid-ask spread that is the difference between the best bid and ask prices. In our environment, users can add the bid-ask spread as a parameter. For different levels of risk-aversion, users can add the standard deviation of the portfolio returns into the reward function or use a risk-adjusted Sharpe ratio as the reward function.



This paper is available on arxiv under CC BY 4.0 DEED license.