The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

filters.trade

A filter system for selecting trading instruments, in the spirit of the filters package.

A filter is a named expression bound to a target dataset. Filters are defined once, kept in a package level registry for the length of the R session, and applied later to select trading codes (tickers, symbols) out of a universe, price or signal dataset.

Installation

# install.packages("devtools")
devtools::install()

Usage

library(filters.trade)

# Load the starter definitions shipped in inst/filters.yaml
load_filters(system.file("filters.yaml", package = "filters.trade"))

tickers <- data.frame(
  SYMBOL = c("AAA", "BBB", "CCC"),
  SECTOR = c("Technology", "Energy", "Technology"),
  MARKET_CAP = c(1e11, 5e10, 4e9),
  stringsAsFactors = FALSE
)

prices <- data.frame(
  SYMBOL = c("AAA", "BBB", "CCC"),
  CLOSE = c(10, 20, 30),
  stringsAsFactors = FALSE
)

# Select a single dataset
apply_filter(tickers, "TECH", target = "TICKERS")

# Combine filters with underscores, and propagate the selected codes to
# every other dataset in the list
apply_filter(list(tickers = tickers, prices = prices), "TECH_LARGECAP")

Filters can also be defined in code:

add_filter(
  id = "MEGACAP",
  title = "Mega Cap",
  target = "TICKERS",
  condition = MARKET_CAP >= 2e11
)

Or in a yaml file:

MEGACAP:
  title: Mega Cap
  target: TICKERS
  condition: MARKET_CAP >= 2e11

Trading conventions

Two conventions replace the clinical study conventions of filters:

After TICKERS has been filtered, every other dataset is restricted to the trading codes that survived, so a selection made on the universe carries through to prices and signals.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.