backtest_exponential_gradient: Backtests using a exponential gradient rule

Description Usage Arguments Details Value

View source: R/backtest_strategy.R

Description

backtests using an exponential gradient rule. See this paper http://rob.schapire.net/papers/HelmboldScSiWa98.pdf ("Online Portfolio Selection Using Multiplicative Updates" by David P Helmholt, Robert E. Schapire and Yoram Singer, and Manfred K. Warmuth)

Usage

1
2
3
4
5
backtest_exponential_gradient(
  price_relative_matrix,
  transaction_rate,
  learning_rate
)

Arguments

price_relative_matrix

a matrix of price relatives, each row representing a trading period and each column an asset. A price relative is p_{t+1} / p_t, i.e. the ratio of trading price to next price. Prices change according to the price relatives after the trade, i.e. the price relatives for the trading period are not known at trading time

transaction_rate

The percentage of each transaction (buy and sell) spent on broker fees

learning_rate

The learning rate (η in the referenced paper), a higher learning rate corresponds to a higher sensitivitiy as one would expect.

Details

has a multiplicative weight update rule, and initializes to uniform portfolio

Value

a matrix with the same number of columns and one more row than price_relative_matrix, row i is the portfolio after a trade during period i, i.e. right before the ith price relatives change the prices.


benSepanski/pfselect documentation built on May 1, 2020, 1:57 p.m.