Learn R Programming

ffscrapr (version 1.4.8)

ff_transactions: Get League Transactions

Description

This function returns a tidy dataframe of transactions - generally one row per player per transaction per team. Each trade is represented twice, once per each team.

Usage

ff_transactions(conn, ...)

# S3 method for espn_conn ff_transactions(conn, limit = 1000, ...)

# S3 method for flea_conn ff_transactions(conn, franchise_id = NULL, ...)

# S3 method for mfl_conn ff_transactions(conn, transaction_type = "*", ...)

# S3 method for sleeper_conn ff_transactions(conn, week = 1:17, ...)

Value

A tidy dataframe of transaction data

Arguments

conn

the list object created by ff_connect()

...

additional args for other methods

limit

number of most recent transactions to return

franchise_id

fleaflicker returns transactions grouped by franchise id, pass a list here to filter

transaction_type

parameter to return transactions of the specified type. Types are: WAIVER, BBID_WAIVER, FREE_AGENT, TRADE, IR, TAXI, AUCTION_INIT, AUCTION_BID, AUCTION_WON, or * for all. Can also pass a comma-separated string. Defaults to *. Note that only the types listed above are actually cleaned and processed by ffscrapr - you will need to make a custom api request with mfl_getendpoint() to receive other things.

week

A week filter for transactions - 1 returns all offseason transactions. Default 1:17 returns all transactions.

Methods (by class)

  • ff_transactions(espn_conn): ESPN: returns adds, drops, and trades. Requires private/auth-cookie.

  • ff_transactions(flea_conn): Fleaflicker: returns all transactions, including free agents, waivers, and trades.

  • ff_transactions(mfl_conn): MFL: returns all transactions, including auction, free agents, IR, TS, waivers, and trades.

  • ff_transactions(sleeper_conn): Sleeper: returns all transactions, including free agents, waivers, and trades.

Examples

Run this code
if (FALSE) {
# Marked as don't run because this endpoint requires private authentication

conn <- espn_connect(
  season = 2020,
  league_id = 1178049,
  swid = Sys.getenv("TAN_SWID"),
  espn_s2 = Sys.getenv("TAN_ESPN_S2")
)
ff_transactions(conn)
}

# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
  conn <- fleaflicker_connect(season = 2020, league_id = 312861)
  ff_transactions(conn)
}) # end try
# }

# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
  dlf_conn <- mfl_connect(2019, league_id = 37920)
  ff_transactions(dlf_conn)
}) # end try
# }
# \donttest{
try({ # try only shown here because sometimes CRAN checks are weird
  jml_conn <- ff_connect(platform = "sleeper", league_id = "522458773317046272", season = 2020)
  ff_transactions(jml_conn, week = 1:2)
}) # end try
# }

Run the code above in your browser using DataLab