Re: [R-SIG-Finance] object .blotter not found

2012-05-06 Thread G See
My guess is that either you used a clear workspace button on your
GUI, or you did something to the effect of rm(list=ls(all=TRUE)).

.blotter is an environment that is stored under your .GlobalEnv when
you load the package.  If you delete it, you have to put it back with
something like this
if (!exists('.blotter')) .blotter - new.env()

Prior to 2012, the .instrument environment was also stored in the
.GlobalEnv, but with FinancialInstrument version 0.10.0, it was moved
to live in the top level of the package.  Therefore, the .instrument
environment doesn't get wiped out if the user clears their workspace.
But, it appears to be missing unless you know where to look.
This should work
ls(FinancialInstrument:::.instrument)
But, it's not as robust as using
   ls_instruments()

.blotter should probably be moved out of the .GlobalEnv as well, but
for now, either don't clear your .GlobalEnv, or recreate a .blotter
environment after you do.

HTH,
Garrett

On Sun, May 6, 2012 at 1:23 AM, Peter Chan heypeterc...@yahoo.com wrote:
 Hi there


 I am running demo(longtrend) but it is failing on initPortf (although the 
 blotter package is loaded):


 ltportfolio='longtrend'  ltaccount='longtrend'  
 initPortf(ltportfolio,'GSPC', initDate=initDate) Error in 
 exists(paste(portfolio, name, sep = .), envir = .blotter,  :  object 
 '.blotter' not found

 Any ideas?  I also noticed that .instrument environment isn't found in my 
 workspace, but I can use getInstrument!

 ls(envir=.instrument) Error in ls(envir = .instrument) : object 
 '.instrument' not found  getInstrument('USD') primary_id :USD
 currency   :USD
 multiplier :1
 tick_size  :0.01
 identifiers: list()
 type       :currency  ls(envir=.blotter) Error in ls(envir = .blotter) : 
 object '.blotter' not found

 Thanks

 Peter

 sessionInfo() R version 2.15.0 (2012-03-30)
 Platform: x86_64-pc-mingw32/x64 (64-bit) locale:
 [1] LC_COLLATE=English_Singapore.1252  LC_CTYPE=English_Singapore.1252
 [3] LC_MONETARY=English_Singapore.1252 LC_NUMERIC=C
 [5] LC_TIME=English_Singapore.1252     attached base packages:
 [1] stats     graphics  grDevices utils     datasets  methods   base      
 other attached packages:
 [1] blotter_0.8.8              FinancialInstrument_0.14.2 quantmod_0.3-17
 [4] TTR_0.21-1                 xts_0.8-6                  zoo_1.7-7
 [7] Defaults_1.1-1             loaded via a namespace (and not attached):
 [1] grid_2.15.0    lattice_0.20-6 tools_2.15.0

        [[alternative HTML version deleted]]

 ___
 R-SIG-Finance@r-project.org 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.

___
R-SIG-Finance@r-project.org 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.


Re: [R-SIG-Finance] object .blotter not found

2012-05-06 Thread Peter Chan
Hi Garrett

Yes your guess is good and solution works. Also just found upon the 
getAnywhere() function, which can find hidden objects.  Thanks very much.

Peter




 From: G See gsee...@gmail.com

Cc: r-sig-finance@r-project.org r-sig-finance@r-project.org 
Sent: Sunday, May 6, 2012 10:31 PM
Subject: Re: [R-SIG-Finance] object .blotter not found

My guess is that either you used a clear workspace button on your
GUI, or you did something to the effect of rm(list=ls(all=TRUE)).

.blotter is an environment that is stored under your .GlobalEnv when
you load the package.  If you delete it, you have to put it back with
something like this
    if (!exists('.blotter')) .blotter - new.env()

Prior to 2012, the .instrument environment was also stored in the
.GlobalEnv, but with FinancialInstrument version 0.10.0, it was moved
to live in the top level of the package.  Therefore, the .instrument
environment doesn't get wiped out if the user clears their workspace.
But, it appears to be missing unless you know where to look.
This should work
    ls(FinancialInstrument:::.instrument)
But, it's not as robust as using
   ls_instruments()

.blotter should probably be moved out of the .GlobalEnv as well, but
for now, either don't clear your .GlobalEnv, or recreate a .blotter
environment after you do.

HTH,
Garrett


 Hi there


 I am running demo(longtrend) but it is failing on initPortf (although the 
 blotter package is loaded):


 ltportfolio='longtrend'  ltaccount='longtrend'  
 initPortf(ltportfolio,'GSPC', initDate=initDate) Error in 
 exists(paste(portfolio, name, sep = .), envir = .blotter,  :  object 
 '.blotter' not found

 Any ideas?  I also noticed that .instrument environment isn't found in 
 [[elided Yahoo spam]]

 ls(envir=.instrument) Error in ls(envir = .instrument) : object 
 '.instrument' not found  getInstrument('USD') primary_id :USD
 currency   :USD
 multiplier :1
 tick_size  :0.01
 identifiers: list()
 type       :currency  ls(envir=.blotter) Error in ls(envir = .blotter) : 
 object '.blotter' not found

 Thanks

 Peter

 sessionInfo() R version 2.15.0 (2012-03-30)
 Platform: x86_64-pc-mingw32/x64 (64-bit) locale:
 [1] LC_COLLATE=English_Singapore.1252  LC_CTYPE=English_Singapore.1252
 [3] LC_MONETARY=English_Singapore.1252 LC_NUMERIC=C
 [5] LC_TIME=English_Singapore.1252     attached base packages:
 [1] stats     graphics  grDevices utils     datasets  methods   base      
 other attached packages:
 [1] blotter_0.8.8              FinancialInstrument_0.14.2 quantmod_0.3-17
 [4] TTR_0.21-1                 xts_0.8-6                  zoo_1.7-7
 [7] Defaults_1.1-1             loaded via a namespace (and not attached):
 [1] grid_2.15.0    lattice_0.20-6 tools_2.15.0

        [[alternative HTML version deleted]]

 ___
 R-SIG-Finance@r-project.org 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.
[[alternative HTML version deleted]]

___
R-SIG-Finance@r-project.org 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.