Import stats per hand

Forum for users that want to write their own custom queries against the PT database either via the Structured Query Language (SQL) or using the PT3 custom stats/reports interface.

Moderator: Moderators

Import stats per hand

Postby pLatonet » Wed Jan 21, 2009 2:28 pm

Hi,

I want to make a program in c# that automatically import this information:

seats VPIP PFR
seat1 % %
seat2 % %

of the active table.

How could i easily import VPIP and PFR summary in relation with the seats of the database?

I was thinking to first import the players:
Select id_player from tourney_holdem_results where id_tourney = (Select id_tourney from tourney_holdem_summary where tourney_no = 12345678))

Then check their current last position, and calculate their total VPIP and PFR. But i don't know how to do it.

Thank you
pLatonet
 
Posts: 3
Joined: Wed Jan 21, 2009 2:03 pm

Re: Import stats per hand

Postby kraada » Wed Jan 21, 2009 2:52 pm

Those stats aren't easily tied to seat number. You could calculate it yourself by looping over each hand that a given player has played in the past and adding them up and dividing it by the number of hands.

You'd be much better off just creating custom statistics in the PT3 environment and displaying it on your HUD, though, as that will display those stats for the players you're playing against right on the table with very little extra work.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Import stats per hand

Postby pLatonet » Thu Jan 22, 2009 8:24 am

kraada wrote:Those stats aren't easily tied to seat number. You could calculate it yourself by looping over each hand that a given player has played in the past and adding them up and dividing it by the number of hands.

You'd be much better off just creating custom statistics in the PT3 environment and displaying it on your HUD, though, as that will display those stats for the players you're playing against right on the table with very little extra work.


It is indeed complex, but i found it after a while. If someone is interested i want to post it.
pLatonet
 
Posts: 3
Joined: Wed Jan 21, 2009 2:03 pm

Re: Import stats per hand

Postby kraada » Thu Jan 22, 2009 11:05 am

Please feel free to post your findings, I'd love to see what you came up with.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Import stats per hand

Postby pLatonet » Fri Jan 23, 2009 4:43 am

First i try to find the latest position of every player on specific tournament (by sql statement):

Select position, id_player from tourney_holdem_hand_player_statistics where id_tourney = (Select id_tourney from tourney_holdem_summary where tourney_no = 'tournamentnumber')
order by date_played desc, position asc limit (count of players)

This list looks like:
position | id_player
0 | 1122
1 | 1123
3 | 1128
4 | 1384
...
(count of players)


Then i want the stats (vpip and pfr) of the players:
Select (sum((case when(tourney_holdem_hand_player_statistics.flg_vpip)then 1 else 0 end))),(sum((case when(tourney_holdem_hand_player_statistics.cnt_p_raise = 1)then 1 else 0 end))), count(id_player)
FROM tourney_holdem_hand_player_statistics Where id_player = theplayer

This give me:

Counts played | counts preflopraises | count hands
231 | 189 | 12313 for example

in c# i calculate it VPIP: counts played / count hands & PFR : counts preflopraises/count hands

I don't know for sure if PFR is accurate, but of vpip i am sure.

If you are wondering why i want this in c#, it's because i wan't it to use in an offline icm calculator.
But i conclude that the players vpip and pfr per blind change too much, and that the average is not accurate enough..
pLatonet
 
Posts: 3
Joined: Wed Jan 21, 2009 2:03 pm

Re: Import stats per hand

Postby kraada » Fri Jan 23, 2009 10:08 am

For PFR you actually want: ,(sum((case when(tourney_holdem_hand_player_statistics.cnt_p_raise >= 1)then 1 else 0 end))), count(id_player)
FROM tourney_holdem_hand_player_statistics Where id_player = theplayer

But yes, I don't think the overall averages are going to make for a meaningful sample as play varies drastically from player to player.

It still sounds like an interesting study, though, and hopefully you learned a few things, which always makes stuff like this worth it in my mind :)
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY


Return to Custom Stats, Reports, and SQL [Read Only]

Who is online

Users browsing this forum: No registered users and 1 guest