Skip to contents

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, ...)

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

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
#> # A tibble: 494 × 12
#>    timestamp           type      type_desc franchise_id franchise_name player_id
#>    <dttm>              <chr>     <chr>            <int> <chr>          <glue>   
#>  1 2022-04-30 02:20:15 free_age… dropped        1582423 The Verblande… 12934    
#>  2 2022-04-30 02:18:46 free_age… dropped        1582423 The Verblande… 12906    
#>  3 2022-04-30 02:18:33 free_age… dropped        1582423 The Verblande… 7378     
#>  4 2022-04-30 02:18:24 free_age… dropped        1582423 The Verblande… 6660     
#>  5 2022-01-01 11:00:00 free_age… dropped        1581720 brosene's Team 5479     
#>  6 2022-01-01 11:00:00 waiver    added          1581720 brosene's Team 11245    
#>  7 2021-12-30 11:00:00 free_age… dropped        1581720 brosene's Team 12223    
#>  8 2021-12-30 11:00:00 free_age… dropped        1581720 brosene's Team 10449    
#>  9 2021-12-30 11:00:00 waiver    added          1581720 brosene's Team 11300    
#> 10 2021-12-30 11:00:00 waiver    added          1581720 brosene's Team 16404    
#> # ℹ 484 more rows
#> # ℹ 6 more variables: player_name <glue>, pos <chr>, team <chr>,
#> #   trade_partner_id <int>, trade_partner_name <chr>, trade_id <int>
# }

# \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
#> # A tibble: 1,146 × 12
#>    timestamp           type      type_desc franchise_id franchise_name player_id
#>    <dttm>              <chr>     <chr>     <chr>        <chr>          <chr>    
#>  1 2019-12-19 11:56:49 FREE_AGE… added     0003         Electric Spid… 13868    
#>  2 2019-12-19 11:56:49 FREE_AGE… dropped   0003         Electric Spid… 13387    
#>  3 2019-12-19 03:03:13 FREE_AGE… added     0019         Advance Repti… 12857    
#>  4 2019-12-19 03:03:13 FREE_AGE… dropped   0019         Advance Repti… 11186    
#>  5 2019-12-19 03:02:26 FREE_AGE… added     0019         Advance Repti… 13868    
#>  6 2019-12-19 03:02:26 FREE_AGE… dropped   0019         Advance Repti… 14305    
#>  7 2019-12-15 17:28:15 FREE_AGE… added     0003         Electric Spid… 12197    
#>  8 2019-12-15 17:27:28 FREE_AGE… dropped   0003         Electric Spid… 12623    
#>  9 2019-12-15 17:27:00 FREE_AGE… added     0003         Electric Spid… 13387    
#> 10 2019-12-15 17:26:27 IR        deactiva… 0003         Electric Spid… 14138    
#> # ℹ 1,136 more rows
#> # ℹ 6 more variables: player_name <chr>, pos <chr>, team <chr>,
#> #   bbid_spent <dbl>, trade_partner <chr>, comments <chr>
# }
# \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
#> # A tibble: 661 × 13
#>    timestamp           type      type_desc franchise_id franchise_name player_id
#>    <dttm>              <chr>     <chr>     <chr>        <chr>          <chr>    
#>  1 2020-09-23 08:04:23 waiver_c… added     5            Barbarians     5162     
#>  2 2020-09-23 08:04:23 waiver_c… dropped   5            Barbarians     6074     
#>  3 2020-09-23 08:04:23 waiver_c… added     3            solarpool      4054     
#>  4 2020-09-23 08:04:23 waiver_f… added     3            solarpool      2431     
#>  5 2020-09-23 08:04:23 waiver_f… added     4            The FANTom Me… 5001     
#>  6 2020-09-23 08:04:23 waiver_f… dropped   4            The FANTom Me… 4994     
#>  7 2020-09-23 08:04:23 waiver_c… added     4            The FANTom Me… 2431     
#>  8 2020-09-23 08:04:23 waiver_c… dropped   4            The FANTom Me… 4994     
#>  9 2020-09-23 08:04:23 waiver_f… added     6            sox05syd       6001     
#> 10 2020-09-23 08:04:23 waiver_f… dropped   6            sox05syd       827      
#> # ℹ 651 more rows
#> # ℹ 7 more variables: player_name <chr>, pos <chr>, team <chr>,
#> #   bbid_amount <int>, trade_partner <chr>, waiver_priority <int>,
#> #   comment <chr>
# }