[R-SIG-Finance] Multi-currency example for blotter

Wolfgang Wu wobwu22 at yahoo.de
Fri Mar 26 14:10:45 CET 2010


Sorry, that should have said:

CurrentDate = '1998-01-01'
addTxn('MultCurPort', Symbol='A', TxnDate=CurrentDate, TxnPrice=100, 
TxnQty = 1, TxnFees=0)
addTxn('MultCurPort', Symbol='B', 
TxnDate=CurrentDate, TxnPrice=50, TxnQty = 1, TxnFees=0)

Thanks

 Wolfgang Wu



----- Ursprüngliche Mail ----
Von: Wolfgang Wu <wobwu22 at yahoo.de>
An: R SIG Finance <R-SIG-Finance at stat.math.ethz.ch>
Gesendet: Freitag, den 26. März 2010, 13:03:19 Uhr
Betreff: [R-SIG-Finance] Multi-currency example for blotter

Is there an example of how to use blotter for multiple currencies. Imagine a portfolio of two stocks. One is denominated in USD the other in EUR. I buy them both at time t. At time t+1 I want to evaluate the value of the portfolio in USD. 

Would I do something like this?

require(blotter)
initDate='1997-12-31'
initEq=100000

currency("USD")
currency("EUR")

stock("A",currency="USD",multiplier=1)
stock("B", currency="EUR", multiplier=1)

getSymbols('A', src='yahoo', index.class=c("POSIXt","POSIXct"),from='1998-01-01')
getSymbols('B', src='yahoo', 
index.class=c("POSIXt","POSIXct"),from='1998-01-01')

initPortf('MultCurPort',symbols=c('A','B'), initDate=initDate)
initAcct('MultCurAcc',portfolios='MultCurPort', initDate=initDate, initEq=initEq)

CurrentDate = '1997-01-30'
addTxn('MultCurPort', Symbol='A', TxnDate=CurrentDate, TxnPrice=100, TxnQty = 1, TxnFees=0)
addTxn('MultCurPort', Symbol='A', TxnDate=CurrentDate, 
TxnPrice=50, TxnQty = 1, TxnFees=0)
updatePortf('MultCurPort', Dates = CurrentDate)
updateAcct('MultCurAcc', Dates = CurrentDate)
updateEndEq('MultCurAcc', Dates = CurrentDate)

CurrentDate = '1998-01-30'
updatePortf('MultCurPort', Dates = CurrentDate)
updateAcct('MultCurAcc', Dates = CurrentDate)
updateEndEq('MultCurAcc', Dates = CurrentDate)


a) What I don't understand is how the USDEUR currency rate is used. Do I need the time series for the currency as well? Something like
getSymbols('EUR', src='yahoo', 
index.class=c("POSIXt","POSIXct"),from='1998-01-01')? 

b) How do I get the value of the portfolio? Via getEndEq(Account, Date)? In what currency will the account be evaluated? 

Thanks for the help.

Regards,

Wolfgang Wu


_______________________________
ügt über einen herausragenden Schutz gegen Massenmails. 
http://mail.yahoo.com

_______________________________________________
R-SIG-Finance at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.


__________________________________________________
Do You Yahoo!?
Sie sind Spam 
mails. 
http://mail.yahoo.com



More information about the R-SIG-Finance mailing list