plot-methods: Plot 'finRes' stuff.

Description Usage Arguments Examples

Description

Plots historical futures term structure data contained in an S4 object of class FuturesTS from the pullit package.

Plots historical market performance indicators for S4 objects of class FundMarket from the pullit package.

Plots historical market performance (type = "performance") or positions summary (type = "positions") by leg for S4 objects of class AssetPricingFactor from the factorem package..

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
plot(object, ...)

## S4 method for signature 'FuturesTS'
plot(object, ticker, frame = NULL)

## S4 method for signature 'FundMarket'
plot(object, ticker)

## S4 method for signature 'AssetPricingFactor'
plot(object, type)

Arguments

object

an S4 object from the finRes suite.

ticker

a scalar character vector. Active contract Bloomberg ticker to plot the term structure for.

frame

a scalar integer vector. Animation speed parameter; the lower the faster.

type

a scalar character vector. Specifies the type of plot desired: "performance" or "positions".

ticker

a scalar vector. Specifies the fund Bloomberg ticker to plot performance for.

Examples

 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
## Not run: 

  library(finRes)

  # pull data from Bloomberg with pullit
  term_structure <- pull_futures_market(Bloomberg = T, type = 'term structure',
    active_contract_tickers = "C A Comdty", start = as.character(Sys.Date() - 365L),
    end = as.character(Sys.Date()), TS_positions = 1L:10L, roll_type = "A",
    roll_days = 0L, roll_months = 0L, roll_adjustment = "N")

  # plot futures term structure
  plot(term_structure, ticker = "C A Comdty")


## End(Not run)

## Not run: 

  library(finRes)

  # pull data from Bloomberg with pullit
  fund <- pull_fund_market(Bloomberg = T, tickers = "SPY US Equity",
    start = as.character(Sys.Date() - 365L), end = as.character(Sys.Date()))

  # plot fund performance
  plot(fund, ticker = "SPY US Equity")


## End(Not run)


## Not run: 

  library(finRes)

  # pull data from Bloomberg via pullit
  tickers <- c("C A Comdty", "S A Comdty", "SMA Comdty", "BOA Comdty",
      "W A Comdty", "KWA Comdty", "MWA Comdty", "O A Comdty")#'
  term_structure <- pull_futures_market(Bloomberg = T, type = 'term structure',
    active_contract_tickers = tickers, start = as.character(Sys.Date() - (2L * 365L)),
    end = as.character(Sys.Date()), TS_positions = 1L, roll_type = "A", roll_days = 0L,
    roll_months = 0L, roll_adjustment = "N")

  # construct an asset pricing factor with factorem
  factor <- momentum_factor(term_structure)

  # plot factor performance
  plot(factor, type = "performance")

  # plot factor performance
  plot(factor, type = "positions")


## End(Not run)

bautheac/plotit documentation built on Dec. 17, 2018, 12:12 p.m.