pybaseball
pybaseball copied to clipboard
Add support for custom date range searches in Fangraphs
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_seasonparameter-- we could have deduced this fromstart_date, but I thought it would not be a good idea to makestart_seasonnot required. - If
start_dateorend_datedoesn't matching the year ofstart_seasonorend_season, then an error is thrown, rather than fixing that mistake for the user. Ifend_seasonis not entered, then it is deduced fromend_date. - In the fangraphs UI, if we query for a range longer than 3 years, it returns data for
end_date- 3 years untilend_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.