ff_transactions: Get League Transactions

View source: R/0_generics.R

ff_transactionsR Documentation

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 class 'espn_conn'
ff_transactions(conn, limit = 1000, ...)

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

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

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

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.

Value

A tidy dataframe of transaction data

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

## Not run: 
# 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)

## End(Not run)


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



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


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



dynastyprocess/ffscrapr documentation built on June 4, 2024, 1 p.m.