synthetic.instrument: synthetic instrument constructors

Description Usage Arguments Details Value Author(s) See Also Examples

Description

define spreads, guaranteed_spreads, butterflies, and other synthetic instruments

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  synthetic(primary_id = NULL, currency = NULL,
    multiplier = 1, identifiers = NULL, assign_i = TRUE,
    overwrite = TRUE, ..., members = NULL,
    type = "synthetic")

  synthetic.instrument(primary_id, currency, members,
    memberratio, ..., multiplier = 1, tick_size = NULL,
    identifiers = NULL, assign_i = TRUE,
    type = c("synthetic.instrument", "synthetic"))

  spread(primary_id = NULL, currency = NULL, members,
    memberratio, tick_size = NULL, ..., multiplier = 1,
    identifiers = NULL, assign_i = TRUE)

  butterfly(primary_id = NULL, currency = NULL, members,
    tick_size = NULL, identifiers = NULL, assign_i = TRUE,
    ...)

  guaranteed_spread(primary_id = NULL, currency = NULL,
    root_id = NULL, suffix_id = NULL, members = NULL,
    memberratio = c(1, -1), ..., multiplier = NULL,
    identifiers = NULL, assign_i = TRUE, tick_size = NULL)

  ICS_root(primary_id, currency = NULL, members,
    multiplier = NULL, identifiers = NULL, assign_i = TRUE,
    overwrite = TRUE, tick_size = NULL, ...)

  ICS(primary_id, assign_i = TRUE, identifiers = NULL, ...)

Arguments

primary_id

chr string of primary identifier of instrument to be defined.

currency

chr string name of currency denomination

members

vector of primary_ids of member instruments

memberratio

vector of weights for each leg. negative numbers for selling.

...

any other passthrough parameters

multiplier

multiplier of the spread (1 / divisor for price weighted baskets)

tick_size

minimum price change of the spread

identifiers

identifiers

assign_i

TRUE/FALSE. Should the instrument be assigned in the .instrument environment?

type

type of instrument; wrappers do not require this.

root_id

instrument identifier for the root contract, default NULL

suffix_id

identifiers for the member contract suffixes, default NULL, will be split as members, see Details

overwrite

if FALSE and an instrument with the same primary_id is already defined, an error will be thrown and no instruments will be created.

Details

Simple derivatives like option or future contracts typically have one underlying instrument. While properties like strike and expiration vary for these derivative contracts or series, the underlying is well understood.

More complex derivatives are typically modeled as baskets of underlying products, and are typically traded over-the-counter or as proprietary in-house products.

The general synthetic function is intended to be extended to support these arbitrary baskets of assets.

spread guaranteed_spread and butterfly are wrappers for synthetic.instrument. synthetic.instrument will make a call to synthetic to create the final instrument.

The suffix_id parameter of wrapper functions such as guaranteed_spread is presumed to be a string describing the members. It will be strsplit using the regex "[-;:_,\.]" to create the members vector, and potentially combined with a root_id.

Most wrappers will build primary_id if it is NULL, either by combining root_id and suffix_id, or by passing members in a call to make_spread_id

ICS will build an Intercommodity Spread. Although the expiration date and ratio may change, the members of a given ICS will not change. Therefore, ICS_root can be used to hold the members of an Intercommodity Spread. If an ICS_root has not been defined, then members will be a required argument for ICS

We welcome assistance from others to model more complex OTC derivatives such as swap products.

Value

called for side effect. stores an instrument in .instrument environment

Author(s)

Brian Peterson, Garrett See

See Also

instrument, future, option_series.yahoo

Examples

1
2
3
4
5
6
## Not run: 
stock('SPY','USD',1)
stock('DIA','USD',1)
spread('SPY.DIA','USD',c('SPY','DIA'),c(1,-1))

## End(Not run)

R-Finance/FinancialInstrument documentation built on May 8, 2019, 3:52 a.m.