[R-SIG-Finance] getPrice in blotter

Brian G. Peterson brian at braverock.com
Sat Jun 5 00:23:35 CEST 2010


On 06/04/2010 05:02 PM, Horace Tso wrote:
> Folks, thanks to Brian for showing me where to find FI, blotter is now up and running. But just fresh out of the box, i ran into this small error in all three of the example scripts. Seems like the getPrice function has been relocated elsewhere.
>
>> # Add the transactions to the portfolio
>> # if you wanted to avoid the contract multiplier warning, you would add an instrument first
>> addTxns("amzn_port","amzn",TxnData=amzn.trades,verbose=TRUE)
>                      Txn.Qty Txn.Price Txn.Value Txn.Avg.Cost Pos.Qty Pos.Avg.Cost
> 2010-01-14 07:18:50    -400    127.49    -50996       127.49    -400            0
> 2010-01-14 07:18:53     400    127.49     50996       127.49       0            0
> ......
>> # update the portfolio stats
>> updatePortf("amzn_port",Dates="2010-01-14")
> Error in updatePosPL(Portfolio = pname, Symbol = as.character(symbol),  :
>    could not find function "getPrice"
>
> I'm on R 2.11.0 with xts 0.7-1,  and quantmod 0.3-13, just updated couple weeks ago.

Per my last message, some of the required functions are in quantmod and not yet 
on CRAN.  You need to install quantmod from R-Forge SVN, getPrice is in quantmod.

Regards,

  - Brian

> Thanks.
>
> H
>
>
>
>
> ====================================================================================
>> sessionInfo()
> R version 2.11.0 (2010-04-22)
> i386-pc-mingw32
>
> locale:
> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252
> [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] grDevices datasets  splines   graphics  stats     tcltk     utils     methods   base
>
> other attached packages:
>   [1] blotter_0.5               FinancialInstrument_0.0.2 quantmod_0.3-13
>   [4] TTR_0.20-2                Defaults_1.1-1            xts_0.7-1
>   [7] zoo_1.6-3                 svSocket_0.9-48           TinnR_1.0.3
> [10] R2HTML_2.1                Hmisc_3.8-0               survival_2.35-8
>
> loaded via a namespace (and not attached):
> [1] cluster_1.12.3 grid_2.11.0    lattice_0.18-5 svMisc_0.9-57  tools_2.11.0
>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> 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



More information about the R-SIG-Finance mailing list