[R-SIG-Finance] What are the requirements for instrument names in a blotter portfolio?

Brian G. Peterson brian at braverock.com
Mon Apr 26 15:40:11 CEST 2010


As should be clear from the documentation and examples, we have followed 
the 'quantmod' convention of storing the market data as the symbol name.

My presumtion is that as you could not possibly have stored your market 
data as '-24702R9GE' (as this is an illegal R variable name), you have 
likely also not stored it as 'INST24702R9GE'

The call that is failing, however, suggests a different problem.

This error:

Error in get(x, pos = .instrument) : object 'INST24702R9GE' not found

suggests that you haven't declared the instrument, with currency, 
multiplier, etc.

it's not clear if the next error is directly related, or if it is simply 
the code falling back to try to find the instrument data in the global 
environment.

Diagnosing this would be much easier if you provided a complete, 
reproducible example, per the posting guide.  Then I wouldn't have to 
guess, I could simply run the code.

Regards,

      - Brian

On 04/26/2010 08:32 AM, Robert Nicholson wrote:
> Why then do I get this?
>
> I added
>
> Transactions$Symbol = sub('[ -]*','INST',Transactions$Symbol)
>
> so this prefixes everything I had with INST presumably I can have digits in the name
>
> 1] "2008-05-30 INST24702R9GE 10 @ 0.35"
> Error in get(x, pos = .instrument) : object 'INST24702R9GE' not found
> Error in get(Symbol, envir = as.environment(.GlobalEnv)) :
>    object 'INST24702R9GE' not found
>
>
> On Apr 26, 2010, at 5:01 AM, Brian G. Peterson wrote:
>
>    
>> R variable names may not start with a number.
>>
>> instruments will be used to create R variables, so all normal naming rules for variables apply.
>>
>> Robert Nicholson wrote:
>>      
>>> Why when
>>> names(getPortfolio(portfolio))
>>>   [1] " -24702R9GE"
>>> do I have
>>> [1] "2008-05-30  -24702R9GE 10 @ 35"
>>> Error in get(x, pos = .instrument) : object ' -24702R9GE' not found
>>> Error in get(Symbol, envir = as.environment(.GlobalEnv)) :   object ' -24702R9GE' not found
>>> when I call
>>> 	portfolio = updatePortf(Portfolio = portfolio, Dates = CurrentDate)
>>>        
>>
>> -- 
>> Brian G. Peterson
>> http://braverock.com/brian/
>> Ph: 773-459-4973
>> IM: bgpbraverock
>>      


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



More information about the R-SIG-Finance mailing list