[R-SIG-Finance] Problem with updatePortf

Worik Stanton worik.stanton at gmail.com
Fri Sep 21 06:08:44 CEST 2012


On 21/09/12 14:43, G See wrote:
> getPrice looks for a price column and it only works if the xts object
> has colnames.
>
>> getPrice(USDCHF)
> Error in getPrice(USDCHF) :
>   subscript out of bounds, no price was discernible from the data
>
> You need to add colnames.
>
>> colnames(USDCHF) <- c("Bid", "Ask", "Last.Price")
>> getPrice(USDCHF)
>

Now the error is:

> go()
2005-09-01
FOO
Error in `*.default`(TmpPeriods[, columns], CcyMult) :
  non-conformable arrays

Adding a transaction in the inner loop...

    equity = getEndEq(account, CurrentDate)

    addTxn(Portfolio=portfolio, Symbol="USDCHF",
           TxnDate=CurrentDate,
           TxnPrice=1.1, TxnQty = 10 ,
                 TxnFees=0, verbose=TRUE)
   
   
    cat("FOO \n")

gives the following error...

> go()
2005-09-01
[1] "2005-09-01 00:00:00 USDCHF 10 @ 1.1"
FOO
Error in `*.default`(TmpPeriods[, columns], CcyMult) :
  non-conformable arrays

cheers
W

-- 
it does not matter                      I think that I shall never see
how much I dig and dig                    A billboard lovely as a tree
this hole just                      Indeed, unless the billboards fall
keeps getting deeper                      I'll never see a tree at all



More information about the R-SIG-Finance mailing list