Tag Archives: automated betting

Australian greyhounds and other activities

As mentioned in a previous post, an Oscar clone has been let out of the traps (ha ha, out of the traps – greyhounds, traps, letting out of the… yeah, yeah) and has been trading the Australian greyhounds for the past week. The liquidity is generally lower on these markets, especially for the earlier races but some of the later races are ok. With settings almost identical to those for the UK, only 27 races saw any trading with a total 115 bets settled. Profit of 27 pence (coincidentally) and £270.69 traded, giving a P&L/TV of 0.1%, which is not an unusual figure for Oscar. I’ll let it run for now to see what results come in.

aus_dogs_170521

Other activities

I know many of you will have it on your mind but for those that are new here – back in October I did a post on stakes ending with me wondering what to do with any profits. I gave four possibilities, as I saw it –

  1. Leave it where it is, doing nothing.
  2. Create a second Betfair account, for other/future bots or split activities.
  3. Remove from Betfair, put it in savings to be returned to Betfair when required.
  4. Remove from Betfair, spend it (I doubt this will happen).

Option 2 is not an option. I thought option 3 would be the one to go with but the wife suggested (after pointing out that there wasn’t vast amounts to play with ” and after all that time you spend on the computer“) that I should buy something – option 4 – which was MY LEAST favoured option. So after thinking it over and realising that she was right, because that’s how it is, I decided to part company with my faithful 20+ year old mountain bike (Claud Butler frame swapped for a scrap ’85 Ford Escort, crank and gears from a previous GT, all other parts swapped/added separately pre 2000, except tyres) and purchase a brand spanking shiny new modern lighter full suspension ally framed disk braked, mountain bike. I’ve been using it regularly for the past few months to try (really try) to improve my fitness. This is most certainly a work in progress.

img_20170114_140522068
Old
img_20170114_140422315
New (when it was new)

(p.s. I still have the old bike, just can’t bring myself to drop it at the tip after all these years)

 

Speedy data 2

My Speedy data post generated a few comments and some discussion. I really appreciate people taking the time to get involved and share their knowledge and views.

The first comments came via twitter from TraderBot (here and here) with a link to stackoverflow. This is a site I’ve found to be really useful to get help with many programming issues in multiple languages (That reminds me, I keep meaning to do a list of what I use – apps and sites). The Q&As linked to, although relating to Java, are an interesting read with an answer to the speed question, in summary, of “it depends on what exactly you want to do/measure”.

LiamPauling commented on the post asking where I’m hosted and do I stream? I’m cloud hosted and not streaming. He continues that he thinks bottlenecks are more likely elsewhere, which, after further reference in later comments, seems to be a good point.

Betfair Pro Trader asked why I wanted to use an array. It’s not that I want to use an array more than any other data structure, I was looking at getting the best solution, if such a thing exists (which is becoming less clear).

Tony, via Twitter, suggested running a test code with the different structures used. This could be useful but I was put off from this initially by the confusion I was getting from reading differing opinions based on various implementations of arrays, collections and dictionaries (and later, lists). At this point I was thinking that the optimum stucture is dependant on the specific use and there isn’t an exact answer to my speed question.

Next, a comment from Ken. He points to Lists as it’s something that he uses regularly and he talks of some of the benefits. Again, I’d previously come across articles saying lists were slow but maybe I was too quick to dismiss them. Betfair Pro Trader has also suggested using lists and dictionaries combined. Ken adds that he codes in C# (C sharp) but I think for the purpose of data structures and speed they are similar (they, C# and VB.net compile to the same language and run against the same runtime libraries).

n00bmind added a detailed comment. He makes the point that the advantages of one structure over another are not always so, as mentioned above. Also, he goes on to agree with previous comments that my speed question may be missing the main issues – those being the program/algorithm itself and network latency. Further advice is given about profiling (something, as a specific process, I haven’t come across before) and maybe using a different language, such as Python (I have only a basic understanding of Python from messing with it on my Raspberry Pi).

Finally, Jptrader commented, agreeing mostly with n00bmind, and others, about looking at “handling network latency properly and doing performance profiling”.

Although a simple answer hasn’t been found (because there isn’t one), I’m guided by these comments to focus more on my code, handling serialization and latency, making the algorithm efficient and using the data structures that work for now, whether that’s arrays, collections, dictionaries, lists or a combination of. Moving to another language just isn’t feasible for me at the moment, it’s taken me over a year to get a running bot in VB, with limited hobby time. I am happy to accept that another language may have it’s advantages, so would advise others to look at this for optimising their bots performance (for me the advantage will be seen moving from VBA to VB.net).

The testing I’ve done hasn’t shown any particular advantage of the different structures. From my searches on the web I think this could be due to the relatively small amount of data I’m handling (many articles talk of data lines in the 10s to 100s of thousands when comparing structures). An error on my part also had me making double calls for data with my bot which added to my difficulties and questions initially.

I have plenty to be getting on with for now and will continue looking to improve my bots. Thanks again for all the comments.

Speedy data

Speed is an important part of my bot development. When it comes to storing data, the options (data structures) I’ve been working with are array, collection and dictionary. When I Google for articles on speed, I get lots of information pointing to dictionaries as being the fastest for programming. But the main point of interest in the articles is the speed of looking up data. To find something in an array, all elements have to be looped through until it’s found (or isn’t). The use of keys in collections and dictionaries makes lookup faster as they can be targeted without looping, as long as you know the key(s). There are other advantages that make dictionaries preferred to collections, however they seem less important when looking at speed. A disadvantage of arrays comes when changing its size. Collections and dictionaries can have elements added without problems. To do the same with an array, we have to change its size to accommodate more data, which involves more time as the original is put into temporary memory and a new, re-sized, array created with the existing data then added to it.

This leaves me thinking that the two main speed disadvantages of arrays is searching for data and resizing. Here’s the question I’m looking to answer – if I know the size I want the array to be and I know the location of all the data held in it (so I can refer to each element directly) is there a speed benefit to using collections or dictionaries? Any help appreciated.

Weeks ending 12-03-17

Well nobody spotted last weeks howler – I only titled it “Weeks ending 06-03-17”. I guess you did see it but found more amusement in keeping quiet. You are fun.

algotradingforfun added this comment-

Great 2nd week there. Need to think about handling the bf crash scenario when in autopilot. I don’t think it would be a disaster if not about but does create some extra risk.

Thanks. For me the crashes can be a bit annoying. Oscar backs first so the greatest loss is the stake, assuming a clean cut crash. If you’re laying first the exposed risk between entry and exit is far greater, add multi-runner trading and that increases, something to consider when setting up a bot.

 

Mike also commented-

The regular Betfair crash is a royal pain. Your take of their response is amusing and spot on. There is an API status page (not widely publicized) which is a little more real time than the “help” desk. Don’t know if you can link your bot to the status but might be an option. http://status.developer.betfair.com/

Thanks, again. A pain, agreed. I saw this status link on Twitter for the first time after this last crash and it does provide some confirmation but did seem a bit delayed. After I’d first seen the tweets I looked at the status and only one request was showing problems (/listmarketcatalogue maybe?) so trial and error would see if it could provide any bot use. But it was certainly ahead of the Saturday boy and his well thumbed guide.

 

One week on these charts. Interesting profile on the dogs, start flat, end flat, with sharp rise Friday/Saturday. All figures are in line with previous period which is good.

170312

Aus170312

Another milestone was passed with these results, I became eligible to pay premium charge as my lifetime percentage dropped just below 20 to 19.92%. I’d already used some of my allowance which I think was linked to data charges that are no longer used. So this week saw £1.98 taken off my allowance; at that rate it’ll be 9 years before I actually pay anything. Unfortunately, if my total charges percent continues to fall, the weekly PC will rise. A drop to 19.72% would have seen a PC of £5.50. This is the price of (small) success. On a positive note this does put me in a bracket with 0.5% of customers which, if Wikipedia can be believed, is either 20,000 or 5,500 people. What joy.

Weeks ending 06-03-17

Two weeks this period, starting from 20:30 on the 19th (see last update). A good return from both the dogs and horses but the first week ended barely up. The second week was one of the most profitable I’ve had.

170305Aus170305

Saturday 4th March saw another big Betfair crash* with the exchange offline for nearly an hour and betting disabled for some time after that. As I was at the computer when it happened, I took the opportunity to run updates on the VPS OS. I have it set up to tell me when updates are available but I choose when to install them. I’d advise any botter to do this, as the last thing you want is the computer restarting mid-trade after auto-updating. I also decided to add a bit of code to change how and when the bot saves it’s log sheet. A simple enough task as I’d already written the code for another, now retired, bot. Copy, paste, change sheet references and save location, job done, what could possibly go wrong? Not testing with live updating and thinking I know best and the bot locking up at 2am trying to repeatedly save a file that at the second attempt already exists, is what can go wrong. I’ve said it myself before now – always check, check again and test live. And check again. No harm done but missed most Aus horses on Sunday. Added to the missed Saturday dogs, the results are even better.

* All major exchange crashes seem to follow a similar pattern. Some people start reporting blips, pauses in the refresh rate. Betfair Customer Service (a questionable department title if ever there was) denies all knowledge with the stock phrase “It’s all good here”. Then comes total blackout. Many an unrepeatable turn of phrase screamed by the loyal customer base and the Betfair bods half acknowledge with the second phrase of the Betfair How to Keep Customers in Suspense Guide – “We’re looking into it”. Third line, after some threats of violence, use of very specific graphic language and calls for a mass exodus to Betdaq, is- “Apologies for this guys, our techs are on it”. Following a period of silence from the exchange masters, allowing for a build up of calls for refunds and shared stories of thousands lost, comes the market controlling monopoly confirming legal statement – “Refer to our Ts&Cs”. The first few markets after reboot are played cautiously before all but the over-exposed carry on as usual, allowing said monopoly off the recently polished hook.

Weeks ending 19-02-17 (8:30pm)

As previously mentioned I’ve been using my time to code my own trading bot, so this catch-up covers seven weeks by my reckoning. On the dogs the return has been ok at 0.055%. I’m still running on stakes that are not linked to balance but vary within a small  amount. All the dog’s weeks ended positive, just.

170219

The Aus horses performed better for the period, at 0.084%, but as can be seen from the chart, there was a negative run. This stretched over approximately 10 days. Combined with a low profit for a week from the dogs, this saw the first overall weekly loss for quite some time, ending -£2.62. It does have an emotional impact, even though a small loss, after such a long time seeing the bank’s increased at the end of each Sunday. I did feel like I wanted to change something in the code but I held tight and the P&L returned to a more usual level. This is why I couldn’t trade manually – I’d drift away from the plan after each loss in an endless battle against the now.

aus170219

 

 

2016 – a brief history (and Week ending 01-01-17)

I’ll start with last week. Dogs were down on number of markets/bets/volume but up again on return. It’s the highest return since July.

170101

The Aus horses had a good week too. Although return was down slightly, -0.007, the overall trend is good. Last period saw two large losses on the dogs, this time it’s the horses turn. No worries though. Next, on to the annual review.

aus170101

Annual review

It’s been a positive year with a profit from most weeks, there were only three weeks ending in an overall loss (across all markets), with one of those due to an error. This year also saw the move to a VPS and then cloud VPS, giving a faster and more consistent connection. I’ve dabbled with my other bots but not taken them live. I tried Oscar over the pond for a while but the US horses were a loss. Slayr was an accident and started out backing, then switched to laying, then back to backing (small number bias and all that). It is still running on Betdaq, an update on that soon, but it doesn’t trade as such, just places a bet based on the prices available. My work on my own trading app stalled but this is going to be my main focus this year. I’ve got Betfair Pro Trader’s new book which is providing inspiration and ideas. I’ve also made myself a plan which I hope will prevent me getting easily distracted and bouncing between one idea and another.

High and low

This years high has to be the brilliantly consistent(ish) profits returned by Oscar. Regardless of actual amounts, the same trading algorithm has performed for the year without many code changes, most of which were not to do with triggers or execution.

The low was the crash of Thursday 26th May at approximately 20:42 which resulted in a loss of £59.40. It set my bank back by around 5 weeks. And it hurt. But, on-wards and upwards as they say.

The year in numbers

The charts I show on the blog include some amounts for the period. The figures for the period 4th January 2016 to 1st January 2017 are as follows –

Number of markets traded = 26775

Number of bets settled = 197158

Traded volume = £1039959.93

P&L = £717.25

PL/TV = 0.069%

Traded volume is probably an incorrect term as it’s taken from finance but never mind. It’s my way of measuring and is simply the total of the amounts going in and out of my account, ie money I’ve traded with other bettors.

The blog

I’ve enjoyed doing the blog. It’s useful for me to be able to look back at what I’ve been doing. I also hope it provides some sort of information/ideas/entertainment/wonder to others. My page views have gone up over the year, mainly with links from Twitter, Betfair Pro Trader and Green All Over. I seem to get views from all across the world – 60% are from the UK but I’ve had hits (according to WP stats) from the following countries Australia, Sweden, Ireland, Portugal, Denmark, Czech Republic, Switzerland, Netherlands, Spain, France, United States, Norway, Italy, Greece, Germany, Slovakia, Brazil, Slovenia, Hungary, Poland, Romania, Russia, Hong Kong SAR China, New Zealand, Cyprus, Mexico, Bulgaria, Argentina, South Africa, Latvia, Finland, India, Turkey, Ukraine, Namibia, Malta, Peru, Austria, Malaysia, Serbia, Lithuania, Taiwan, Macedonia, Columbia, Canada, Croatia, Tunisia, Luxembourg, European Union (What? A country? Yes, according to wordpress), Philippines, Chile, Georgia, Belgium, Nigeria, Isle of Man, Singapore, Mauritius, Yemen, Pakistan, Uzbekistan, Thailand, South Korea, Tanzania, Israel, Iceland, Azerbaijan and, last but by no means least, Zimbabwe.

The future

With a certainty that is unknown in the betting/trading/gambling world, the future is definitely coming. As for what or when I do anything, I don’t want to make any promises. I do intend to become a more proficient VB programmer and a better bot trader, in that order.

Happy New Year!