AL/NL Cy Young
Posted by Rufio Magillicutty in Cy Young, MLB on July 22, 2012
Again, last post on this. I’ll attach necessary files at bottom.
Hit both pitchers last year. Kershaw was sharp, he won us money (be weary of “max payout” disclaimers on Cy Young futures emailed to you after the fact by some unspecified sportsbooks, though no worries we got paid in full).
AL and NL formulas:
And a different formula is required for NL relief pitchers:
bWAR is baseball-reference WAR projected to the end of the season.
AL CY YOUNG
| NAME | TEAM | bWAR | PROB | ODDS |
| Justin Verlander | DET | 8.70 | 47.30% | 111 |
| Chris Sale | CHW | 7.76 | 46.00% | 117 |
| David Price | TBR | 5.80 | 43.85% | 128 |
| Matt Harrison | TEX | 7.14 | 31.07% | 222 |
| Jered Weaver | LAA | 4.95 | 26.24% | 281 |
| Yu Darvis | TEX | 3.48 | 5.39% | 1755 |
| CC Sabathia | NYY | 3.62 | 0.14% | 70129 |
NL CY YOUNG
| NAME | TEAM | bWAR | PROB | ODDS |
| J. Cueto | CIN | 7.07 | 27.21% | 267 |
| C. Kimbrel | ATL | 3.1 | 25.96% | 285 |
| R. Dickey | NYM | 5.34 | 25.49% | 292 |
| S. Strasburg | WSN | 4.53 | 18.79% | 432 |
| W. Miley | ARI | 4.65 | 17.01% | 488 |
| G. Gonzalez | WSN | 4.01 | 17.00% | 488 |
| C. Hamels | PHI | 4.26 | 13.77% | 626 |
| L. Lynn | STL | 3.62 | 12.65% | 690 |
| M. Bumgarner | SFG | 2.76 | 12.56% | 696 |
| M. Cain | SFG | 3.79 | 10.33% | 868 |
| A. Chapman | CIN | 3.27 | 6.90% | 1350 |
| J. McDonald | PIT | 3.83 | 6.03% | 1559 |
| J. Zimmermann | WSN | 6.97 | 4.51% | 2119 |
| K. Jansen | LAD | 2.9 | 1.79% | 5493 |
NL/AL MVP
Posted by Rufio Magillicutty in MLB, MVP on July 21, 2012
Sportsbooks haven’t convened MVP odds yet because I haven’t posted them myself. This is an obvious observation to anybody that visits this blog on a yearly basis. I think we’d all agree on this. (I use the terms “we’d all” and “nobody in particular” interchangeably).
The formula behind setting a probability on a given player’s chances can be expressed as:
If a player doesn’t register a positive number of MVP points, the variable v, then he is simply ignored. The points are calculated slightly differently in the NL and AL, and the years 2000-2010 were used to fit the data. This has already been explained on multiple occasions.
For AL batters and pitchers:
The “PLAYOFFS” variable is either 1 or 0, and in season playoff projections are essentially current standings.
For all NL batters and pitchers:
The motivation for using WAR and WPA as primary coefficients stemmed from this post, which I found quite interesting.
At the bottom of the post I’ve attached some relevant excel files. I’m not going to post anymore about this (I’ll do Cy Young this weekend and attach the necessary files), there really shouldn’t be any reason for me to have to. I also never want to have to use or look at an excel file ever again. But if I get enough requests via twitter/email/comments I’ll make a dedicated page that updates daily, probably using my own WAR calculations instead of bRef’s mess of drivel, and some server-side scripting.
Last year the formula picked Ryan Braun and Miguel Cabrera. Verlander I think can we all agree should not have won the MVP.
NL MVP
| NAME | Team | bWAR | WPA | PROB | ODDS |
| Andrew McCutchen | PIT | 5.1 | 3.2 | 52.15% | -108 |
| Ryan Braun | MIL | 3.9 | 3 | 33.73% | 196 |
| Joey Votto | CIN | 4.5 | 5.2 | 33.42% | 199 |
| Melky Cabrera | SFG | 3.8 | 2.7 | 18.64% | 436 |
| Johnny Cueto | CIN | 4 | 2 | 15.18% | 559 |
| Carlos Gonzalez | COL | 1.6 | 1.8 | 8.73% | 1045 |
| Carlos Beltran | STL | 2.3 | 1.8 | 6.49% | 1441 |
| Matt Holliday | STL | 3.6 | 2.8 | 6.32% | 1482 |
| Buster Posey | SFG | 2.8 | 1.5 | 5.44% | 1738 |
| Ian Desmond | WSN | 2.3 | 3.5 | 5.41% | 1748 |
| Pedro Alvarez | PIT | 2 | 1.1 | 5.29% | 1790 |
| Jay Bruce | CIN | 1.1 | 0.2 | 4.13% | 2321 |
| Giancarlo Stanton | MIA | 3 | 2.5 | 2.34% | 4174 |
| Ryan Vogelsong | SFG | 2.8 | 2.1 | 2.18% | 4487 |
| Brandon Phillips | CIN | 2.2 | 0.8 | 0.55% | 18082 |
AL MVP
| NAME | TEAM | bWAR | WPA | PROB | ODDS |
| Mike Trout | TBR | 5.3 | 0.5 | 34.66% | 188 |
| Robinson Cano | NYY | 5 | 1.6 | 31.16% | 221 |
| Josh Hamilton | TEX | 3.2 | 1.2 | 22.88% | 337 |
| Adrian Beltre | TEX | 3 | 1.6 | 22.13% | 352 |
| Mark Trumbo | TBR | 3.2 | 0 | 18.48% | 441 |
| Josh Reddick | NYY | 3.8 | 4.2 | 14.96% | 568 |
| Alex Rios | TEX | 2.6 | 1.7 | 14.61% | 584 |
| Miguel Cabrera | DET | 3.5 | 2.2 | 14.42% | 593 |
| David Ortiz | BOS | 2.7 | 2.5 | 6.46% | 1448 |
| Matt Harrison | TEX | 4.1 | 2.5 | 5.95% | 1581 |
| Fernando Rodney | TBR | 1.9 | 2.8 | 5.87% | 1604 |
| Justin Verlander | DET | 5 | 3.1 | 3.51% | 2749 |
| Chris Sale | CHW | 4.7 | 3 | 3.18% | 3045 |
| Edwin Encarnacion | TOR | 3 | 2.5 | 1.72% | 5716 |
Here are the files. The “NLMVP_ODDS” and “ALMVP_ODDS” files require a data refresh and some sorting. Feel free to change the coefficients, I don’t care. Some files may be irrelevant, not sure. I just threw a bunch of seemingly related files in an archive.
Pitch F/X with PHP and Octave
Posted by Rufio Magillicutty in MLB, Octave, PHP, PitchFX on June 8, 2012
Generally, sabermetric nerds use R (or Excel lmfao) to appropriate their desire to waste time. I, however, prefer Octave, an open-source alternative to MATLAB. Its more intellectually stimulating than R, in my opinion. By that I mean, there isn’t a built in mechanism to download thousands of user submitted R functions and scripts (Believe it not, there is even a pitch fx library to use with R). There are degrees of laziness, and while I fall in the upper percentile, people who use R really would rather remain rigid regarding routes to regale their ridiculous yet reasonably remunerative run value research.
Actually, the primary reason I’m using Octave is its the program of choice for ML-Class. Its also more syntactically convenient.
This isn’t important. What is important, however, is something that is very easy to implement. The motivation behind using PHP with Octave is the lack of MYSQL compatability with Octave. I was having trouble getting it to work, as have others, based on a google search. Fortunately, one can call Octave, or open up a shell to essentially run anything, from PHP, with:
system('path/to/bin path/to/file'); |
Visit php.net for more info.
For Octave users on Linux (Windows users may have to specify the full path to Octave):
system('octave -q path/to/file'); |
Octave script files use the extension “.m”, and in PHP we can easily write to a file and save as “filename.m”:
$octave_file = fopen('octave_file.m','w'); fwrite($octave_file,"This is octave code to do stuff really cool"); fclose($octave_file); |
This is elementary, though vital, PHP code.
I’m going to assume the reader has a Pitch F/X database already. If not, grab my script at github here (its setup to grab from yesterday, comment that section and change the start and end dates), or download here (pbp2.zip).
Octave is going to be used for all the math, so the Octave script will include code to open a data file, a file that is initialized in the PHP code:
$file = 'pfx_data.txt'; unlink($file); $f = fopen($file,'a'); |
It is of major importance that the ‘unlink’ function is called, and the ‘a’ property be assigned to the file. The data is going to be appended to the file each time the PHP code loops through the query results. And when the PHP code is run the file itself is going to be deleted before written to.
After connecting to a database, here is a rather dull example query:
$query = "SELECT p.px, p.pz, SUM(IF(p.event IN ('Single', 'Double', 'Triple', 'Home Run'),1,0))/SUM(IF(p.event NOT LIKE '%Sac %',1,0)) AS BA FROM pitches as p JOIN (SELECT id FROM batters WHERE name_display_first_last LIKE '%$player_name%' LIMIT 1) AS t ON t.id = p.ab_id WHERE LEFT(p.gameName,4) BETWEEN ".$yr_start." AND ".$yr_end." AND p.type = 'X' AND p.px IS NOT NULL GROUP BY p.px, p.pz"; |
This is extracting a specified player’s contact Batting Average. (Different from BABIP, which excludes Home Runs, hence the phrase “Balls in Play.” Any sort of “Sacrifice” will be undefined, and ignored below.)
Subsequently on each loop, the query results are appended to the file “pfx_data.txt”.
$result = mysql_query($query); while($row = mysql_fetch_assoc($result)){ if ($row['BA']=='') continue else fwrite($f,$row['px'].','.$row['pz'].','.$row['BA']."\n"); mysql_free_result($result); mysql_close($connection); fclose($f); |
I’ll provide a file so one can decipher all the Octave code themselves. For now, here’s an example plot in Octave (default is the gnuplot graphing library):
data=load('".$file."'); X = data(:, [1, 2]); y = data(:, 3); hits=find(y==1); outs=find(y==0); plot(X(hits,1),X(hits,2),'rx','MarkerSize',7) hold on plot(X(outs,1),X(outs,2),'bo') title('".$player_name." pitch position on cBA (".$yr_start." - ".$yr_end.")'); set(gca,'xlim',[-2,2]); set(gca,'ylim',[0,5]); legend('hits','outs'); xlabel('Horizontal position (ft)'); ylabel('Vertical position (ft)'); text(-1.8,4.8,['N = ',num2str(length(data))]); text(-1.8,4.5,['hits = ',num2str(length(hits)),', outs = ',num2str(length(outs))],'fontsize',6) |
Obviously, some of the variables are PHP assignments, and wouldn’t be used in Octave. In PHP, just condense what would have been written in a script or in the Octave terminal into the call to ‘fwrite’, over-writing any text that was there before:
$file1 = 'pfx_octave.m'; $f1 = fopen($file1,'w'); fwrite($f1,"data=load('".$file."');\nX=data(:,1:2); y=data(:,3);\nplot(X(hits,1),X(hits,2),'rx','MarkerSize',7)\nhold on;\nplot(X(outs,1),X(outs,2),'bo')\ntitle('".$player_name." pitch position on cBA (".$yr_start." - ".$yr_end.")'); set(gca,'xlim',[-2,2]); set(gca,'ylim',[0,5]);\nlegend('hits','outs'); xlabel('Horizontal position (ft)'); ylabel('Vertical position (ft)'); text(-1.8,4.8,['N = ',num2str(length(data))]); text(-1.8,4.5,['hits = ',num2str(length(hits)),', outs = ',num2str(length(outs))],'fontsize',6) |
(The ‘\n’ character is just to make ‘pfx_octave.m’ look pretty. One can still use the file after closing PHP.)
The result is something like this:
I threw together a virtual strike zone and some hot and cold zones (TY to Mike Fast for his regularized strike zones, the file at the bottom provides code for LHB and RHB strike zone deviations):
hold on "plot([-1,1],[1.5,1.5],'k--') plot([-1,1],[3.5,3.5],'k--') plot([-1,-1],[1.5,3.5],'k--') plot([1,1],[1.5,3.5],'k--') plot([-1,1],[1.5+2/3,1.5+2/3],'k--') plot([-1,1],[1.5+4/3,1.5+4/3],'k--') plot([-1+2/3,-1+2/3],[1.5,3.5],'k--') plot([-1+4/3,-1+4/3],[1.5,3.5],'k--') hold off |
To calculate and plot hot/cold zones:
z=x=x1=x2[]; for i = 1:3 x=find(X(:,1)>=-1 & X(:,1)<=-1+2/3 & X(:,2)>=1.5+(i-1)*2/3 & X(:,2)<=1.5+i*2/3); x1=find(X(:,1)>=-1+2/3 & X(:,1)<=-1+4/3 & X(:,2)>=1.5+(i-1)*2/3 & X(:,2)<=1.5+i*2/3) x2=find(X(:,1)>=-1+4/3 & X(:,1)<=1 & X(:,2)>=1.5+(i-1)*2/3 & X(:,2)<=1.5+i*2/3); z=[mean(y(x,1)) mean(y(x1,1)) mean(y(x2,1)) z]; end hold on text(-.8,3.5-1/3,num2str(z(1),3)); text(-1+2/3+.2,3.5-1/3,num2str(z(2),3)); text(1-2/3+.2,3.5-1/3,num2str(z(3),3)); text(-.8,2.5,num2str(z(4),3)); text(-1+2/3+.2,2.5,num2str(z(5),3)); text(1-2/3+.2,2.5,num2str(z(6),3)); text(-.8,1.5+1/3,num2str(z(7),3)); text(-1+2/3+.2,1.5+1/3,num2str(z(8),3)); text(1-2/3+.2,1.5+1/3,num2str(z(9),3)); hold off |
Here is a multi-plot figure with a surface plot of Jeter’s data:
Rick Reed’s strike zone from 2008-2011:
Just an example of some of the things Octave can do. Copy the code directly into the PHP file and insert into a variable or directly into ‘fwrite’ and the Octave script can be opened directly from PHP.
All of this should work fine with MatLab, or even FreeMat (another open-source alternative).
How to Build a Line Database
Apologies for not having provided any content lately (my tweets have certainly offended about ten users). I would have wrote this months ago but I didn’t.
Let me preface this futher by saying, assuming one will be building a database on a local web-server, I highly recommend using another computer other than the primary one to run a server. I have an old Toshiba laptop that is running Debian (Debian 6.0 is the latest version) and sits in the back of my closet.
In a previous post I uploaded an Excel file that automatically extracts lines from Pinnacle and inserts into an Access database on open (keep the file open and invoke the “Application.OnTime” VBA function for a reoccurring call, or set up a windows task scheduler event). But that requires Windows, and ideally one would want a solution that can be applied across various operating systems. PHP and MySQL is one such solution. Linux users can simply download apache, php, and mysql from the repository. Windows or MAC users might want to look into downloading XAMPP. PHP is a server-side scripting language, so it operates via some sort of web-server, such as apache (if PHP is unfamiliar, just carefully read the code it and should be pretty straight-foward). And MySQL provides the database structure and query language that can be interfaced with most programming languages. I would also suggest setting up an ssh connection, from one computer on the network to the one running the server.
Here is my SQL table structure configured for baseball lines from Pinnacle (assuming a database has already been created):
CREATE TABLE IF NOT EXISTS `LINES` ( `Date` varchar(55) NOT NULL, `vRot` varchar(5) NOT NULL, `Away` varchar(55) NOT NULL, `vListed` varchar(55) NOT NULL, `vLine` varchar(12) NOT NULL, `vTotal` varchar(12) NOT NULL, `vML` int(11) NOT NULL, `hRot` varchar(5) NOT NULL, `Home` varchar(55) NOT NULL, `hListed` varchar(55) NOT NULL, `hLine` varchar(12) NOT NULL, `hTotal` varchar(12) NOT NULL, `hML` int(11) NOT NULL, `nowTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE KEY `ID` (`Date`,`vRot`,`vListed`,`hRot`,`hListed`,`hML`,`hTotal`,`hLine`,`vML`,`vTotal`,`vLine`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; |
The ‘nowTime’ column automatically tracks the current time on data insert. This table is meant to accomodate those interested in tracking line movement, because Pinnacle’s XML updates everytime there is new information added. To take advantage of this, an intermittent call (Pinnacle allows at least 60 seconds between calls) can be made using whatever fashion is most convenient for the programmer (cron job, delayed loop…). And to avoid redundant database inserts, indexing every column and using the ‘INSERT IGNORE’ sql command is essential.
Again, I’m using PHP, and here is my PHP code to grab MLB lines from Pinnacle and insert them into the above SQL table (my database name is ‘MLB’):
//error_reporting(0); $host='localhost'; $username='USER'; $pswrd='PASS'; $con = mysql_connect($host,$username,$pswrd); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("MLB",$con) or die('Error while selecting db'); $xmldoc = new DOMDocument(); $url = 'http://xml.pinnaclesports.com/pinnacleFeed.aspx?sporttype=baseball&sportsubtype=MLB'; $xmldoc->load($url); $doc = $xmldoc->documentElement; $event = $doc->getElementsByTagName("event"); foreach( $event as $ev ) { $ml_v = $ev->getElementsbyTagName("moneyline_visiting")->item(0)->nodeValue; $ml_h = $ev->getElementsbyTagName("moneyline_home")->item(0)->nodeValue; if ($ml_h==""){ continue; } $total_v = $ev->getElementsbyTagName("total_points")->item(0)->nodeValue . " " . $ev->getElementsbyTagName("over_adjust")->item(0)->nodeValue; $total_h = $ev->getElementsbyTagName("total_points")->item(0)->nodeValue . " " . $ev->getElementsbyTagName("under_adjust")->item(0)->nodeValue; $d = $ev->getElementsByTagName("event_datetimeGMT")->item(0)->nodeValue; $teamnames = $ev->getElementsByTagName("participant_name"); $name_v = str_replace("'","",$teamnames->item(0)->nodeValue); $name_h = str_replace("'","",$teamnames->item(1)->nodeValue); $rot = $ev->getElementsByTagName("rotnum"); $rotv = $rot->item(0)->nodeValue; $roth = $rot->item(1)->nodeValue; $pitcher = $ev->getElementsByTagName("pitcher"); $pitch_v = mysql_real_escape_string($pitcher->item(0)->nodeValue); $pitch_h = mysql_real_escape_string($pitcher->item(1)->nodeValue); $spread_v = $ev->getElementsbyTagName("spread_visiting")->item(0)->nodeValue . " " . $ev->getElementsbyTagName("spread_adjust_visiting")->item(0)->nodeValue; $spread_h = $ev->getElementsbyTagName("spread_home")->item(0)->nodeValue . " " . $ev->getElementsbyTagName("spread_adjust_home")->item(0)->nodeValue; $sql = "INSERT IGNORE INTO MLB.LINES (Date,vRot,Away,vListed,vLine,vTotal,vML,hRot,Home,hListed,hLine,hTotal,hML) Values ('$d','$rotv','$name_v','$pitch_v','$spread_v','$total_v','$ml_v','$roth','$name_h','$pitch_h','$spread_h','$total_h','$ml_h')"; $query = mysql_query($sql,$con); if(!$query) { die('Could not insert values: ' . mysql_error()); } } mysql_close($con); |
You can use whatever language you want, some are more comfortable with python, perl, javascript, brainfuck, etc…
What is important is knowing how to access your MySQL database from the script and how to navigate the Pinnacle XML file.
As a paranthetical, I previously mentioned running a cron job. In Windows, one may have to use the task scheduler. In MAC or LINUX, the ability to run a cron job should already be set up, just edit the crontab file. For example, a linux user simply has to type in a terminal:
crontab -e
And add the line:
*/2 * * * * /usr/bin/php path/to/php/file.php
This simply means, every two minutes (“/2″), a php file will be opened by the program “php.”
Now if everything works, we can start to present the lines in a nice HTML table. First, create a PHP file to query the database, grabbing the latest lines for each game listed at Pinnacle, and outputting the information in JSON format. This can be a bit tricky, but here is my solution (after connecting to a database with the name ‘MLB’):
... $sql="SELECT * \n" . "FROM MLB.LINES AS m\n" . "INNER JOIN (\n" . "\n" . "SELECT c.vROT, MAX( c.nowTime ) AS maxtime\n" . "FROM MLB.LINES AS c\n" . "GROUP BY c.vROT\n" . ") AS a ON m.vROT = a.vROT\n" . "AND m.nowTime = a.maxtime WHERE NOW()<=DATE_SUB(m.Date,INTERVAL 4 HOUR)"; $results = mysql_query($sql); while($row=mysql_fetch_assoc($results)){ $array[$i]['D']=$row['Date']; $array[$i]['hRot'] = $row['hRot']; $array[$i]['vRot'] = $row['vRot']; $array[$i]['Away'] = $row['Away']; $array[$i]['Home'] = $row['Home']; $array[$i]['vListed'] = $row['vListed']; $array[$i]['hListed'] = $row['hListed']; $array[$i]['vML'] = $row['vML']; $array[$i]['hML'] = $row['hML']; $array[$i]['vTotal'] = $row['vTotal']; $array[$i]['hTotal'] = $row['hTotal']; $array[$i]['vLine'] = $row['vLine']; $array[$i]['hLine'] = $row['hLine']; $i++; } header('Content-type: application/json'); echo json_encode($array); ... |
The advantage of Jquery is the background calls it can make to another file on a server and at the same time read and parse the information that is queried from that file. The “.getJSON” subroutine makes this possible by making calls every 120 seconds (120000) to the php file “MLB_Pinny.php”:
jQuery(document).ready( function( $ ){ var timeout, d; getPinny(); function getPinny() { $.getJSON('php/MLB_Pinny.php?'+new Date().getTime(), function(json_data){ update = new Date(); $('#update td:first').text('LAST UPDATE: '+update.toString("yyyy-MM-dd h:mm")); $('#today tr:not(:first)').empty(); $('#tomorrow tr:not(:first)').empty(); $.each(json_data, function(i, item){ d = Date.parse(item.D).addHours(-4); cur = (d.getDayName()==Date.today().getDayName()) ? "today" : "tomorrow"; $("#"+cur).append($('<tr><td rowspan="2">' + d.toString("yyyy-MM-dd h:mm") + '</td><td>' + item.vRot + '</td><td class="team">' + item.Away + '</td><td class="pitch">' + item.vListed + '</td><td class="ml">' + item.vML + '</td><td>' + item.vTotal + '</td><td>' + item.vLine + '</td></tr><tr><td>' + item.hRot + '</td><td class="team">' + item.Home + '</td><td class="pitch">' + item.hListed + '</td><td class="ml">' + item.hML + '</td><td>' + item.hTotal + '</td><td>' + item.hLine + '</td></tr>')); }); }); } timeout = setInterval(function() { getPinny() }, 120000); }); |
Mine looks like this:
I have two “tbody” sections, one with ‘id = “today”‘ and the other ‘id = “tomorrow”‘. This should be self-explanatory.
Feel free to add some table enhancements (in this case, a toggle):
$('#today').children('tr:eq(0)').click(function () { $('#today').children('tr:gt(0)').toggle(); }); $('#tomorrow').children('tr:eq(0)').click(function () { $('#tomorrow').children('tr:gt(0)').toggle(); }); |
It would be nice if included was the ability to query a pitcher’s closing lines for each start:
... if(isset($_GET['pitch'])) { $query = str_replace("%",". ",$_GET['pitch']); $sql="SELECT * \n" . "FROM MLB.LINES AS m\n" . "WHERE vLISTED LIKE '%$query%' OR hLISTED LIKE '%$query%'\n" . "ORDER BY nowTime DESC"; } else { header( 'HTTP/1.1 400 Bad Request' ); die('Please use correct paramaters'); } $result = mysql_query($sql,$con) or die ('Error while executing query' . mysql_error() . "\n"); echo '<html><head></head><body> <table border=1><thead><th>Date</th><th>Away</th><th>vListed</th><th>vML</th><th>Home</th><th>hListed</th><th>hML</th></thead><tbody>'; while($row=mysql_fetch_assoc($result)){ if ($d == $row['Date']) continue; if($row['vListed']==$query){ $boldvml = "<strong>".$row['vML']."</strong>"; $boldvnm = "<strong>".$row['vListed']."</strong>"; $boldvtm = "<strong>".$row['Away']."</strong>"; $boldhml = $row['hML']; $boldhnm = $row['hListed']; $boldhtm = $row['Home']; } else { $boldhml = "<strong>".$row['hML']."</strong>"; $boldhnm = "<strong>".$row['hListed']."</strong>"; $boldhtm = "<strong>".$row['Home']."</strong>"; $boldvml = $row['vML']; $boldvnm = $row['vListed']; $boldvtm = $row['Away']; } $d = $row['Date']; echo '<tr><td>'.date("Y-m-d hh:MM",strtotime($row['Date'],'-4hours')).'</td><td>'.$boldvtm.'</td><td>'.$boldvnm.'</td><td>'.$boldvml.'</td><td>'.$boldhtm.'</td><td>'.$boldhnm.'</td><td>'.$boldhml.'</td></tr>'; } echo '</tbody></table></body></html>'; ... |
Additionally, the HTML table needs to have the cell with the starter’s name clickable. Jquery can do this:
$('.pitch').live('click',function() { window.open('php/linedb.php?pitch='+$(this).text().replace(" ","%").replace(".","")); }); |
Occassionally, Pinnacle has a listed starer in the format “F LAST” rather than “F. Last”, this usually occurs when there is a late change in the listed starter or the pitcher is making his/her first start. Hence, there are some minor whitespace and trimming issues that for now seem to be resolved with some of the above code.
Hopefully what all this accomplishes is a personal Pinnacle line service, one that updates every 60+ seconds without having to refresh the browser or re-run a query. One could easily integrate the PHP code for different sports. Obviously, basketball and football do not have listed starters, other than that the PHP code should work fine once pointed to the relevant Pinnacle XML file (or any other sportsbook).
I haven’t updated this in a while, but on my github account there is a “SP-DATABASE” project. More importantly, various PHP and MySQL files are provided that can be used independently of the html front-end, and provide a template to abuse Pinnacle.
To win World Series and MVP
Posted by Rufio Magillicutty in Betting, MLB on October 19, 2011
Pinnacle isn’t offering MVP props, so I used 5Dimes as the market setter. The book that takes the highest limits is on the left and used as the base to compare with other books. Similar to what I did before playoffs started, where the Rangers to win the ALCS prop had the best overall market value.
Doesn’t look like either side has any immediate value. Personally I like the Rangers but what do I know.
The players in bold appear to have over 1% market value. Conveniently they play for different teams in different capacities. If the Cardinals do win I find it hard to believe they out hit the Rangers, and conversely the Rangers are built around a tremendous lineup and a deep bullpen. A bet both on Carpenter and Hamilton brings together the winning attributes of their respective teams.







Recent Comments