create_payload: Create a Payload for the Yahoo Finance API

View source: R/screen.R

create_payloadR Documentation

Create a Payload for the Yahoo Finance API

Description

A function to create a payload to query the Yahoo Finance API with customizable parameters.

Usage

create_payload(sec_type = "equity", query = NULL, size = 25,
  offset = 0, sort_field = NULL, sort_type = NULL,
  top_operator = "and")

Arguments

sec_type

string. Type of security to search (i.e., "equity", "mutualfund", "etf", "index", "future").

query

list. Structured query to filter results created by the create_query function.

size

integer. Number of results to return.

offset

integer. Starting position of the results.

sort_field

string. Field to sort the results.

sort_type

string. Type of sort to apply (i.e., "asc", "desc").

top_operator

string. Logical operator for the top-level of the query (i.e., "and", "or")

Value

A list representing the payload to be sent to the Yahoo Finance API with the specified parameters.

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)

payload <- create_payload("equity", query)

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