Lefora Free Forum

bmsleight's Blog

NC, US

Brendan M. Sleight

http://www.barwap.com
Member For: 1 year, 6 months
Posts: 47
Top Post By bmsleight (most thumbs up):

No posts received thumbs up, next time you see a good one, give some respect and thumb it up.

Recent Posts by bmsleight:

Re: Poll: Favorite bot programming language ?

November 13, 2008 by bmsleight

Oops - forgot C#.NET.

Poll: Favorite bot programming language ?

November 11, 2008 by bmsleight

Re: Complete Noob - Can You Please offer some advice

November 9, 2008 by bmsleight

Inksmithy - I feel the same way about perl. But now I have dumped her completely and Python is the only scripting language for me.

Re: Complete Noob - Can You Please offer some advice

November 7, 2008 by bmsleight

Hi Buddie,

There are a plethora of languages to choose from, so it is hard and can almost be religious. How about Python/Perl/Php or even it hurts being a GNU/Linux fan (Excel and VBA). I think there are some code snips on the befair website that stop simple stuf with VBA and excel.

Hope this helps,
Brendan

Re: Automatic Exchange Betting, Colin Magee

October 26, 2008 by bmsleight

Thanks Fred. Saved me the cost of book purchase. Perl - hmmm, what ever rows his boat. Not something I would use anymore.
Linux can be very unstable, badly configured, (this is from the man that only has GNU/Linux machines).

The database is a fundamental. Mysql/sqlite what ever is easier to use for scripting language.

My main problem at the moment is I can not get my database to consistently tally with my status of my actual position of open/closed bets. I suspect that I may be getting inconsistent replies from betfair api. Its now a case of slowing logically stepping though my code. At the moment one inconsistency can wipe out all of my profits for weeks.

I have bet which I think have successfully concelled (and hence removed from Database) - later being matched bets. LOL - the old programming trick of explaining the problem to a 3rd person - I now have a idea of how to solve my problem. DO NOT removed the bets - at least for a while.....

Brendan

Re: Automatic Exchange Betting, Colin Magee

October 24, 2008 by bmsleight

Fred - As I am an open source fan. Which software did it us ? I might give it a spin.
Also what was/is the logic the simple bot ?

Brendan

Re: What looks to be a decent hosting solution

August 23, 2008 by bmsleight

I find it very good.

The website front end is http://autotesting.livecd.org/ test the responsiveness for yourself :)

Quick and dirty speed test:-
http://pastebin.ca/1182585

Hope this helps,
Brendan

Re: What looks to be a decent hosting solution

August 22, 2008 by bmsleight

I use these http://cheapvps.co.uk/ for a non-betfair application. £5ish per month.

Re: Scraping keep alive

July 26, 2008 by bmsleight

Get a random real page every 15mins ?
E.g. http://sports.betfair.com/Index.do?mi=21094686&ex=1&origin=MRL

Or simulate a button press of refresh.

Re: New Cross-Matching Logic on Betfair

July 17, 2008 by bmsleight

If I were betfair I would be trying to do the same thing. The profit betfair must make from me - no way pays for the bandwidth I must chew up on their servers. If Betfair can do the same trick I do at the server end, it stop me eating up there bandwidth. I do not think there care about the odd profit from over-rounding. IMHO it all aimed at reducing bandwidth costs, just like the data charges.

Apologies to fred77, but if they eat a over-round/under-round market before it appears on the API or website, then all the bots hammering the bandwidth to try and grab this will go away. Betfair as a business reduce what must be there only significant cost - bandwidth, whilst maintaining the profit from the 5% commission.

I know I this may be a bit controversial but I think there are trying to get the balance right - keeping the liquidity that me and my bots provide but driving me away from burning up bandwidth. Anyway that the direction I will be taking my bots in. Designing low-bandwidth bots which betfair should leave alone.

My 2p worth,
Brendan

Re: calling bmsleight ....

July 10, 2008 by bmsleight

Fred - it does not suport code pasting that well, I have created a test category.

However for code I would use a pastebin. For example:-
http://pastebin.ca/1068476

And set the expiry date as required.


Hope this helps,
Brendan

Code Examples

July 6, 2008 by bmsleight

Please post code example or links to code examples.
To keep this topic as a clean list of examples, please do not discuss the examples in this thread - use the General Forum.

Examples on betfair Developers site:-
http://bdpsupport.betfair.com/ics/support/default.asp?deptID=2805&task=download
* VB/Excel application
* Examples of valid xml for requests
* .net Examples
* Microsoft Visual Studio 2005 (C#)
* Java Demo
* Php Samples


Perl
http://code.google.com/p/betfairfree/

Code by Nadat:-
http://diybetfairbots.lefora.com/2008/07/04/examples/
"The C#, Ruby and Python examples I'd made available on Google Code. I've undeleted them; they are here":
http://code.google.com/p/betfairclient/
http://code.google.com/p/betfairrubyclient/
http://code.google.com/p/betfairpythonclient/

bmsleight take on nadat's code:-
http://code.google.com/p/pythonbetfairlibrary/wiki/Introduction

Re: I pose you all a question

July 4, 2008 by bmsleight

As fred mentioned - Stafanbelo's website is:-
http://bfexplorer.net/

Re: Examples

July 4, 2008 by bmsleight

Cool.

Re: API via python - calling nadat

July 3, 2008 by bmsleight

Cool. Now I have learnt another term as well :)
http://en.wikipedia.org/wiki/Duck_typing

I am finding it very useful. It is my 2nd python project, I struggle with C, but python appears to fit very well in to my style.

BMS

API via python - calling nadat

July 3, 2008 by bmsleight

Hi Nadat,

Did you write the python code originally at :-
http://code.google.com/p/betfairpythonclient/

I updated it, (only a little)
http://code.google.com/p/pythonbetfairlibrary/wiki/Introduction

Related topic:-
http://diybetfairbots.lefora.com/2008/05/20/api-access-python

I using it lots. Once again thanks for the code.

Brendan

Re: Euro 2008

July 2, 2008 by bmsleight

Blackmagic. Each betId can have one or more transactionId. Therefore the £4 @ 6.5 would give you :-
betId: 12345678 transactionId:98765431 matched Odds 6.5 stake £2
betId: 12345678 transactionId:98765432 matched Odds 6.6 stake £2

If you call with out the details, the amount matched would change. It is worth getting the transactionID to see the detail.

Hope this helps,
Brendan

Re: Euro 2008

July 1, 2008 by bmsleight

I have the same system as austinpodhorzer. Each betId has a nickname for the bot that placed it - in within the database table. The fun comes when a canceled bet comes back to life. So I decided to on run one bot per matchId.

eskei - What fun! I find the bot logic is easy. I have a large framework around the API which tries to capture the pitfalls. The bots are abstracted away from this framework. The pitfalls eat in to my profit the most. Thanks for the tip another possible bullet to dodge.

BMS

Re: Euro 2008

June 30, 2008 by bmsleight

So how was Euro 2008 ?

Me - up and down.

Small profit but mainly ran in a few bots. There are more ways a bot can go wrong than I originally had planned. Not always consistent results via the API. I appear to have canceled bets that come back to life a few call later.

Fun fun fun.

Brendan

Re: calling bmsleight ....

June 28, 2008 by bmsleight

The old fred77.co.uk did not have much structure and was very quick to parse the latest posts with any reading lots of topics. The downside was the topics were hard to track..

In a nutshell - I'm not planning to change I believe the balance is right between structure and free-flow. However I am open to persuasion and requests.

On the other hand, I tried to add some more structure. For example:-
http://diybetfairbots.lefora.com/2008/05/10/code-examples/

Quote "Please post code example or links to code examples. To keep this topic as a clean list of examples, please do not discuss the examples in this thread - use the General Forum." And guess what? people still use the topic for discussion, so if a bit more structure is required posters have to try and respect the structure.

Regards,
Brendan aka bmsleight

Re: Any poker players here?

June 22, 2008 by bmsleight

Re: Any poker players here?

June 22, 2008 by bmsleight

I play poker online and offline. I have yet to try the betfair poker. I'd imagine it it full of poker bots already. I did have a long think about making a poker for a normal online poker-sites, but after the Americans really clamped down on visa payment to poker site the whole liquidity dropped out of the market.

I apologize in advance, but this it what I found. The American casual player, pre-clamp down, where of a far lower standard than European online players. Once the Americans when away the liquidity was down and standard went up. To such a extent that I can scrap a small profit, but time is better invested into my betfair bots. Then again - some day by bots.....

I have a friends (offline) poker match on Friday.

Anyway rambling reply over. What ideas ?

Re: GetAllMarkets strangeness.

June 19, 2008 by bmsleight

Yep scientific notation. 1.450023758 E7 -> shift the . by E number of places e.g.:-
1.450023758
14.50023758 1
145.0023758 2
1450.023758 3
14500.23758 4
145002.3758 5
1450023.758 6
14500237.58 7

14.500,237.58

BMS

Re: Exposure calculation

June 18, 2008 by bmsleight

I use a python class (as per attached) and feed one instance matched bets and another instance unmatched bets and matched.

This does not cover the worst-case of some of the unmatched bet being matched and some not, but if I really wanted this I could feed a sub-set of bets to the class.

Hope this helps,
Brendan

class liableClass:
    def __init__(self):
        self.runnerNames = []
        self.totalLaid = []
        self.winPayOut = []
        self.totalBet  = []
    def newRunner(self, runnerName):
        self.runnerNames.append(runnerName)
        self.totalLaid.append(0)
        self.winPayOut.append(0)
        self.totalBet.append(0)
    def addBet(self, runnerName, odds, stake, betOrLay='L'):
        if runnerName not in self.runnerNames:
            self.newRunner(runnerName)
        i = self.runnerNames.index(runnerName)
        if betOrLay == 'L':
            self.totalLaid[i] = self.totalLaid[i] + stake
            self.winPayOut[i] = self.winPayOut[i] + round(((odds -1) * stake),2)
        else:
            self.totalBet[i] = self.totalBet[i] + stake
            self.winPayOut[i] = self.winPayOut[i] - round(((odds -1) * stake),2)
    def profitIfWinner(self, winnerRunnerName):
        profit = 0
        for runnerName in self.runnerNames:
            i = self.runnerNames.index(runnerName)
            if runnerName == winnerRunnerName:
                profit = profit - self.winPayOut[i]
            else:
                profit = profit + self.totalLaid[i] - self.totalBet[i]
        return profit
    def minProfit(self):
        allProfits = []
        for runnerName in self.runnerNames:
            p = self.profitIfWinner(runnerName)
            allProfits.append(p)
        if allProfits:
            return min(allProfits)
        else:
            return 0
    def maxProfit(self):
        allProfits = []
        for runnerName in self.runnerNames:
            p = self.profitIfWinner(runnerName)
            allProfits.append(p)
        if allProfits:
            return max(allProfits)
        else:
            return 0
    def spreadProfit(self):
        return self.maxProfit() - self.minProfit()


Code Snippets

June 11, 2008 by bmsleight

A space for uploading code snippets.

Topic should reflect the snippet thyme. Then either attach a file or link to the code. For example:-
http://code.google.com/p/pythonbetfairlibrary/source/browse/trunk/exchange.py
Line 509+