compute: Compute Metrics

Description Usage Arguments Value Author(s) Examples

View source: R/metric.R

Description

Metric object is not evaluated until compute() method is called on it. Method would display calculation progress and would use Metric object's disk cache to store any computational results obtained in the process.

Usage

1

Arguments

...

One or multiple objects of class Metric.

Value

One or multiple objects of class Metric.

Author(s)

Kostin Andrey <[email protected]>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Not run: 
data(aapl.data) 
data(goog.data) 
data(spy.data) 
portfolio=portfolio_create(priceDataIx=spy.data)
portfolio_settings(portfolio,windowLength = '3600s',resultsSamplingInterval='60s')
positionGOOG=position_add(portfolio,'GOOG',100,priceData=goog.data)   
positionAAPL=position_add(portfolio,'AAPL',300,priceData=aapl.data) 
result=compute(variance(portfolio),variance(positionGOOG),variance(positionAAPL)) 
result[[1]][1:10,]

result=compute(variance(portfolio)-variance(positionGOOG))
result[[1]][1:10,]

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 = '3600s',
resultsSamplingInterval='60s')
positionAAPL=position_add(portfolio,'AAPL',100)
positionC=position_add(portfolio,'C',300) 
positionGOOG=position_add(portfolio,'GOOG',150) 
result=compute(variance(positionC),variance(positionGOOG),variance(positionAAPL)) 
result[[1]][1:10,]

## End(Not run)

PortfolioEffectHFT documentation built on May 30, 2017, 3:08 a.m.