setUserData: Select data to backtest.

Description Usage Arguments Examples

View source: R/user_communication.R

Description

Select data to backtest.

Usage

1
2
3
4
setUserData(this, l)

## S3 method for class 'modelStrategy'
setUserData(this, l)

Arguments

this

modelStrategy

l

list or xts, list can contain xts in each cell or should contain following fields: 1. dataset – name of dataset, now only "Russia" is available 2. period – periodicity of data. It is one of c('hour', 'day'). 3. assets – character vector of names of assets from dataset 4. time – numeric, if period == 'day', then time should be specified. Time here is hour. For example, if time == 19, then data will be at 19:00 every business day. This field works only in Russia dataset. Xts – table of timeserieses of instruments. if l is xts, then each column should be close price for instruments.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
setUserData(this, list(
   dataset = 'Russia',
   period = 'day',
   assets = c('GAZP', 'LKOH'),
   time = 19
))

x <- xts(cumsum(rnorm(1000)) + 300, Sys.Date()  + 1:1000)
setUserData(this, x)

x <- xts(cumsum(rnorm(1000)) + 300, Sys.Date()  + 1:1000)
y <- xts(cumsum(rnorm(1000)) + 300, Sys.Date()  + 1:1000)
setUserData(this, cbind(x, y))

x <- quantmod::getSymbols("AAPL", from = Sys.Date() - 365)
x <- quantmod::getSymbols("MSFT", from = Sys.Date() - 365)
setUserData(this, cbind(x, y))

## End(Not run)

Vitalic57/stratbuilder2pub documentation built on Dec. 18, 2019, 2:56 a.m.