pybaseball icon indicating copy to clipboard operation
pybaseball copied to clipboard

Add support for custom date range searches in Fangraphs

Open erin2722 opened this issue 2 years ago • 0 comments

This change addresses #293 by adding in start_date and end_date querying options to the Fangraphs functions.

I didn't change any existing functionality in the Fangraphs function, but did make a few design choices when adding this in:

  • The user still is required to enter in the start_season parameter-- we could have deduced this from start_date, but I thought it would not be a good idea to make start_season not required.
  • If start_date or end_date doesn't matching the year of start_season or end_season, then an error is thrown, rather than fixing that mistake for the user. If end_season is not entered, then it is deduced from end_date.
  • In the fangraphs UI, if we query for a range longer than 3 years, it returns data for end_date - 3 years until end_date. But I thought it would be better to throw an error in the event that the user submits a query for longer than 3 years.

Also added two new test files for these changes, as well as updated the documentation.

erin2722 avatar Apr 14 '23 19:04 erin2722