forecast_builder: Forecast builder

Description Usage Arguments Value Author(s) Examples

View source: R/forecast.R

Description

Create object of class forecast

Usage

1
2
3
forecast_builder(asset,model=c("EWMA", "HAR"), window="20d",
 step = "1d", transform = c("log", "none"), 
seasonalityInterval="none",updateInterval="1m",valueType="forecast")

Arguments

asset

Object of class portfolio or position created using portfolio_create( ) or position_add( ) methods respectively

model

Forecast model to be used:

  • "EWMA" - exponentially-weighted moving average,

  • "HAR" - heterogeneous autoregresion

window

Rolling window length for forecast model. Observations outside of the forecast window are forgotten. Available interval values are: "Xs" - seconds, "Xm" - minutes, "Xh" - hours, "Xd" - trading days (6.5 hours in a trading day), "Xw" - weeks (5 trading days in 1 week), "Xmo" - month (21 trading day in 1 month), "Xy" - years (256 trading days in 1 year).

step

Look-ahead forecast interval. Available interval values are: "Xs" - seconds, "Xm" - minutes, "Xh" - hours, "Xd" - trading days (6.5 hours in a trading day), "Xw" - weeks (5 trading days in 1 week), "Xmo" - month (21 trading day in 1 month), "Xy" - years (256 trading days in 1 year)

transform

Transform applied to dependent and independent variables: "log" - logarithmic transform, "none" - no transform

seasonalityInterval

Seasonality interval to be used in forecast model. Available interval values are: "Xs" - seconds, "Xm" - minutes, "Xh" - hours, "Xd" - trading days (6.5 hours in a trading day), "Xw" - weeks (5 trading days in 1 week), "Xmo" - month (21 trading day in 1 month), "Xy" - years (256 trading days in 1 year)

updateInterval

Update interval for forecast estimates. Available interval values are: "Xs" - seconds, "Xm" - minutes, "Xh" - hours, "Xd" - trading days (6.5 hours in a trading day), "Xw" - weeks (5 trading days in 1 week), "Xmo" - month (21 trading day in 1 month), "Xy" - years (256 trading days in 1 year)

valueType

Value returned from the forecast model:

  • "forecast" - value of forecasted variable,

  • "error" - residual error,

  • "coef_n" - value of n-th coefficient (e.g. "coef_2")

Value

Object of class forecast

Author(s)

Kostin Andrey <andrey.kostin@portfolioeffect.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
dateStart = "2014-11-17 09:30:00"
dateEnd = "2014-11-17 16:00:00"
portfolio=portfolio_create(dateStart,dateEnd)
portfolio_settings(portfolio,portfolioMetricsMode="price",windowLength = '360s',
                   resultsSamplingInterval='60s')
positionAAPL=position_add(portfolio,'AAPL',100)
positionC=position_add(portfolio,'C',300) 
positionGOOG=position_add(portfolio,'GOOG',150) 

forecastVariance_1=forecast_builder(variance(positionAAPL))
# plot(forecast_apply(forecastVariance),variance(positionAAPL),legend=c('Forecast','Simple'))

forecastVariance_2=forecast_builder(variance(positionAAPL),window="1d")
plot(forecast_apply(forecastVariance_1),forecast_apply(forecastVariance_2),
     variance(positionAAPL),legend=c('Forecast,window=20d','Forecast,window=1d','Simple'))

## End(Not run)

PortfolioEffectHFT documentation built on May 2, 2019, 11:52 a.m.