covariance: Covariance

Description Usage Arguments Value Author(s) Examples

Description

Computes covariance between positionA and positionB.

Usage

1
2
3
4
## S4 method for signature 'portfolio,missing'
covariance(positionA)
## S4 method for signature 'position,position'
covariance(positionA,positionB)

Arguments

positionA

Position object created using position_add( ) function

positionB

Position object created using position_add( ) function

Value

Metric object

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
19
20
21
22
23
## 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(covariance(positionGOOG,positionAAPL))
plot(covariance(positionGOOG,positionAAPL),title='Covariance')

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(covariance(positionC,positionAAPL))
plot(covariance(positionC,positionAAPL),title='Covariance')

## End(Not run)

PortfolioEffectHFT documentation built on May 20, 2017, 12:56 a.m.

Search within the PortfolioEffectHFT package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.