create_query: Create a Structured Query for the Yahoo Finance API

View source: R/screen.R

create_queryR Documentation

Create a Structured Query for the Yahoo Finance API

Description

A function to create a structured query with logical operations and nested conditions formatted for the Yahoo Finance API.

Usage

create_query(filters = list("eq", list("region", "us")),
  top_operator = "and")

Arguments

filters

list. Each element is a sublist that defines a filtering condition with the following structure:

comparison

string. Comparison operator (i.e., "gt", "lt", "eq", "btwn").

field

list. Field name (e.g. "region") and its associated value(s).

top_operator

string. Top-level logical operator to combine all filters (i.e., "and", "or").

Value

A nested list representing the structured query with logical operations and nested conditions formatted for the Yahoo Finance API.

Examples

filters <- list(
  list("eq", list("region", "us")),
  list("btwn", list("intradaymarketcap", 2000000000, 10000000000)),
  list("btwn", list("intradaymarketcap", 10000000000, 100000000000)),
  list("gt", list("intradaymarketcap", 100000000000)),
  list("gt", list("dayvolume", 5000000))
)

query <- create_query(filters)

yfscreen documentation built on April 11, 2025, 5:51 p.m.