Package: bbcmd
bbcmdCommand Line Baseball Data Tools. This project includes 2 command line tools for generating a variety of stats and scraping data from the web.ContentsInstallationScraperSimulator SetupSimulator UsageInstallationUsepipviaPyPipipinstallbbcmdOrusegitgitclonegit://github.com/luciancooper/bbcmd.gitbbcmdcdbbcmd
pythonsetup.pyinstallInstall NotesThis project depends oncmdprogressfor command line progress barsCommandsAfter installation, thebbsimandbbscrapecommands should be in your systems path, via theScriptsdirectory of your Python installationScraperThebbscrapecommand is a tool that scrapes data from the following websites:baseball-reference.comfangraphs.comspotrac.comSimulator SetupStep 1. Download DataDownload the necessary play by play data source files that the simulator depends on to run simulations. These files are stored on github in thebbsrcrepository. The data in these files is derived from the play by play data provided byretrosheet.org. Retrosheet is an amazing organization that has painstakingly compiled the play by play data for every MLB game dating back to 1921. Find out more about the Retrosheet projecthere.bbsimsetup--envyearspathyears-required: the specified MLB seasons you wish to download play by play data for, can be a single year (2016), range of years (2014-2016) or comma separated combination of the two (2012-2014,2016or2012-2014,2015-2017, etc.)path-optional: the local path in which you wish to keep store your play by play data files. You will want to remember this location, as you will have to come back later if you want to delete these files. If not specified, the current working directory will be usedStep 2. Create Data Pointerbbsimsetup--xmlyearspathyears-required: the specified MLB seasons you wishbbdata.xmlto point to. Can be a single year (2016), range of years (2014-2016) or comma separated combination of the two (2012-2014,2016or2012-2014,2015-2017, etc.)path-optional: the local path in which you wish to create the pointer file in. This is the directory you will be running your simulations in later, so again, remember this location. If not specified, the current working directory will be used. If you want to keep it simple, specify the same path as in the previous commandStep 3. Run a testIf the current path does not contain yourbbdata.xmlfile, navigate to that path. Run the following command, which will simulate the games for all the seasons specified bybbdata.xml, without recording any of the data.bbsimtestgameSimulator UsageThe following simulations are currently supported by this projectGamescoresThegamescorecommand generates data grouped by mlb game. Columns include:ascore,hscore,aout,houtbbsimgamescore[-v][-yYEARS]Generate Aggregated StatsThebatting,fielding,pitching, andrbicommands generate aggregated stats. By default, the simulator will group the outputted data by season. The following optional flags will change how the data is grouped.-l: by league (AL and NL).-t: by team-g: by game-p: by player (8 character playerid)-ph: by player hand (batting hand or pitching hand)-phm: by player hand matchupsbattingcommandThebattingcommand generates offensive stats. Columns include:O,E,S,D,T,HR,BB,IBB,HBP,K,I,SH,SF,GDP,R,RBI,SB,CS,POThebattingcommand has an additional optional flag:-npor--nopitcher. If this is included, the simulator will ignore pitchers when aggregating results.bbsimbatting[-l|-t|-g|-p|-ph|-phm][-v][-np][-yYEARS]fieldingcommandThefieldingcommand generates defensive aggregated stats. Columns include:UR,TUR,P,A,E,PBbbsimfielding[-l|-t|-g|-p][-v][-yYEARS]pitchingcommandThepitchingcommand generates aggregated pitching stats. Columns include:W,L,SV,IP,BF,R,ER,S,D,T,HR,BB,HBP,IBB,K,BK,WP,PO,GDPbbsimpitching[-l|-t|-g|-p|-ph|-phm][-v][-yYEARS]rbicommandTherbicommand generates details about each event in which an RBI was creditedRBI,O,E,S,D,T,HR,BB,IBB,HBP,K,I,SF,SH,GDPbbsimrbi[-l|-t|-g|-p|-ph|-phm][-v][-yYEARS]Generate Appearance Statsappearancecommandbbsimappearance[normal|lahman|position|simple][-v][-yYEARS]-v-optional:-y YEARSGenerate Advanced StatsCurrently two sub commands supported:woba: simulates the seasonal linear weights used for calculating weightedbbsimadvcalc(woba|war)[-v][-yYEARS]