Some Things I Learned About Automated Trading Systems From Writing a Poker Bot

Discussion in 'Automated Trading' started by pipscooper, Jul 6, 2005.

  1. toe

    toe

    pipscooper, the difference between markets and poker is randomness. as you've poiunted out random behaviour on your part helped you avoid other players taking points from you. if there are price movements in the market which are random then they cannot be forecast (just as your bots random intentions could not be forecast by its competitors). therefore your simulations need to give you information about random/non-random behaviour. probably you dont need be concerned about conceiling your intentions in trading but you do need to be concerned about whether random price movement conceils the markets 'collective intention'.
     
    #31     Jul 9, 2005
  2. WarEagle

    WarEagle Moderator

    Interesting discussion. Being a systematic trader for the most part, I have often thought about automated poker play. The problem I see is how to incorporate other players actions into the bots decision algorithm. If your bot only plays based on the card hand odds, then imo there is not a good way to determine long term success or failure once other players' actions are considered. If everyone was playing with the same bot, then the odds could be calculated, but once you throw in bluffing and/or irrational or just plain bad play by others the outcomes will change substantially. Its the human brain component (and arguably this could be said about trading as well) that gums up the works.

    pipscooper, did your bot somehow account for betting choices of the other players or did it just focus on straight up odds of hands? Without having some history of how the other players on the table have played in the past, it would seem that this component would be the most difficult and the "make or break" portion of the bot. Again, this is almost identical to trading, which is why I love poker.
     
    #32     Jul 9, 2005
  3. Toe,

    Thanks for your insights. I think you are being very helpful to guide my simulations towards identifying random / non random market behavior. I think this is some of what Lefty has spoken about on these boards. I also think that this is where the focus needs to be. I had never thought about random market behavior as concealing, "the markets 'collective intention'," but I think this is very well conceptualized on your part and a good way to think about it. This thread is really very thought provoking.
     
    #33     Jul 9, 2005
  4. Hi WarEagle,

    On the U of Alberta site they don't disclose how poki characterizes different players. However live players use a program called pokertracker to keep track of selected player stats. While each player has a different way of doing this, I think that a similar seriousness could be applied to the market as a single player. Statistics could be devised to determine how much opportunity is available in a given time frame, and the current level of opportunity could be compared to historical levels to determine if opportunity is relatively high or low for a given time period, as well as in absolute terms. Here are two threads on 2+2 that talk about some of the statistics the human players use to determine which players at the table are fish and which players at the table are sharks. While it gets a bit technical for those who haven't tried pokertracker, I think there are some lessons there to be learned for both poker and trading.

    http://archiveserver.twoplustwo.com...pe=&olderval=&oldertype=&bodyprev=#Post464135

    http://forumserver.twoplustwo.com/s...23884&page=3&view=collapsed&sb=5&o=14&fpart=1


    I previously stated that I didn't do any player characterization. Now thinking back on it I did do some overall characterization in an effort to determine what cards the opponents were likely holding (rather than just using random hands). I did this by keeping track of all the shown cards, and the betting patterns. One thing I looked at was how often a certain starting hand was played all the way to the river by the players at the .5/1 limit Party tables. Using this information I created a smarter than random set of hands that other players likely were holding based on past holding patterns. Again, this failed to take into account specific players, just assuming that all players would play roughly the same hands. This is clearly a flawed assumption but I didn't do the work to single out players and put them into categories. I think if I were to do it again, I would take the 2 or 3 best statistics listed in the two links above, and calculate them aggregately for each table, and separately for each player, and alter my bot's play style based on each player's stats, just as a human player would do (stay in longer with a marginal hand against a loose player, drop out earlier with a moderately strong hand against a tight player).

    As far as betting patterns I never got that far. I think that would be a crucial element in a poker bot. I read on the U of Alberta site that their stats showed that opponent betting patterns were about 70% accurate in representing the true strength of the opponent's hand. That appears to be a very valuable piece of information that my bot never took into account in its fold/check/bet logic. Can you talk more about how this aspect of poker is a lot like trading? Thanks!
     
    #34     Jul 9, 2005
  5. WarEagle

    WarEagle Moderator

    Thanks for the reply to my questions. What I was refering to was how no matter what your bot does (in poker or in trading) with regards to playing the odds of a hand/trade, the wrench in the machine is how others play those odds. Arguably in poker there is more certainty in that there are a finite number of hands and probably the way each is played would fall into just a few categories based on different play styles. In the markets, the number seems much higher because its like a poker table with 50 million players all at once. Also, if you are playing live you can read the other players, just as pit traders may be able to read people they trade with, but over the internet where you can't see a face it becomes much harder to decipher this aspect of the game.
     
    #35     Jul 9, 2005
  6. kut2k2

    kut2k2

    Trying to learn trading through poker is like trying to learn war strategy through chess. :p

    Does your bot allow for other players cheating? Because the market certainly does "care" about you when some scumbag market maker guns your stop.
     
    #36     Jul 10, 2005
  7. Perhaps, but I felt it was a worthwhile exercise for me. I learned quite a few things from the U of Alberta papers and converting some of those ideas to code. One thing I learned was that both poker and trading are games of incomplete information and what that meant. I realize that you don't have to build your own poker bot in order to read the papers on the subject. But the broadening knowledge on how to approach a game of incomplete information was beneficial to me.


    How do you define cheating? Are you talking about collusion? I didn't attempt to detect collusion as I felt it was something that couldn't be extrapolated to the trading realm. Market participants like market makers, who may have access to privileged order information can only take advantage of the information you provide them, such as resting stop loss orders.
     
    #37     Jul 11, 2005
  8. To continue on with my story, after I made the changes and my bot was more competitive with poki (not profitable but more competitive), I went to work with writing code to interface with Party Poker's client software. In looking back on it there were two main types of bugs in my code: bugs in the interface portion of the program (clicking the wrong button) and bugs in the logic portion of the program (not raising on the river with the nuts).

    I watched the program play on the play money tables, making bug fixes along the way. Some of the bugs were very infrequent so I had to keep watching and comparing what the bot should have been doing with what it actually did. Through watching on the live money tables I learned a lot about how to play profitable poker from watching how good and poor players responded to my bot, and how my bot responded to their play.

    I also put in some code to help my bot avoid detection as a bot, as Party Poker has explicit policies against poker bots on its site (seizing funds). I read some of the stories over on the Winholdem site about Party closing accounts and seizing funds, so I took a bit of time implementing some interface randomization to make it appear like a human being was interfacing with their client, in the event they were able to detect that sort of thing.

    In the final analysis I never worked out all the interface or logic bugs. It is a complex programming task and given more time and interest I could have probably eliminated most of the bugs.
     
    #38     Jul 11, 2005
  9. One thing that I find fascinating about poker is that you can see who is winning and who is losing by watching the players' stacks at the table. When I first started playing poker I wanted to understand what the winning players were doing. After learning the basics of the tight-aggressive style of play I observed how others were playing over time.

    In addition to playing too many hands, the losing players committed too much capital on their losing hands, or often misread the strength of other players relative to their own holdings. This misvaluing is especially true in no limit holdem, where players can go all-in at any time. The winning poker players often wait for others to misvalue their hands, and then they take advantage of the situation by picking off the other players by strongly playing their superior holdings. The inefficiency in poker is created by players who make the wrong plays - tilt, misjudging the situation, misvaluing their holdings, over betting, bluffing, etc. It is this inefficiency that creates opportunity.

    I think it is the same in the markets. Inefficiency creates opportunity. An edge is simply a strategy to exploit the opportunity that exists. I get a chuckle out of the edge threads that recur periodically here on ET. It is interesting to note how many strange notions exist about how to define the word "edge".

    http://www.elitetrader.com/vb/showthread.php?threadid=52147

    So in that regard, the search for a profitable method in trading should really start with a search for inefficiency in the target market. After the inefficiency is located, then a method to exploit that inefficiency can be created. This method is the edge. As long as that particular inefficiency exists in the market, and others are not quicker in applying their edges to the inefficiency, the edge will continue to be profitable.
     
    #39     Jul 13, 2005
  10. Then you must be a born looser.
     
    #40     Jul 14, 2005