Description Usage Arguments Value Author(s) See Also Examples
Creates new empty portfolio.
To add positions use position_add( ).
To remove positions use position_remove( ).
1 | portfolio_create(index, fromTime, toTime, priceDataIx)
|
index |
Index symbol that should be used in the Single Index Model. Defaults to "SPY". |
fromTime |
Start of market data interval in "yyyy-MM-dd hh:mm:ss" format when internal market data is used. Offset from last available date/time by N days is denoted as "t-N" (e.g. "t-7" denotes offset by 7 days). |
toTime |
End of market data interval in "yyyy-MM-dd hh:mm:ss" format when internal market data is used. Offset from last available date/time by N days is denoted as "t-N" (e.g. "t-7" denotes offset by 7 days). |
priceDataIx |
Vector of (time, price) observations for market index asset when external market data is used. |
portfolio object
Kostin Andrey <andrey.kostin@portfolioeffect.com>
position_add
portfolio_settings
position_remove
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ## 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(alpha_exante(portfolio),alpha_exante(positionGOOG),alpha_exante(positionAAPL))
plot(alpha_exante(portfolio),alpha_exante(positionGOOG),alpha_exante(positionAAPL),
legend=c('Portfolio','GOOG','AAPL'),title='Alpha')
print(portfolio)
portfolio=portfolio_create(priceDataIx=spy.data)
portfolio_settings(portfolio,windowLength = '3600s',resultsSamplingInterval='60s')
positionGOOG=position_add(portfolio,'GOOG',c(100,200),time=c(1412256601000,1412266600000),
priceData=goog.data)
positionAAPL=position_add(portfolio,'AAPL',c(300,150),time=c(1412266600000,1412276600000),
priceData=aapl.data)
plot(expected_return(portfolio),title="Expected Return")
portfolio=portfolio_create(fromTime="2014-09-01 09:00:00", toTime="2014-09-14 16:00:00")
portfolio_settings(portfolio,windowLength = '3600s',resultsSamplingInterval='60s')
positionSPY=position_add(portfolio,'SPY',500)
positionC=position_add(portfolio,'C',600)
plot(expected_return(portfolio),title="Portfolio Expected Return")
portfolio=portfolio_create(fromTime="2014-10-02 09:30:00", toTime="2014-10-02 16:00:00")
portfolio_settings(portfolio,windowLength = '3600s',resultsSamplingInterval='60s')
positionSPY=position_add(portfolio,'SPY',500)
positionC=position_add(portfolio,'C',600)
positionGOOG=position_add(portfolio,'GOOG',100,priceData=goog.data)
position_add(portfolio,'AAPL',c(300,150),time=c(1412266600000,1412276600000),
priceData=aapl.data)
plot(expected_return(portfolio),title="Portfolio Expected Return")
portfolio=portfolio_create(fromTime="t-2", toTime="t")
portfolio_settings(portfolio,windowLength = '3600s',resultsSamplingInterval='60s')
positionSPY=position_add(portfolio,'SPY',500)
positionC=position_add(portfolio,'C',600)
plot(expected_return(portfolio),title="Portfolio Expected Return")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.