기본 정보
- 저자
- DOI
- 10.48550/arxiv.2201.04699
- 저널
- arXiv (Cornell University)
- 발행년도
- 2022
- 발행기관
- Cornell University
- 피인용수
- 0
- 라이선스
- cc-by
- 논문 유형
- –
- 언어
- –
- 원문 페이지
- https://doi.org/10.48550/arxiv.2201.04699
- 토픽
- Electron and X-Ray Spectroscopy Techniques
- OpenAlex ID
- W6929404380
평가 내용
- 관련도
- 사업분야
- 수소연료전지 · (5) 연료전지용 수분제어장치(가습기)
- 부 분야
- –
- R&D 측면
- –
- 확신도
- –
- 근거 용어
- –
- 판단 근거
- 임베딩 유사도 기반 평가로 '수소연료전지 > 연료전지용 수분제어장치(가습기)' 분야에 선정된 논문입니다.
- R&D 활용 포인트
- –
- 평가 입력
- –
초록
We demonstrate a novel application of online transfer learning for a digital assets trading agent. This agent uses a powerful feature space representation in the form of an echo state network, the output of which is made available to a direct, recurrent reinforcement learning agent. The agent learns to trade the XBTUSD (Bitcoin versus US Dollars) perpetual swap derivatives contract on BitMEX on an intraday basis. By learning from the multiple sources of impact on the quadratic risk-adjusted utility that it seeks to maximise, the agent avoids excessive over-trading, captures a funding profit, and can predict the market's direction. Overall, our crypto agent realises a total return of 350\%, net of transaction costs, over roughly five years, 71\% of which is down to funding profit. The annualised information ratio that it achieves is 1.46.
본문 57,587자
본문 펼치기
Received March 2, 2022.
_Digital Object Identifier_
# The Recurrent Reinforcement Learning Crypto Agent
GABRIEL BORRAGEIRO , NICK FIROOZYE AND PAOLO BARUCCA
Department of Computer Science, University College London, Gower Street, London, WC1E 6BT
Corresponding author: Gabriel Borrageiro (e-mail: gabriel.borrageiro.20@ucl.ac.uk).
ABSTRACT We demonstrate a novel application of online transfer learning for a digital assets trading
agent. This agent uses a powerful feature space representation in the form of an echo state network, the
output of which is made available to a direct, recurrent reinforcement learning agent. The agent learns
to trade the XBTUSD (Bitcoin versus US Dollars) perpetual swap derivatives contract on BitMEX on an
intraday basis. By learning from the multiple sources of impact on the quadratic risk-adjusted utility that it
seeks to maximise, the agent avoids excessive over-trading, captures a funding profit, and can predict the
market’s direction. Overall, our crypto agent realises a total return of 350%, net of transaction costs, over
roughly five years, 71% of which is down to funding profit. The annualised information ratio that it achieves
is 1.46.
INDEX TERMS online learning, transfer learning, echo state networks, recurrent reinforcement learning,
financial time series
I. INTRODUCTION
Financial time series provide many modelling challenges for
both researchers and practitioners. In some circumstances,
data availability is sparse, and the datasets are vast in other
circumstances; this impacts the choice of model and the
learning style. In addition, financial time series are typically
both autocorrelated and nonstationary, requiring approaches
such as integer or fractional differencing [1] to remove these
effects and facilitate correct feature selection; this is previously identified by Granger and Newbold [2] as leading
to spurious regressions if not mitigated. Another approach
to coping with nonstationarity is to allow models to learn
continuously.
Against this backdrop, we extend our earlier work [3]
where we combine sequential learning with transfer learning [4] and reinforcement learning [5]. More concretely,
we novelly transfer the learning of an echo state network
[6] to a direct, recurrent reinforcement learning agent [7]
who must learn to trade digital asset futures, specifically
the XBTUSD (Bitcoin versus US Dollar) perpetual swap on
the BitMEX exchange. Our transfer learner benefits from an
ample, dynamic reservoir feature space and can identify and
learn from the different sources of impact on profit and loss,
including execution costs, exchange fees, funding costs and
price moves in the market.
Perhaps the main benefit of this paper will be for financial
industry practitioners. In the numerous papers we researched
on machine learning applications to financial trading, the
researchers’ emphasis tends to be on the novelty of the
machine learning model, which inevitably has a high learning
capacity. In practically all cases, good risk-adjusted returns
are claimed, yet when one digs into the results in more
detail, one invariably finds that trading costs are not fully
accounted for. Such papers usually assume the execution
of trades on the closing prices of sub-sampled data with
certainty. However, only a price taker can obtain certainty
of fill by crossing the bid/ask spread. The price taker then
observes an immediate loss equal to the execution time half
bid/ask spread. We barely see this cost accounted for, and
even when it is, such as with the seminal work of Moody et al.
[7], a fixed execution cost is assumed. This fixed execution
cost is never observed in reality; see, for example, figure 4
of Borrageiro et al. [3], which shows that the bid/ask spread
varies by time of day. For many assets, especially in traditional finance, the bid/ask spread varies by day of the week
as well; Dacorogna et al. [8] demonstrate and discuss various
examples of such stylised facts. Another approach commonly
taken by academic financial trading researchers is to use
supervised learning and sub-sample the high-frequency data
into monthly time series. The main reason for doing this is
to ameliorate excessive trading and thus high execution cost.
Inevitably, we see the caveat emptor of a lack of experimental
data and its impact on the generalisation performance of their
chosen model. Furthermore, the down-sampling of data into
lower frequencies typically makes bearable the slow training
times of many models, such as deep q-learning networks.
We complete this section with a summary of the main
contributions of this paper. Our meta-model can process data
as a stream and learn sequentially; this helps it cope with the
nonstationarity of the high-frequency order book and trading
data. Furthermore, by using the vast high-frequency data,
our model, which has a high learning capacity, avoids the
kind of overfitting on a lack of data points that occurs with
down-sampled data. We escape the problem of over-trading
that is typically seen with the supervised learning model by
learning the sensitivity of the change in risk-adjusted returns
to the model’s parameterisation. Stated another way, our
model learns from the multiple sources of impact on profit
and loss and targets the appropriate risk position. Finally, the
scientific experiment that we conduct is representative of the
conditions that would be observed in live trading; thus, we
are confident that the resulting performance can realistically
be transferred to industry use.
II. PRELIMINARIES
This section provides a brief overview of the related ideas
that we use in our experimentation, namely transfer learning,
reservoir computing with echo state networks, and a form of
policy gradients reinforcement learning. Finally, we conclude
the section with a literature review of recent publications that
apply reinforcement learning in cryptocurrency trading.
_A._ _TRANSFER LEARNING_
Transfer learning refers to the machine learning paradigm in
which an algorithm extracts knowledge from one or more
application scenarios to help boost the learning performance
in a target scenario [4]. Typically, traditional machine learning requires large amounts of training data. Transfer learning
copes better with data sparsity by looking at related learning
domains where data is sufficient. Even in a big data scenario
such as streaming high-frequency data, transfer learning can
benefit from learning immediately, where data is initially
sparse, and a learner must begin providing forecasts when
asked to do so. An increasing number papers focus on online
transfer learning [9, 10, 11]. Following Pan and Yang [12],
we define transfer learning as:
Definition 1 (transfer learning) . Given a source domain _DS_
and learning task _TS_, a target domain _DT_ and learning task
_TT_, transfer learning aims to help improve the learning of the
target predictive function _fT_ ( _._ ) in _DT_ using the knowledge
in _DS_ and _TS_, where _DS̸_ = _DT_, or _TS̸_ = _TT_ .
_B._ _ECHO STATE NETWORKS_
Echo state networks are a form of recurrent neural network.
They consist of a large, fixed, recurrent reservoir network,
from which the desired output is obtained by training suitable
output connection weights. Determination of the optimal out
put weights is solvable analytically, for example, sequentially
with recursive least squares [6]. Echo state networks are an
example of the reservoir computing paradigm of understanding and training recurrent neural networks, based on treating
the recurrent part (the reservoir) differently than the readouts
from it [13]. Following Jaeger [6], the echo state property
states that:
Definition 2 (echo state property) . If a network is started
from two arbitrary states x 0, x ˜0 and is run with the same
input sequence in both cases, the resulting state sequences
x _T_, x ˜ _T_ converge to each other. If this condition holds, the
reservoir network state will asymptotically depend only on
the input history, and the network is said to be an echo state
network.
The echo state property is guaranteed if the dynamic reservoir weight matrix W <sup>_hidden_</sup> is scaled such that its spectral
radius _ρ_ ( W <sup>_hidden_</sup> ), that is, its largest absolute eigenvalue,
satisfies _ρ_ ( W <sup>_hidden_</sup> ) _<_ 1. This ensures that W <sup>_hidden_</sup> is
contractive. The mathematically correct connection between
the spectral radius and the echo state property is that the latter
is violated if _ρ_ ( W <sup>_hidden_</sup> ) _>_ 1 in reservoirs using the tanh
function as neuron nonlinearity and for zero input [14].
Murray [15] states that the criteria for plausible modelling
on how the brain might perform challenging time-dependent
computations are locality and causality. As the echo state
network uses a fixed, dynamic reservoir of weights, whose
update depends on local information of inputs and activations, with fixed and random feedback, the model offers
a plausible model of biological function. These biological
aspects are explored by Maass and Markram [16] concerning
liquid state machines and more generally with spiking neural
networks in Samadi et al. [17].
Numerous articles demonstrate echo state networks within
a reinforcement learning context. For example, Szita et al.
[18] propose a novel method that uses echo state networks
as function approximators in reinforcement learning. They
emphasise that echo state networks are promising candidates
for partially observable problems where information about
the past may improve performance, such as with k-order
Markov processes. Since echo state networks are effectively
linear function approximators acting on the internal state
representation built from the previous observations, Gordon’s
[19] results about linear function approximators can be transferred to the echo state networks architecture. Building on
this, they provide proof of convergence to a bounded region
for echo state network training in the case of k-order Markov
decision processes.
Shi et al. [20] seek to model the optimal energy management of an office. Time series inputs such as the real-time
electricity rate, renewable energy and energy demand are
made available to an echo state network q-learning model,
which determines the optimal charging/discharging/idle
strategies for the battery in the office so that the total cost
of electricity from the grid can be reduced.
Chen et al. [21] develop a fault-tolerant adaptive tracking
2 VOLUME X 2022
FIGURE 1. A schematic of the echo state network (ESN), combined with the
direct, recurrent reinforcement learning agent (DRL). The ESN part is inspired
by the schematic of Lukoševiˇcius [22] and the DRL part is inspired by the
McCulloch-Pitts schematic of Bishop [23].
control method fused with an echo state network, driven by
reinforcement learning for Euler-Lagrange systems subject to
actuation faults. Specifically, the echo state network implements an associative search network, a control gain network
and an adaptive critic network, resulting in enhanced learning
capabilities and stronger robustness against external uncertainties or disturbances, thus better controlling performance.
_C._ _POLICY GRADIENT REINFORCEMENT LEARNING_
In this section, we summarise our previous preliminary
overview of the policy gradients method [3]. Williams [24]
introduced policy gradient methods in a reinforcement learning context. Whereas the majority of reinforcement learning
algorithms tend to focus on action value estimation, learning
the value of and selecting actions based on their estimated
action values, policy gradient methods learn a parameterised
policy that can select actions without the use of a value
function. Williams also introduced his _reinforce_ algorithm
∆ w _ij_ = _ηij_ ( _r −_ _bij_ ) ln( _∂πi/∂_ w _ij_ ) _,_ (1)
where w _ij_ is the model weight going from the _j_ <sup>_′_</sup> _th_ input
to the _i_ <sup>_′_</sup> _th_ output and w _i_ is the weight vector for the _i_ <sup>_′_</sup> _th_
hidden processing unit in a network of such units, whose
goal it is to adapt in such a way as to maximise the scalar
reward _r_ . The learning rate is _ηij_ and the weight update
of equation 1 is typically applied with gradient ascent. The
reinforcement baseline _bij_, is conditionally independent of
the model outputs _yi_, given the network parameters w and inputs x _i_ . The characteristic eligibility of w _ij_ is ln( _∂πi/∂_ w _ij_ ),
where _πi_ ( _yi_ = _c,_ w _i,_ x _i_ ) is the probability mass function
determining the value of _yi_ as a function of the parameters of
the unit and its input. Baseline subtraction _r_ _−_ _bij_ plays an
important role in reducing the variance of gradient estimators
and Sugiyama [25] shows that the optimal baseline is given
as
where the policy function _π_ ( _at|st,_ w ) denotes the probability
of taking action _at_ at time t given state _st_, parameterised by
w . The main result of Williams’s paper is
Theorem 1. For any _reinforce_ algorithm, the inner product
of E[∆ w _|_ w ] and _∇_ E[ _r|_ w ] is non-negative and if _ηij_ _>_ 0,
then this inner product is zero if and only if _∇_ E[ _r|_ w ] = 0. If
_ηij_ is independent of _i_ and _j_, then E[∆ w _|_ w ] = _η∇_ E[ _r|_ w ].
This result relates _∇_ E[ _r|_ w ], the gradient in weight space
of the performance measure E[ _r|_ w ], to E[∆ w _|_ w ], the average update vector in weight space. Thus for any _reinforce_
algorithm, the average update vector in weight space lies in
a direction for which this performance measure is increasing
and the quantity ( _r −_ _bij_ ) ln( _∂πi/∂_ w _ij_ ) represents an unbiased estimate of _∂_ E[ _r|_ w ] _/∂_ w _ij_ .
1) Policy Gradient Methods in Financial Trading
Moody et al. [7] propose to train trading systems and portfolios by optimising objective functions that directly measure
trading and investment performance. Their model tries to
target a position directly, and the model weights are adapted
to maximise the performance measure. The performance
function that they primarily consider is the differential Sharpe
ratio. The annualised Sharpe ratio [26] is
_sr_ = 252 <sup>0</sup> <sup>_._</sup> <sup>5</sup> _×_ <sup>_<u>µ −</u>_</sup> <sup>_<u>rf</u>_</sup> _,_
_σ_
where _µ_ is the strategy’s return, _σ_ is the standard deviation
of returns, and _rf_ is the risk-free rate. The differential Sharpe
ratio is defined as
(2)
The reward
_rt_ = ∆ _ptft−_ 1 _−_ _δt|_ ∆ _ft|_
depends on the change in reference price _pt_, previous position _ft−_ 1 and transaction costs _δt_ which are applied only
if there is a change in position _|ft_ _−_ _ft−_ 1 _|_ _>_ 0. The
position function is typically differentiable and bounded
_<u>dsrt</u>_ = <sup>_<u>bt−</u>_</sup> <sup><u>1∆</u></sup> <sup>_<u>at −</u>_</sup> <sup><u>0</u></sup> <sup>_<u>.</u>_</sup> <sup><u>5</u></sup> <sup>_<u>at−</u>_</sup> <sup><u>1∆</u></sup> <sup>_<u>bt</u>_</sup>
_dτ_ ( _at−_ 1 _−_ _a_ <sup>2</sup> _t−_ 1 <sup>)3</sup> <sup>_/_</sup> <sup>2</sup>
_<u>dsrt</u>_
<sup><u>5</u></sup> <sup>_<u>at−</u>_</sup> <sup><u>1∆</u></sup> <sup>_<u>bt</u>_</sup> _,_
<sup>2</sup> _t−_ 1 <sup>)3</sup> <sup>_/_</sup> <sup>2</sup>
( _at−_ 1 _−_ _a_ <sup>2</sup> _t_
where the quantities _at_ and _bt_ are exponentially weighted
estimates of the first and second moments of _rt_
_at_ = _at−_ 1 + _τ_ ∆ _at_ = _at−_ 1 + _τ_ ( _rt −_ _at−_ 1)
_bt_ = _bt−_ 1 + _τ_ ∆ _bt_ = _bt−_ 1 + _τ_ ( _rt_ <sup>2</sup> <sup>_−_</sup> <sup>_bt−_</sup> <sup>1)</sup> <sup>_,_</sup>
with _τ_ _∈_ (0 _,_ 1]. They consider a batch gradient ascent update
∆ _θ_ _T_ = _η_ <sup>_<u>dsrT</u>_</sup>
_d_ _θ_ <sup>_,_</sup>
where
_<u>dfd</u>_ _θ_ _<u>t</u>_ <sup>+</sup> _df_ <sup>_<u>dr</u>_</sup> _t−_ <sup>_<u>t</u>_</sup> 1
_<u>dsrT</u>_
_<u>dsrT</u>_ = <sup><u>1</u></sup>
_d_ _θ_ _T_
_<u>drt</u>_
_dft_
_<u>dft−</u>_ <u>1</u>
_d_ _θ_
_T_
_T_
_t_ =1
_T_
_t_ =1
_<u>dsrT</u>_
_drt_
��
_<u>drt</u>_
_dft_
_<u>dfd</u>_ _θ_ _<u>t</u>_ <sup>+</sup> _df_ <sup>_<u>dr</u>_</sup> _t−_ <sup>_<u>t</u>_</sup> 1
= <sup><u>1</u></sup>
_T_
_<u>bT</u>_ _<u>−</u>_ _<u>aT rt</u>_
( _bT_ _−_ _a_ <sup>2</sup> _T_ <sup>)3</sup> <sup>_/_</sup> <sup>2</sup>
_<u>dft−</u>_ <u>1</u>
_d_ _θ_
_._
_b_ <sup>_∗_</sup> = <sup>E</sup> <sup>_p_</sup> <sup>(</sup> <sup>_r|_</sup> <sup>w</sup> <sup>)</sup>
- _rt∥_ <sup>�</sup> <sup>_T_</sup> _<u>t</u>_
<sup>_T_</sup> _<u>t</u>_ <u>=1</u> <sup>_∇_</sup> <sup>ln</sup> <sup>_π_</sup> <sup>(</sup> <sup>_at|st,_</sup> <sup>w</sup> <sup>)</sup> <sup>_∥_</sup> <sup>2�</sup>
E _p_ ( _r|_ w )
<u>�</u> _∥_ <sup><u>�</u></sup> <sup>_T_</sup> _t_
<sup>_T_</sup> _t_ =1 <sup>_∇_</sup> <sup>ln</sup> <sup>_π_</sup> <sup>(</sup> <sup>_at|st,_</sup> <sup>w</sup> <sup>)</sup> <sup>_∥_</sup> <sup>2�</sup> <sup>_,_</sup>
VOLUME X 2022 3
_−_ 1 _≤_ _ft_ _≤_ 1. This position function depends on the model
inputs and parameters _ft_ ≜ _f_ ( x _t_ ; _θ_ _t_ ). The right half of
equation 2 shows the dependency of the model parameters
on the past sequence of trades. To correctly compute and
optimise these total derivatives requires the use of recurrent
algorithms such as backpropagation through time [27, 28] or
real-time recurrent learning [29]. An undesirable property of
the Sharpe ratio is that it penalises a model that produces
returns larger than
_t_ <sup>_∗_</sup> <sup>=</sup> <sup>_<u>bt−</u>_</sup> <sup><u>1</u></sup>
_rt_ <sup>_∗_</sup>
_at−_ 1
_,_
which is counter-intuitive relative to most investors’ notions
of risk and reward [7]. Gold [30] extends Moody et al. [7]
work and investigates high-frequency currency trading with
neural networks trained via recurrent reinforcement learning.
He compares the performance of linear networks with neural
networks containing a single hidden layer and examines the
impact of shared system hyper-parameters on performance.
In general, he concludes that the trading systems may be
effective but that the performance varies widely for different
currency markets, and simple statistics of the markets cannot
explain this variability.
_D._ _REINFORCEMENT LEARNING WITHIN_
_CRYPTOCURRENCY TRADING_
This section provides a brief literature review of reinforcement learning applied to cryptocurrency trading. Before performing this review, it is helpful to describe how returns
net of transaction costs are generated when trading on an
exchange. For example, assume that a single instrument is
traded, such as Bitcoin versus the US Dollar. This instrument
may be a cash or futures instrument. A gross profit (loss) is
generated when Bitcoin is sold higher (lower) than its initial
purchase price. Similar logic is applied for short positions,
albeit with directions swapped. A net profit is observed by
deducting various costs from the gross profit. These costs
vary depending on the execution-style and are differentiated
between price makers and price takers.
A price maker inserts quotes into an exchange limit order
book and executes when a price taker removes the price
maker’s liquidity. The price maker captures half the bid/ask
spread at the time of execution; the execution price is evaluated against the prevailing transaction mid-price (0 _._ 5 _×_ [ _bid_ +
_ask_ ]), where _bid_ _<_ _mid_ _<_ _ask_ . Bid/ask spreads in crypto
tend to be as competitively priced as traditional financial
instruments, although the exchange fees, usually a percentage
of the notional traded, tend to be much higher. The price
maker’s fills are probabilistic, not inevitable. To compensate
the market maker for the uncertainty incurred by providing
liquidity and the risk of adverse selection, they capture half
the bid/ask spread. The price taker obtains the certainty of
immediate fill, subject to competing with other price takers
for the same quoted liquidity. This certainty of fill comes at a
cost, as the price taker must pay half the bid/ask spread and
usually much higher exchange fees than price makers when
trading crypto.
A final cost that must be considered is funding. If one
buys cash crypto without leverage, then it is plausible to
consider no funding cost, and one can consider the purchase as self-funded. However, if one wants to sell cash
crypto short, one needs to borrow the inventory; this attracts
a funding cost. Furthermore, transacting in cryptocurrency
futures on an exchange or contracts for difference in the overthe-counter market attracts a funding cost similar to what
brokers charge for traditional financial instruments. Even if
one trades futures directly on an exchange without a broker,
some crypto derivatives contracts attract funding like traditional foreign exchange instruments do. For example, trading
overnight foreign exchange exposes one to the interest rate
differential between two currency pairs. Similarly, perpetual
crypto swaps attract an intraday funding profit or loss, which
ensures that the swap tracks the underlying cash instrument
within tolerance. We now proceed with the literature review.
Jiang and Liang [31] supply a convolutional neural network with historical prices of a set of crypto assets as its
input, outputting portfolio weights of the set of assets. The
network is trained on less than a year of price data from the
Poloniex cryptocurrency exchange. The training is done in
a reinforcement learning manner, maximising the accumulated return as the reward function of the network. Using
30 minutely sampled closing prices, they conduct backtests
which achieve ten-fold returns. In addition, they set exchange
trading transaction fees of 25 basis points (25e-4) times the
notional value traded of the base cryptocurrency. However,
since they use closing prices to execute with a certainty of
fill without applying half the observable bid/ask spread cost
at the time of execution, the empirically observed backtest
results do not represent the actual cost of trading and are thus
more sanguine than reality.
Lee et al. [32] present a novel method to predict Bitcoin
price movement using inverse reinforcement learning [33]
and agent-based modelling. Their approach predicts the price
by reproducing synthetic yet realistic behaviours of rational
agents in a simulated market. Inverse reinforcement learning
provides a systematic way to find the behavioural rules of
each agent from Blockchain data by framing the trading
behaviour estimation as a problem of recovering motivations
from observed behaviour and generating rules consistent with
these motivations. Once the rules are recovered, an agentbased model creates hypothetical interactions between the
recovered behavioural rules, discovering equilibrium prices
as emergent features through matching the supply and demand of Bitcoin. Their model is used to forecast the market’s
direction, and their results show that their proposed method
can predict short-term market prices while outlining overall
market trends. However, their experiments do not include the
impact of holding risk, transaction or funding costs.
Lucarelli and Borrotti [34] apply deep reinforcement
learning to trading Bitcoin. More precisely, double deep qlearning [35] and duelling double deep q-learning [36] networks are trained in batch mode using 80% of the four years
of data that they have available. The remaining 20% of the
4 VOLUME X 2022
data is used for out of sample testing. Two reward functions
are also tested: Sharpe ratio and profit reward functions. They
find that the double deep q-learning trading system based
on the Sharpe ratio reward function is the most profitable
approach for trading Bitcoin. We note that the authors collect
their data from Kaggle rather than from an actual crypto
exchange and that they use minutely sampled open-highlow-close prices rather than actual order book bids and asks.
As such, accurate transaction costs cannot be used in their
experiment. Furthermore, no indication is made in their paper
that they use any form of funding or exchange trading fees in
their returns calculations.
Zhang et al. [37] note that portfolio selection is difficult
as the nonstationarity of financial time series and their complex correlations make the learning of feature representation
challenging. They propose a cost-sensitive portfolio selection
method with deep reinforcement learning. Specifically, a
novel two-stream portfolio policy network is devised to extract price time series patterns and asset correlations, while a
new cost-sensitive reward function is developed to maximise
the accumulated return and constrain costs via reinforcement
learning. They empirically evaluate their proposed method
on real-world datasets from the Poloniex crypto exchange.
Promising results demonstrate the effectiveness and superiority of the proposed method in terms of profitability, costsensitivity and representation abilities. Once more, however,
transaction costs are not fully accounted for in their experiment. For example, they assume a fixed transaction cost of
25 basis points times the notional value traded of the base
cryptocurrency; however, they also use open-high-low-close
prices, sampled every 30 minutes. The closing prices they
use assume that execution is immediate. In reality, however,
immediate execution may only be achieved by crossing the
spread; this additional cost must be modelled, which usually
turns a theoretically profitable strategy that executes at the
closing price or mid-price into a loss-making one.
III. THE RESEARCH EXPERIMENT
We begin with a discussion of the research data we use in
our experiment, followed by an elucidation of the research
methods and a description of the experiment results. As a
high-level summary, our experiment aims to explore transfer
learning using a source model, an echo state network and
a target model, a direct, recurrent, reinforcement learning
agent. The objective of this meta-model is to learn to trade
digital asset futures, specifically perpetual contracts on the
BitMEX crypto exchange. Finally, the dynamical reservoir
of the echo state network acts as a powerful nonlinear feature
space; this is fed into the upstream recurrent reinforcement
learner, who is aware of the various sources of impact on
profit or loss and learns to target the desired position.
_A._ _THE BITMEX XBTUSD PERPETUAL SWAP_
The data that we experiment with is from the BitMEX cryptocurrency derivatives exchange. In 2016 they launched the
XBTUSD perpetual swap, where clients trade Bitcoin against
the US Dollar. The perpetual swap is similar to a traditional
futures contract, except there is no expiry or settlement.
It mimics a margin-based spot market and trades close to
the underlying reference index price. A funding mechanism
is used to tether the contract to its underlying spot price.
In contrast, a futures contract may trade at a significantly
different price due to the basis
_basist_ = _futurest −_ _indext._
The basis means different things in different markets. For
example, in the oil market, the demand for spot oil can
outpace the demand for futures oil, especially if OPEC withholds supply, leading to a higher spot price; this results in a
futures curve in a state of backwardation. The crypto futures
normally trade in a state of contango, where the futures prices
trade at a higher rate than the spot prices. Backwardation or
contango in crypto markets does not represent supply and
demand shortages in an economic sense but rather reflects
risk appetite for crypto. Similar effects happen in the equity
markets. As with the equity markets, crypto market participants can take risks in the futures market more easily. The
spot markets typically do not offer leverage, and the trader
must have inventory in the exchange to trade. In contrast,
futures allow traders to sell assets short with leverage and
without borrowing the underlying asset. However, what is
required is a margin or deposit to fund the position. Figure 2
shows the basis in relative terms for the XBTUSD perpetual
swap during the bear market of 2018. The mid-price of the
perpetual swap is compared against the underlying index it
tracks, .BXBT. The relative basis is computed as
For example, with the XBTUSD perpetual swap, the interest
rate of borrowing in US Dollars is denoted by _e_ <sup>_quote_</sup> _t_ and
the interest rate of borrowing in Bitcoin is represented by
_e_ <sup>_base_</sup> _t_ . As funding occurs every 8 hours, _T_ = 8. The basis
premium/discount component is computed in a manner similar to equation 3, with some subtleties applied to minimise
_rbasist_ = <sup>_<u>futurest −</u>_</sup> <sup>_<u>indext</u>_</sup>
_indext_
_._ (3)
Before this bear market, Bitcoin hit a then all-time high of
$20,000, and the 100-day exponentially weighted moving
average of relative basis was very positive in late 2017.
For most of 2018 and 2019, the basis was largely negative,
reflecting the cash market sell-off from all-time highs to circa
USD 3,000.
1) Funding
The funding rate for the perpetual swap comprises two parts:
an interest rate differential component and the premium or
discount of the basis. We denote this funding rate as _κt_ .
The interest differential reflects the borrowing cost of each
currency involved in the pair
_<u>t</u>_
_et_ = <sup>_<u>equote</u>_</sup>
_<u>t</u>_ _._
_T_
_<u>t</u>_ _<u>−</u>_ _<u>e</u>_ <sup>_base_</sup> _<u>t</u>_
<sup>_quote_</sup>
VOLUME X 2022 5
FIGURE 2. XBTUSD basis during the bear market of 2019
market manipulation, such as the use of time and volume
weighted average prices. The funding rate is finally
_κt_ = _bt_ + _max_ ( _min_ [ _ζet −_ _bt_ ] _, −ζ_ ) _,_ (4)
where _ζ_ is a basis cap, typically 5 basis points (0.05%). When
the basis is positive, traders with long positions (buy XBT,
sell USD) will pay those with short positions (sell XBT,
buy USD). Reciprocally, shorts pay longs when the basis is
negative.
_B._ _THE RECURRENT REINFORCEMENT LEARNING_
_CRYPTO AGENT_
We begin with a description of the dynamic reservoir feature space, the resultant learning of which is transferred
to the direct, recurrent reinforcement learner, which targets
the desired risk position. It is worth highlighting where our
approach deviates from the traditional use of echo state
networks within a reinforcement learning context. Figure 1
demonstrates visually that the target labels, the so-called
teacher signal, can be fed back into the dynamic reservoir.
Equally, one could apply a regression layer to the echo state
network and feed the resulting forecasts into the dynamic
reservoir. Both approaches make the echo state network
recurrent then. We value this recurrent nature in a trading
context, as we wish to feed information about the current
position back into the model. However, rather than treating
this exercise as a value function estimation task as with Szita
et al. [18], we feed the augmented, dynamic reservoir features
of the echo state network to a direct recurrent reinforcement
learner. By differentiating a quadratic utility function with
respect to the recurrent reinforcement learner’s parameters,
with feedback connections from the agent’s past positions fed
back into the echo state network dynamic reservoir, the agent
learns from the various sources of impact on profit and loss
and targets the appropriate position that maximises the riskadjusted reward.
1) The Dynamic Reservoir Feature Space
Denote as u _t_, a vector of external inputs to the system,
which is observed at time _t_ . In the context of this experiment, such external input would include order book, transaction and funding information. These features may come
from the instrument being traded, exogenous instruments, or
both. Initialise the external input weight matrix W <sup>_input_</sup> _∈_
R <sup>_nhidden×ninput_</sup>, where the weights are drawn at random; a
draw from a standard normal would suffice. Here, _nhidden_
denotes the number of hidden processing units in the internal
dynamical reservoir and _ninput_ is the number of external inputs, including a bias term. Next we initialise the hidden processing units weight matrix, W <sup>_hidden_</sup> _∈_ R <sup>_nhidden×nhidden_</sup> .
The procedure detailed by Yildiz et al. [38] is
_•_ Initialise a random matrix W <sup>_hidden_</sup>, all with nonnegative entries.
_•_ Scale W <sup>_hidden_</sup> such that its spectral radius _ρ_ ( W <sup>_hidden_</sup> ) _<_
1.
_•_ Change the signs of a desired number of entries of
W <sup>_hidden_</sup> to get negative connection weights as well.
_•_ Sparsify W <sup>_hidden_</sup> with probability _P_ ( _α_ ) _,_ 0 _≪_ _α_ _<_ 1,
setting those elements to zero.
This procedure is guaranteed to ensure the echo state property
for any input. Intuitively, a recurrent neural network has the
echo state property concerning an input signal u _t_, if any
initial network state is forgotten or washed out when the
network is driven by u _t_ for long enough [39]. The model
supports recurrent connections from either a teacher signal
y _t_ _∈_ R <sup>_nback_</sup> or model output y ˆ _t_ _∈_ R <sup>_nback_</sup> . These are
connected to the model via the weight matrix W <sup>_back_</sup> _∈_
R <sup>_nhidden×nback_</sup>, whose weights are initialised at random from
a standard normal. Note that W <sup>_input_</sup>, W <sup>_hidden_</sup> and W <sup>_back_</sup>,
have weights that remain fixed.
Finally, initialise the output weight vector w 0 <sup>_out_</sup> _∈_
R <sup>_ninput_</sup> <sup>+</sup> <sup>_nhidden_</sup> <sup>+</sup> <sup>_nback_</sup> . It is at this point that our procedure
differs from the original echo state network formulation
shown by Jaeger [6]. There, w <sup>_out_</sup> is a matrix W <sup>_out_</sup> _∈_
R <sup>_nback×_</sup> <sup>(</sup> <sup>_ninput_</sup> <sup>+</sup> <sup>_nhidden_</sup> <sup>+</sup> <sup>_nback_</sup> <sup>)</sup> and the performance measure
of the model is the quadratic loss
The reasons will become apparent shortly when we detail
the model’s direct, recurrent reinforcement learning part. But
first, we must describe how we create the augmented state of
the system, z _t_ _∈_ R <sup>_ninput_</sup> <sup>+</sup> <sup>_nhidden_</sup> <sup>+</sup> <sup>_nback_</sup> . Firstly, we initialise
a zero-valued internal state vector x 0 _∈_ R <sup>_nhidden_</sup> . Then at
time _t_, we compute the recurrent internal state
x _t_ = _fhidden_ ( W <sup>_input_</sup> u _t_ + W <sup>_hidden_</sup> x _t−_ 1 + W _t_ <sup>_back_</sup> y ˆ _t_ ) _,_
where _fhidden_ ( _._ ) is typically a squashing function such as the
hyperbolic tangent. The augmented, recurrent system state is
then
z _t_ = [ u _t,_ x _t,_ ˆ y _t_ ] _._ (5)
_T_
�( _yt −_ W <sup>_out_</sup> z _t_ ) <sup>2</sup> _._
_t_ =1
min
W <sup>_out_</sup>
<u>1</u>
2 _T_
6 VOLUME X 2022
Equation 11 defines what y ˆ _t_ represents, namely the past desired positions of the direct, recurrent reinforcement learning
agent.
2) Direct Recurrent Reinforcement Learning
The augmented, internal feature state, z _t_, is now fed into the
upstream model, a direct, recurrent neural network, whose
performance measure is a quadratic utility function of reward
and risk. For the reader’s benefit and the fact that we use the
same target transfer learning model, we describe the dynamics of the direct, recurrent reinforcement learner in a manner
similar to our earlier work [3]. Sharpe [40] discusses asset
allocation as a function of expected utility maximisation,
where the utility function may be more complex than that
associated with mean-variance analysis. Denote the expected
utility for a single asset portfolio as
_υt_ = _µt −_ <sup>_<u>λ</u>_</sup> 2 <sup>_σ_</sup> _t_ <sup>2</sup> <sup>_,_</sup> (6)
where the expected return _µt_ and variance of returns _σt_ <sup>2</sup> <sup>may</sup>
be estimated in an online fashion with exponential decay
_µt_ = _τµt−_ 1 + (1 _−_ _τ_ ) _rt,_ (7)
The model is maximally short when _ft_ = _−_ 1 and maximally
long when _ft_ = 1. The past positions of the model are used
as the feedback connections for equation 5
y ˆ _t_ = [ _ft−nback_ _, ..., ft−_ 1] _._ (11)
The goal of our recurrent reinforcement learner is to
maximise the utility in equation 6, by targeting a position
in equation 10. To do this, we apply an online optimisation
update of the form
w _t_ <sup>_out_</sup>
_t_ <sup>_out_</sup> = w _t_ <sup>_out_</sup> _−_ 1
_t_ <sup>_out_</sup> _−_ 1 <sup>+</sup> <sup>_∇υt_</sup> <sup>_≡_</sup> <sup>∆</sup> <sup>w</sup> _t_ <sup>_out_</sup>
_<u>dυt</u>_
_t_ <sup>_out_</sup> +
_d_ w _t_ <sup>_out_</sup>
_,_
_t_
_t_ <sup>2</sup> <sup>=</sup> <sup>_τσ_</sup> _t_ <sup>2</sup>
_σt_ <sup>2</sup>
_t_ <sup>2</sup> _−_ 1 <sup>+ (1</sup> <sup>_−_</sup> <sup>_τ_</sup> <sup>)(</sup> <sup>_rt_</sup> <sup>_−_</sup> <sup>_µt_</sup> <sup>)2</sup> <sup>_._</sup>
The risk appetite constant _λ_ _>_ 0, can be set as a function
of an investor’s desired risk-adjusted return, as demonstrated
by Kahn [41]. Define the annualised information ratio as the
risk-adjusted differential reward measure, where the difference is taken against a benchmark or baseline strategy
where the weight update procedure is an extended Kalman
filter for neural networks [42, 43], albeit modified for reinforcement learning in this context; sequential updates are
applied as per algorithm 1.
<u>Algorithm 1:</u> <u>extended Kalman filter</u>
Require: _β_, _τ_
// _β_ _≥_ 0 is a Ridge penalty.
// 0 _≪_ _τ_ _≤_ 1 is an exponential decay
factor.
Initialise: _d_ = _ninput_ + _nhidden_ + _nback_
w <sup>_out_</sup> = 0 _d_, P = I _d/β_
// 0 _d_ is a zero vector in R <sup>_d_</sup> .
// P is the precision matrix in R <sup>_d×d_</sup> .
Input: _∇υt_
Output: w _t_ <sup>_out_</sup>
1 _q_ = 1 + _∇υt_ <sup>_T_</sup> <sup>P</sup> <sup>_t−_</sup> <sup>1</sup> <sup>_∇υt/τ_</sup>
2 k = P _t−_ 1 _∇υt/_ ( _qτ_ )
3 w _t_ <sup>_out_</sup> = w _t_ <sup>_out_</sup> _−_ 1
_irt_ = 252 <sup>0</sup> <sup>_._</sup> <sup>5</sup> _×_ <sup>_<u>µt −</u>_</sup> <sup>_<u>bt</u>_</sup>
_σt_
_t_ <sup>_out_</sup> _−_ 1 <sup>+</sup> <sup>k</sup>
_._
4 P _t_ = P _t−_ 1 _/τ_ _−_ kk <sup>_T_</sup> _q_
Substituting the non-annualised information ratio into the
quadratic utility and differentiating it against the risk, we
obtain a suitable value for the risk appetite parameter
_λ_ = <sup>_<u>irt</u>_</sup>
_σt_
_._
The net returns whose expectation and variance we seek to
learn, are decomposed as
_rt_ = ∆ _ptft−_ 1 _−_ _δt|_ ∆ _ft| −_ _κtft,_ (8)
where ∆ _pt_ is the change in reference price, typically a mid
price
∆ _pt_ = 0 _._ 5 _×_ ( _bidt_ + _askt −_ _bidt−_ 1 _−_ _askt−_ 1) _,_
_δt_ represents the execution cost for a price taker
_δt_ = 0 _._ 5 _×_ ( _askt −_ _bidt_ ) _,_ (9)
_κt_ is the funding cost (see subsection III-A) and _ft_ is the
desired position learnt by the recurrent reinforcement learner
5 P _t_ = P _tτ_ // variance stabilisation
Above, P _t_ is an approximation to _∇_ <sup>2</sup> _υt_, the inverse Hessian of the utility function _υt_ with respect to the model
weights w _t_ <sup>_out_</sup> . We decompose the gradient of the utility
function with respect to the recurrent reinforcement learner’s
parameters as follows
- _<u>drt</u>_
_dft_
_<u>dft</u>_
_d_ w _t_ <sup>_out_</sup>
_∇υt_ = <sup>_<u>dυt</u>_</sup>
_drt_
_∇υt_ = <sup>_<u>dυt</u>_</sup>
+ <sup>_<u>drt</u>_</sup>
_dft−_ 1
_<u>dft−</u>_ <u>1</u>
_d_ w _t_ <sup>_out_</sup> _−_ 1
_t_
��
_<u>drt</u>_
_dft_
- _<u>∂ft</u>_
_∂_ w _t_ <sup>_out_</sup>
_<u>∂ft</u>_
+
_∂ft−_ 1
_<u>∂ft−</u>_ <u>1</u>
_∂_ w _t_ <sup>_out_</sup> _−_ 1
=
_<u>dυt</u>_ _<u>dµt</u>_
_dµt_ _drt_
+ <sup>_<u>dυt</u>_</sup>
_dσt_ <sup>2</sup>
_<u>dσt</u>_ <sup>2</sup>
_drt_
- _<u>∂ft</u>_
_∂_ w _t_ <sup>_out_</sup>
+ <sup>_<u>∂ft−</u>_</sup> <sup><u>1</u></sup>
_∂ft−_ 2
+ <sup>_<u>drt</u>_</sup>
_dft−_ 1
+ <sup>_<u>drt</u>_</sup>
- _<u>∂ft−</u>_ <u>1</u>
_∂_ w _t_ <sup>_out_</sup> _−_ 1
- _<u>∂ft−</u>_ <u>1</u>
_∂_ w _t_ <sup>_out_</sup> _−_
_<u>∂ft−</u>_ <u>2</u>
_∂_ w _t_ <sup>_out_</sup> _−_ 2
- <sup>�</sup>
_._
(12)
The constituent derivatives for the left half of equation 12
are:
_<u>dυt</u>_
= (1 _−_ _η_ )[1 _−_ _λ_ ( _rt −_ _µt_ )] _,_
_drt_
_<u>drt</u>_
_dft_
= _−δt × sign_ (∆ _ft_ ) _−_ _κt,_
_ft_ = _tanh_
�[ w _t_ <sup>_out_</sup> ] <sup>_T_</sup> z _t_
- _._ (10)
VOLUME X 2022 7
_<u>dft</u>_
_d_ w _t_ <sup>_out_</sup>
_t,n_ <sup>_out_</sup> <sup>[1</sup> <sup>_−_</sup> <sup>tanh2 ([</sup> <sup>w</sup> _t_ <sup>_out_</sup>
= z _t_ [1 _−_ tanh <sup>2</sup> ([ w _t_ <sup>_out_</sup> ] <sup>_T_</sup> z _t_ )]
+ w _t,n_ <sup>_out_</sup>
_t_ <sup>_out_</sup> ] <sup>_T_</sup> z _t_ )]
_×_ z _t−_ 1[1 _−_ tanh <sup>2</sup> ([ w _t_ <sup>_out_</sup> _−_ 1
_t_ <sup>_out_</sup> _−_ 1 <sup>]</sup> <sup>_T_</sup> <sup>z</sup> <sup>_t−_</sup> <sup>1)]</sup> <sup>_,_</sup>
where _n_ = _ninput_ + _nhidden_ + _nback_ _−_ 1, using 0 as the
starting index.
_C._ _EXPERIMENT DESIGN_
We put a recurrent reinforcement learning crypto agent to
work by trading the XBTUSD (Bitcoin vs US Dollar) perpetual swap on BitMEX. We transfer the output of the source
model, the dynamic reservoir feature space of subsection
III-B1, to the target model, the direct recurrent reinforcement learner of subsection III-B2, who learns to target a
risk position directly. Finally, we use five minutely sampled
intraday data. The choice of this sampling rate is driven by
the throttle imposed by the vendor on retrieving historical
data; if we could obtain the raw, asynchronously delivered
tick data promptly, we would do so. Nevertheless, we are
still using 365 _×_ 5 _×_ 1440 _/_ 5 = 525600 observations in our
experiment. Our performance evaluation procedure involves
the following:
_•_ Construct input features from the order book and trade
information made available by BitMEX for XBTUSD.
_•_ Feed these input features into an echo state network,
with _nhidden_ = 100, _nback_ = 10 and the percentage
of reservoir units W <sup>_hidden_</sup> that are sparsified, set to
_α_ = 0 _._ 75.
_•_ Feed the output of the echo state network (equation 5)
into a direct, recurrent reinforcement learner (subsection
III-B2).
_•_ Set the risk appetite constant _λ_ = 0 _._ 00001 for quadratic
utility equation 6.
_•_ Set the ridge penalty _β_ = 1 and the exponential decay
factor _τ_ = 0 _._ 999 for the extended Kalman filter of
algorithm 1.
_•_ Backtest the entire history as a test set.
_•_ Learn sequentially online to target the desired position.
_•_ Force the agent to trade as a price taker, who incurs an
execution cost equal to equation 9 plus exchange fees,
which are set to 5 basis points (0.05%).
_•_ For non-zero risk positions, apply the appropriate funding profit or loss as per equation 4.
_•_ Monitor equation 7, the expected net reward of the
strategy. The crypto agent can trade freely if _µt_ _≥_ 0.
Otherwise, close the position and wait for an opportunity to enter the market again.
_D._ _RESULTS_
Table 1 and figure 3 show the results of the experiment.
The crypto agent achieves a total return of just under 350%
over a test set that is less than five years. The associated
annualised information ratio is 1.46. Denoting the maximally
short position as -1, no position as 0 and the maximally long
position as 1, we see that the agent averages a position of
0.41. Thus there is a bias toward the agent maintaining a
long position, which is desirable, as Bitcoin has appreciated
against the US Dollar over this period. We see visual evidence in figure 3 that on occasion, the crypto agent abstains
from trading, or rather is forced to take no position; this will
happen during periods when the predictive performance of
the agent decreases relative to execution and funding costs.
Our crypto agent also captures a 71% cumulative return due
to earning funding, which is expected as the agent learns to
target the appropriate position that maximises its quadratic
utility, and funding is one of the drivers of this utility. The
total execution cost and exchange fees that the agent pays out
is -54%.
FIGURE 3. cumulative returns for the XBTUSD crypto agent
TABLE 1. daily pnl statistics for the XBTUSD crypto agent
position execution carry pnl
count 1684 1684 1684 1684
mean 0.405 -0.000 0.000 0.002
std 0.579 0.001 0.005 0.027
min -0.990 -0.019 -0.014 -0.155
25 % 0.000 0.000 -0.000 0.000
50 % 0.000 0.000 0.000 0.000
75 % 0.990 0.000 0.000 0.003
max 0.990 0.000 0.014 0.177
sum -0.542 0.713 3.498
ir 1.46
IV. DISCUSSION
The echo state network provides a robust and scalable feature
space representation. We transfer this learning representation
to a recurrent reinforcement learning agent that learns to
target a position directly. It is possible to use the echo state
network as a reinforcement learning agent itself, as shown by
Szita et al. [18]. However, the approach may lead to undesired
behaviour in a trading context. Specifically, they use an echo
state network to estimate the state-action value function of a
8 VOLUME X 2022
temporal difference learning sarsa model [44, 5]. This value
function takes the form
_qπ_ ( _s, a_ ) = E _π{rt|st, at},_
where the expected return _rt_ depends on the transition to state
_st_ having taken action _at_ under policy _π_ . Sarsa estimates this
value function sequentially as
_q_ ( _st, at_ ) = (1 _−η_ ) _q_ ( _st, at_ )+ _η_ [ _rt_ +1+ _γq_ ( _st_ +1 _, at_ +1)] _,_ (13)
where 0 _< γ_ _≤_ 1 is a discount factor for multi-step rewards,
and _η_ _>_ 0 is a learning rate. Equation 13 shows that the
state transition reward is passed back to the starting state. In
activities such as maze traversal or board games, being aware
of the reward associated with multiple steps or decisions and
passing that reward back to the current position is of great
value. However, in the context of trading, where the value
function _q_ ( _st, at_ ) represents the value of a position _st_, with
the possibility of switching or remaining in the same position
denoted by action _at_, we will on occasion find that a larger
utility is assigned to the wrong state. For example, imagine
the current state is _st_ = 0, that is, the model has no position.
Now we observe a large positive price jump leading to large
positive reward _rt_ +1 _≫_ 0. Value function estimators such as
equation 13 would pass the state transition reward _rt_ +1 to the
initial state _q_ ( _st_ = 0 _, at_ = 0). At the next iteration, with
probability _Pr_ (1 _−_ _ϵ_ ), _st_ +1 = 0 as _q_ ( _st_ +1 = 0 _, at_ +1 = 0)
is the highest value function. However, if the position is zero,
the model cannot hope to earn a profit. Even if one excludes
the zero state, then there is still the possibility of observing
this problem for a reversal strategy with possible states _s_ =
_{−_ 1 _,_ 1 _}_ . Direct reinforcement, as we describe it, does not
incur these problems and we have, through transfer learning,
improved upon the earlier work in direct reinforcement [7,
30] and extended the work of Borrageiro et al. [3].
V. LIMITATIONS OF THE WORK
As previously discussed in subsection III-B1, the various
echo state network parameters are initialised at random.
Figure 4 and table 2 measure the impact of this randomness
on test set performance. We run a Monte Carlo simulation
of 250 trials, where the network parameterisation is fixed to
_θ_ = _{nhidden_ = 100 _, nback_ = 10 _}_ . The information ratios
in this set of simulations vary from 0.219 to 1.763, with
total returns between 65.4% and 502.1%. Whilst this does
show evidence of a reasonable variability of returns, table
2 also shows that 95% of the mean information ratios vary
between 1.1 and 1.2 and 95% of the mean total returns vary
between 289% and 307%. Thus the overall picture remains
unchanged, that being that the transfer learning crypto agent
has successfully learnt how to trade this instrument during the
test period. Other than this acceptable sensitivity to weight
initialisation, we make no assumptions that would otherwise
cause our results to be violated if these assumptions were not
met.
FIGURE 4. Monte Carlo simulation, information ratio versus total return
TABLE 2. Monte Carlo simulation, information ratio versus total return
ir total return
count 250 250
mean 1.160 2.977
std 0.299 0.740
min 0.219 0.654
25% 1.023 2.572
50% 1.199 3.076
75% 1.355 3.352
max 1.763 5.021
se(mean) 0.019 0.047
lb(mean) 1.123 2.886
ub(mean) 1.197 3.069
VI. CONCLUSION
We demonstrate an application of online transfer learning as
a digital assets trading agent. This agent uses a powerful
feature space representation in the form of an echo state
network, the output of which is made available to a direct,
recurrent reinforcement learning agent. The agent learns to
trade the XBTUSD (Bitcoin versus US Dollars) perpetual
swap derivatives contract on BitMEX. It learns to trade
intraday on five minutely sampled data, avoids excessive
over-trading, captures a funding profit and is also able to
predict the direction of the market. Overall, our crypto agent
realises a total return of 350%, net of transaction costs, over
roughly five years, 71% of which is down to funding profit.
The annualised information ratio that it achieves is 1.46.
REFERENCES
[1] R. H. Shumway, Time series analysis and its applica
tions : with R examples, 3rd ed., ser. Springer texts in
statistics. Springer, 2011. 1
[2] C. W. J. Granger and P. Newbold, “Spurious regressions
in econometrics,” Journal of econometrics, vol. 2, pp.
111–120, 1974. 1
[3] G. Borrageiro, N. Firoozye, and P. Barucca, “Reinforce
ment learning for systematic fx trading,” IEEE Access,
VOLUME X 2022 9
vol. 10, pp. 5024–5036, 2022. 1, 3, 7, 9
[4] Q. Yang, Y. Zhang, W. Dai, and S. J. Pan, Transfer
Learning. Cambridge University Press, 2020. 1, 2
[5] R. S. Sutton and A. G. Barto, Reinforcement Learning:
An Introduction. Cambridge, MA, USA: A Bradford
Book, 2018. 1, 9
[6] H. Jaeger, “Adaptive nonlinear system identification
with echo state networks,” in NIPS, 2002. 1, 2, 6
[7] J. Moody, L. Wu, Y. Liao, and M. Saffell, “Performance
functions and reinforcement learning for trading systems and portfolios,” Journal of Forecasting, vol. 17, pp.
441–470, 1998. 1, 3, 4, 9
[8] M. M. Dacorogna, R. Gencay, S. Altunç, O. V. Pictet,
and R. Olsen, An Introduction to High-Frequency Finance. Academic Press, 2001. 1
[9] P. Zhao, S. C. H. Hoi, J. Wang, and B. Li, “Online
transfer learning,” Artificial intelligence, vol. 216, pp.
76–102, 2014. 2
[10] B. K. Salvalaio and G. de Oliveira Ramos, “Self
adaptive appearance-based eye-tracking with online
transfer learning,” in 2019 8th Brazilian Conference on
Intelligent Systems (BRACIS). IEEE, 2019, pp. 383–
388. 2
[11] X. Wang, X. Wang, and Z. Zeng, “A novel weight
update rule of online transfer learning,” in 2020 12th
International Conference on Advanced Computational
Intelligence (ICACI). IEEE, 2020, pp. 349–355. 2
[12] S. J. Pan and Q. Yang, “A survey on transfer learning,”
IEEE Transactions on Knowledge and Data Engineering, vol. 22, pp. 1345–1359, 2010. 2
[13] M. Lukosevicius, H. Jaeger, and B. Schrauwen, “Reser
voir computing trends,” KI - Künstliche Intelligenz,
vol. 26, pp. 365–371, 2012. 2
[14] M. Lukosevicius and H. Jaeger, “Reservoir computing
approaches to recurrent neural network training,” Comput. Sci. Rev., vol. 3, pp. 127–149, 2009. 2
[15] J. M. Murray, “Local online learning in recurrent net
works with random feedback,” eLife, vol. 8, 2019. 2
[16] W. Maass and H. Markram, “On the computational
power of circuits of spiking neurons,” J. Comput. Syst.
Sci., vol. 69, pp. 593–616, 2004. 2
[17] A. Samadi, T. P. Lillicrap, and D. B. Tweed, “Deep
learning with dynamic spiking neurons and fixed feedback weights,” Neural Computation, vol. 29, pp. 578–
602, 2017. 2
[18] I. Szita, V. Gyenes, and A. L˝orincz, “Reinforcement
learning with echo state networks,” in Artificial Neural Networks - ICANN 2006. Berlin, Heidelberg:
Springer Berlin Heidelberg, 2006, pp. 830–839. 2, 6,
8
[19] G. J. Gordon, “Reinforcement learning with function
approximation converges to a region,” in NIPS, 2000.
2
[20] G. Shi, D. Liu, and Q. Wei, “Echo state network-based
q-learning method for optimal battery control of offices
combined with renewable energy,” Iet Control Theory
and Applications, vol. 11, pp. 915–922, 2017. 2
[21] Q. Chen, Y. Jin, and Y. Song, “Fault-tolerant adaptive
tracking control of euler-lagrange systems - an echo
state network approach driven by reinforcement learning,” Neurocomputing, 2021. 2
[22] M. Lukoševiˇcius, A Practical Guide to Applying Echo
State Networks. Berlin, Heidelberg: Springer Berlin
Heidelberg, 2012, pp. 659–686. 3
[23] C. M. Bishop, “Neural networks and their applications,”
Review of Scientific Instruments, vol. 65, no. 6, pp.
1803–1832, 1994. 3
[24] R. J. Williams, “Simple statistical gradient-following
algorithms for connectionist reinforcement learning,”
Machine Learning, vol. 8, 5 1992. 3
[25] M. Sugiyama, Statistical Reinforcement Learning,
1st ed. CRC Press, 2015. 3
[26] W. F. Sharpe, “Mutual fund performance,” The Journal
of Business, vol. 39, 1 1966. 3
[27] D. E. Rumelhart, G. E. Hinton, and R. J. Williams,
“Learning internal representations by error propagation,” California Univ San Diego La Jolla Inst for Cognitive Science, Tech. Rep., 1985. 4
[28] P. Werbos, “Backpropagation through time: what it does
and how to do it,” Proceedings of the IEEE, vol. 78,
no. 10, pp. 1550–1560, 1990. 4
[29] R. J. Williams and D. Zipser, “A learning algorithm for
continually running fully recurrent neural networks,”
Neural computation, vol. 1, pp. 270–280, 1989. 4
[30] C. Gold, “Fx trading via recurrent reinforcement learn
ing,” in IEEE. IEEE, 2003. 4, 9
[31] Z. Jiang and J. Liang, “Cryptocurrency portfolio man
agement with deep reinforcement learning,” in 2017
Intelligent Systems Conference (IntelliSys), 2017, pp.
905–913. 4
[32] K. Lee, S. Ulkuatam, P. Beling, and W. Scherer, “Gener
ating synthetic bitcoin transactions and predicting market price movement via inverse reinforcement learning
and agent-based modeling,” Journal of Artificial Societies and Social Simulation, vol. 21, no. 3, p. 5, 2018.
4
[33] S. Russell, “Learning agents for uncertain environ
ments,” in Proceedings of the Eleventh Annual Conference on Computational Learning Theory, ser. COLT’
98. New York, NY, USA: Association for Computing
Machinery, 1998, p. 101–103. 4
[34] G. Lucarelli and M. Borrotti, “A deep reinforcement
learning approach for automated cryptocurrency trading,” in Artificial Intelligence Applications and Innovations. Cham: Springer International Publishing, 2019,
pp. 247–258. 4
[35] V. Mnih, K. Kavukcuoglu, D. Silver, A. Graves,
I. Antonoglou, D. Wierstra, and M. Riedmiller, “Playing atari with deep reinforcement learning,” 2013. 4
[36] Z. Wang, T. Schaul, M. Hessel, H. Van Hasselt,
M. Lanctot, and N. De Freitas, “Dueling network architectures for deep reinforcement learning,” in Proceed
10 VOLUME X 2022
ings of the 33rd International Conference on International Conference on Machine Learning - Volume 48,
ser. ICML’16. JMLR.org, 2016, p. 1995–2003. 4
[37] Y. Zhang, P. Zhao, Q. Wu, B. Li, J. Huang, and M. Tan,
“Cost-sensitive portfolio selection via deep reinforcement learning,” IEEE Transactions on Knowledge and
Data Engineering, vol. 34, no. 1, pp. 236–248, 2022. 5
[38] I. B. Yildiz, H. Jaeger, and S. J. Kiebel, “Re-visiting
the echo state property,” Neural networks : the official
journal of the International Neural Network Society,
vol. 35, pp. 1–9, 2012. 6
[39] H. Jaeger, “Using conceptors to manage neural long
term memories for temporal patterns,” Journal of Machine Learning Research, vol. 18, pp. 13:1–13:43, 2017.
6
[40] W. F. Sharpe, “Expected utility asset allocation,” Finan
cial Analysts Journal, vol. 63, no. 5, pp. 18–30, 2007.
7
[41] R. C. G. R. N. Kahn, Advances in Active Portfolio Man
agement: New Developments in Quantitative Investing.
McGraw-Hill Education, 2019. 7
[42] R. J. Williams, “Training recurrent networks using the
extended kalman filter,” in [Proceedings 1992] IJCNN
International Joint Conference on Neural Networks,
vol. 4, 1992, pp. 241–246 vol.4. 7
[43] S. Haykin, Kalman filtering and neural networks. Wiley, 2001. 7
[44] R. S. Sutton, “Learning to predict by the methods of
temporal differences,” Machine learning, vol. 3, no. 1,
pp. 9–44, 1988. 9
GABRIEL BORRAGEIRO is a PhD student at
the University College London, in the Computer
Science department and part of the Financial Computing Group. His research interests include online
learning, reinforcement learning and neural networks. He obtained his executive MBA from Cass
Business School, City University, London, and a
computer science diploma from Damelin College,
South Africa. Gabriel is employed as a quantitative
researcher at BlueCrest Capital.
NICK FIROOZYE is currently Honorary Reader,
Computational Finance, in the Computer Science
department at University College London and also
part of the Financial Computing Group. He obtained his PhD and MS in mathematics at New
York University and a BS in mathematics at Harvey Mudd College. He also works for Exos Bank
in the systematic rates trading business.
PAOLO BARUCCA is a lecturer at University
College London, Computer Science department
and also part of the Financial Computing Group.
He is also editor in chief of the science dissemination project, La Scienza Coatta and scientific officer of the Blockchain Education Network. Paolo
received his PhD in theoretical and mathematical
physics from Sapienza Universita di Roma.
VOLUME X 2022 11
섹션 본문
섹션 본문이 없습니다.
참고문헌
참고문헌 정보가 없습니다.