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

Wolfgang Wu wobwu22 at yahoo.de
Fri Mar 26 14:52:43 CET 2010


I would want to actively work on the multi currency functionality. It will take some time to get my R programming skills up to standard but I would be willing to put in the effort. 
I also would also want to work on functionality to include futures/forward contracts as instruments. (If this is already implemented then please ignore the comment)

 

Regards, 

Wolfgang Wu



----- Ursprüngliche Mail ----
Von: Brian G. Peterson <brian at braverock.com>
An: Wolfgang Wu <wobwu22 at yahoo.de>
CC: R SIG Finance <R-SIG-Finance at stat.math.ethz.ch>
Gesendet: Freitag, den 26. März 2010, 13:12:26 Uhr
Betreff: Re: [R-SIG-Finance] Multi-currency example for blotter

We have done minimal testing on multi-currency portfolios.  Some issues 
remain.

I will work on this over the weekend, and will expand your code example.

To answer your specific questions,

a) exchange rates may be static or a time series.  A time series is 
obviously 'more correct', but many organizations change the exchange 
rate they use to mark their trading books only infrequently, and at 
arbitrary times.

b) Accounts, like portfolios, have a currency they are evaluated in.  
Transactions always and only happen in the currency of the instrument 
being traded, but portfolios and accounts have a currency that they are 
marked to.  We have discussed having multiple markings available, but 
have not implemented this yet.

Please let me know if you want to actively work on this functionality, 
we certainly welcome contributions and collaboration.

Regards,

     - Brian

On 03/26/2010 08:03 AM, Wolfgang Wu wrote:
> 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.
>    


-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock

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



More information about the R-SIG-Finance mailing list