knitr::opts_chunk$set(collapse = TRUE, eval = FALSE, comment = "#>", message = FALSE, warning = FALSE) path <- here::here("development", "storethat.sqlite")
plotit belongs to the finRes suite where it provides visualization solutions for packages including, at the time of writing, pullit and factorem.
Install the development version from github with devtools::install_github("bautheac/plotit")
.
plotit provides plot methods for a number of pullit objects including, at the time of writing, futures term structure (FuturesTS) and fund market (FundMarket) objects.
Plot a futures series term structure dynamics with:
library(plotit); library(pullit); library(factorem); library(lubridate) start <- "2016-01-01"; end <- "2017-12-31" ticker <- "C A Comdty" data <- pull_futures_market( source = "storethat", type = "term structure", active_contract_tickers = ticker, start, end, TS_positions = 1L:5L, roll_type = "A", roll_days = 0L, roll_months = 0L, roll_adjustment = "N", verbose = FALSE, file = path ) plot(object = data, ticker = ticker)
Plot historical fund performance with:
ticker <- "SPY US Equity" data <- pull_fund_market( source = "storethat", ticker, start, end, verbose = FALSE, file = path ) plot(object = data, ticker = ticker)
Similarly plotit provides plot methods for factorem factor objects (AssetPricingFactor).
Plot historical factor performance with:
tickers <- c( "LZB US Equity", "SGA US Equity", "AGCO US Equity", "CLR US Equity", "GHC US Equity", "MAN US Equity", "SITE US Equity", "AJRD US Equity", "COMM US Equity", "GME US Equity", "MEI US Equity", "SMP US Equity" ) data <- pull_equity_market( source = "storethat", tickers = tickers, start = start, end = end, verbose = F, file = path ) ranking_period <- 1L factor <- factorem( name = "momentum", data = pullit::get_data(data), sort_levels = FALSE, weighted = FALSE, ranking_period = ranking_period ) plot(factor, type = "performance")
Plot factor positions statistics with:
plot(factor, type = "positions")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.