Hand history parsing API¶
Note
Hand history parsing API will change for sure until 1.0 is done.
Constant values¶
These enumerations are used to identify common values like limit types, game, etc.
By unifying these into groups of enumeration classes, it’s possible to have common values
accross the whole framework, even when parsing totally different kind of hand histories, which
uses different values. (Data normalization)
It’s recommended to use keys (name property) to save in database, and print them to the user.
(E.g. in a web application template, {{ PokerRoom.STARS }}
will be converted to 'PokerStars'
.)
-
class
poker.constants.
Action
[source]¶ An enumeration.
-
BET
= ('bet', 'bets')¶
-
CALL
= ('call', 'calls')¶
-
CHECK
= ('check', 'checks')¶
-
FOLD
= ('fold', 'folded', 'folds')¶
-
MUCK
= ("don't show", "didn't show", 'did not show', 'mucks')¶
-
RAISE
= ('raise', 'raises')¶
-
RETURN
= ('return', 'returned', 'uncalled')¶
-
SHOW
= ('show',)¶
-
THINK
= ('seconds left to act',)¶
-
WIN
= ('win', 'won', 'collected')¶
-
-
class
poker.constants.
Currency
[source]¶ An enumeration.
-
EUR
= ('EUR', '€')¶
-
GBP
= ('GBP', '£')¶
-
STARS_COIN
= ('SC', 'StarsCoin')¶
-
USD
= ('USD', '$')¶
-
-
class
poker.constants.
Game
[source]¶ An enumeration.
-
HOLDEM
= ("Hold'em", 'HOLDEM')¶
-
OHILO
= ('Omaha Hi/Lo',)¶
-
OMAHA
= ('Omaha',)¶
-
RAZZ
= ('Razz',)¶
-
STUD
= ('Stud',)¶
-
-
class
poker.constants.
GameType
[source]¶ An enumeration.
-
CASH
= ('Cash game', 'CASH', 'RING')¶
-
SNG
= ('Sit & Go', 'SNG', 'SIT AND GO', 'Sit&go')¶
-
TOUR
= ('Tournament', 'TOUR')¶
-
-
class
poker.constants.
Limit
[source]¶ An enumeration.
-
FL
= ('FL', 'Fixed limit', 'Limit')¶
-
NL
= ('NL', 'No limit')¶
-
PL
= ('PL', 'Pot limit')¶
-
-
class
poker.constants.
MoneyType
[source]¶ An enumeration.
-
PLAY
= ('Play money',)¶
-
REAL
= ('Real money',)¶
-
-
class
poker.constants.
PokerRoom
[source]¶ An enumeration.
-
EIGHT
= ('888', '888poker')¶
-
FTP
= ('Full Tilt Poker', 'FTP', 'FULL TILT')¶
-
PKR
= ('PKR', 'PKR POKER')¶
-
STARS
= ('PokerStars', 'STARS', 'PS')¶
-
-
class
poker.constants.
Position
[source]¶ An enumeration.
-
BB
= ('BB', 'big blind')¶
-
BTN
= ('BTN', 'bu', 'button')¶
-
CO
= ('CO', 'cutoff', 'cut off')¶
-
HJ
= ('HJ', 'hijack', 'utg+5', 'utg + 5')¶
-
SB
= ('SB', 'small blind')¶
-
UTG
= ('UTG', 'under the gun')¶
-
UTG1
= ('UTG1', 'utg+1', 'utg + 1')¶
-
UTG2
= ('UTG2', 'utg+2', 'utg + 2')¶
-
UTG3
= ('UTG3', 'utg+3', 'utg + 3')¶
-
UTG4
= ('UTG4', 'utg+4', 'utg + 4')¶
-
Base classes¶
-
class
poker.handhistory.
_BaseHandHistory
(hand_text)[source]¶ Abstract base class for all kinds of parser.
Parameters: hand_text (str) – poker hand text The attributes can be iterated.The class can read like a dictionary.Every attribute default value isNone
.Variables: - date_format (str) – default date format for the given poker room
- ident (str) – hand id
- game_type (poker.constants.GameType) –
"TOUR"
for tournaments or"SNG"
for Sit&Go-s - tournament_ident (str) – tournament id
- tournament_level (str) – level of tournament blinds
- currency (poker.constants.Currency) – 3 letter iso code
"USD"
,"HUF"
,"EUR"
, etc. - buyin (decimal.Decimal) – buyin without rake
- rake (decimal.Decimal) – if game_type is
"TOUR"
it’s buyin rake, if"CASH"
it’s rake from pot - game (poker.constants.Game) –
"HOLDEM"
,"OMAHA"
,"STUD"
,"RAZZ"
, etc. - limit (poker.constants.Limit) –
"NL"
,"PL"
or"FL"
- sb (decimal.Decimal) – amount of small blind
- bb (decimal.Decimal) – amount of big blind
- date (datetime) – hand date in UTC
- table_name (str) – name of the table. it’s
"tournament_number table_number"
- max_players (int) – maximum players can sit on the table, 2, 4, 6, 7, 8, 9
- button (poker.handhistory._Player) – player on the button
- hero (poker.handhistory._Player) – hero player
- players (list) – list of
poker.handhistory._Player
. the sequence is the seating order at the table at the start of the hand - flop (_Flop) – room specific Flop object
- turn (poker.card.Card) – turn card, e.g.
Card('Ah')
- river (poker.card.Card) – river card, e.g.
Card('2d')
- board (tuple) – board cards, e.g.
(Card('4s'), Card('4d'), Card('4c'), Card('5h'))
- preflop_actions (tuple) – action lines in str
- turn_actions (tuple) – turn action lines
- turn_pot (decimal.Decimal) – pot size before turn
- turn_num_players (int) – number of players seen the turn
- river_actions (tuple) – river action lines
- river_pot (decimal.Decimal) – pot size before river
- river_num_players (int) – number of players seen the river
- tournament_name (str) – e.g.
"$750 Guarantee"
,"$5 Sit & Go (Super Turbo)"
- total_pot (decimal.Decimal) – total pot after end of actions (rake included)
- show_down (bool) – There was show_down or wasn’t
- winners (tuple) – winner names, tuple if even when there is only one winner. e.g.
('W2lkm2n',)
- extra (dict) – Contains information which are specific to a concrete hand history and not common accross all. When iterating through the instance, this extra attribute will not be included. default value is None
-
class
poker.handhistory.
_Player
(name, stack, seat, combo)[source]¶ Player participating in the hand history.
Variables:
Every hand history has an attribute flop
which is an instance of the room specific _Flop
object which has the following attributes:
-
class
_Flop
¶ Variables: - cards (tuple) – tuple of
poker.card.Card
s - pot (decimal.Decimal) – pot size after actions
- players (tuple) – tuple of player names
- actions (tuple) – tuple of
poker.constants.Action
in the order of happening.Form:(Player name, Action, Amount) or(Player name, Action) if no amount needed (e.g. in case of Check)
It also has properties about flop texture like:
Variables: - cards (tuple) – tuple of
PokerStars¶
Full Tilt Poker¶
-
class
poker.room.fulltiltpoker.
FullTiltPokerHandHistory
(hand_text)[source]¶ Parses Full Tilt Poker hands the same way as PokerStarsHandHistory class.
PokerStars and Full Tilt hand histories are very similar, so parsing them is almost identical. There are small differences though.
Class specific
Variables: - tournament_level –
None
- buyin –
None
: it’s not in the hand history, but the filename - rake –
None
: also - currency –
None
- table_name (str) – just a number, but str type
Extra
Variables: - tournament_level –