getInstrument {FinancialInstrument}R Documentation

Primary accessor function for getting objects of class 'instrument'

Description

This function will search the .instrument environment for objects of class type, using first the primary_id and then any identifiers to locate the instrument. Finally, it will try adding 1 and then 2 dots to the beginning of the primary_id to see if an instrument was stored there to avoid naming conflicts.

Usage

getInstrument(x, Dates = NULL, silent = FALSE, type = "instrument")

Arguments

x

String identifier of instrument to retrieve

Dates

date range to retrieve 'as of', may not currently be implemented

silent

if TRUE, will not warn on failure, default FALSE

type

class of object to look for. See Details

Details

future and option objects may have a primary_id that begins with 1 or 2 dots (in order to avoid naming conflics). For example, the root specs for options (or futures) on the stock with ticker "SPY" may be stored with a primary_id of "SPY", ".SPY", or "..SPY". getInstrument will try using each possible primary_id until it finds an instrument of the appropriate type

Examples

## Not run: 
option('..VX', multiplier=100, 
  underlying_id=future('.VX',multiplier=1000, 
    underlying_id=synthetic('VIX', currency("USD"))))

getInstrument("VIX")
getInstrument('VX') #returns the future
getInstrument("VX",type='option')
getInstrument('..VX') #finds the option

## End(Not run)

[Package FinancialInstrument version 1.3.1 Index]