All posts by trader247

What’s going on?

[I started this post last week and now I think I’ve solved the problem, but as I’ve written it, you can read it. solution at bottom.]

Over the past two weeks, Oscar, my UK dogs bot, has had six markets failing to trade out or green up. After the first two, I stopped for two days whilst I got round to checking the code but everything was fine, as it should be as I hadn’t changed anything. I restarted and after another few days of trading ok, it happened again, so it’s now stopped. I can’t see anything particular about the markets it’s happening on, and the connection from my VPS appears good. I’m now thinking of adding some extra code to record more details in hope of catching what’s going on.

I’m less narked than you may think as the result so far is I’m up £40 from the errors. But obviously I can’t let it carry on.

In other news, I’ve been reading. A challenging task for someone who flits from one thing to another. Anyway, this had lead to some really good coding sessions (from my point of view) but nothing live yet, only recording and paper trading.

I put quite a bit of time into code that aims to measure the chance of being matched after a trigger is reached and over what period that match would take place. Recording price movement is pretty easy and amount matched over a short period in one direction is also simple. But tracking price, piq and amount matched if the price moves against and then returns, then goes positive, before returning against, is a job for good code. (I’ve not had it marked yet, so no conclusions.)

And I’ve just put on test some code for showing which runner has won on inplay markets. My aim is to know the winner straight away and not have to have a separate process. I have some old code that would take my bets sheet (paper trades) and check it against the RP results page (by runner) after all the races were finished but it requires random fettling to keep up with the website changes. I haven’t used it for some time. It also only happened once a day. My new code works with obvious winners, reaching and staying at 1.01, but then handles close calls individually, with unknowns highlighted for my attention at the moment (this still requires input from me but I’m not checking through every market). I get a rolling update from this.

Inplay is not something I’ve botted with any interest before. But a post on the Gruss forum caught my attention. It regards a simple strategy shown in a YouTube video. It got my interest in the inplay side of things. Rather than throwing bets in and seeing what happens, I thought I’d approach this with a plan and code my way to results rather than bet my way there. If the testing comes to nothing, no waste, I’ve got some cracking reusable code.

[SOLVED, I think]

As mentioned at the top, I think I’ve found the problem.

It’s a time issue. My server clock was 33.7 seconds behind. You can find this out by going to the website – time.is. (My laptop is 0.8s out.) UK dogs are quite sharp with suspending, 30secs+ could easily miss my greening period.

A simple fix? No. Why would it be? Multiple tries at pointing my desktop clock to various internet ntp clocks resulted in a 0.1 second increase in error (huh). I Googled around and found an article on Dimension 4. Downloaded it. This took a few attempts with different servers and then bingo! Back to time.is for an exact result. Bot restarted. Time will tell (time, it’s a time pun, ha ha).

 

Advertisements

Outsourcing theft

Seamus asked –

How does using a VPS affect your risk of hackers stealing your strategies?

The main risk from using a VPS is not from hackers but from an insider ie an  employee of the VPS provider. Some random could target the VPS provider but I’d guess there’s more valuable data than my penny bot.

There are steps to take to improve security. Google “setting up a VPS” for some tips. Also password protect excel code. This is weak but combined with an event handler that clears certain settings on close and open events would render the bot useless. As with all things, if someone really wants it they’ll get it, whether that’s hacking your home pc, your VPS or smashing your back door in and legging it with your computer.

If you’ve got a very profitable bot then I don’t see any need to move to a VPS, you’re already winning. If, like me, your main point when people ask “how’s the betting going?” is to say “well, I don’t lose”, then move to a vps, save money on the electric bill and have less connection-loss, enjoy the feeling of playing in the big league and don’t worry about someone twoc-ing your ok bot.

Values.

Negapo and Captain Sensible commented/discussed over on the Gruss forum (click here to have a look) referring back to my discussion with Steve that started here. It’s about value and where we find value. Both discussions are interesting. Here’s how I see value and what it means to my bot.

True value

The true value (true odds/true price/etc) of any horse/dog/yacht can never be known before the event. The fact is a horse will either win or lose (except in a dead heat but let’s ignore that for now). The closest thing we have to true value is the starting price (SP). If you were to back (on Betfair) every favourite horse at it’s SP, I’d expect you would be on average around break-even, having winning/losing runs, but nothing consistent (your wallet would decrease due to commission paid). If this was not the case and SPs were always overpriced for example, then this would be known and people would exploit them, which in turn would effect change on the SPs, pressuring them towards true value, therefore making the SP near to true value. It’s a system constantly being balanced by it’s participants (the crowd).

Value bet

You’ll never know the true value of a single runner. You have your views though and decide that dog number two in the 15:35 has a true value of 4.0, the market is currently at 5.0, you back it with a stake of £10. It wins. Were you right or wrong to price it at 4.0?  Again, you’ll never know, not on that one outcome. After the win, and after the fact, the true value was 1.0, because it won. In the unlikely event that you always pick winners, not one loser, then stop reading this, you are unique and very rich (or you’re trying to sell something). You’d also be able to say the true value of any of your selections is 1.0, because they always win. In all other scenarios though, you’ll know if you’re finding value bets because you’ll be making profit in the long term. If you repeatedly back at 5.0 when the true value is 4.0, you’ll see it in your results. You wont win every bet, but you’ll be on the right side making profit.

Value trade

Finding value when trading is, or can be, different. Making profit will mean at least one bet in a trade is at value but this just has to be, as you’ll be making that trade across, or on one side of, true value, with both a back and lay position. I find it easier to explain this using some excellent graphics indicating back and lay points.

The trade in the image below, with respect to outcome, the lay bet is at value, the back bet isn’t. The result is profit.

layatval

The trade in the image below, with respect to outcome, the back bet is at value, the lay bet isn’t. The result is profit.

back_at_val

The trade in the image below, with respect to outcome, both the back and lay bet are at value. The result is profit.

The trade in the image below, with respect to outcome, the lay bet is at value, the back bet isn’t. The result is loss.

lay_at_val_lose

The trade in the image below, with respect to outcome, the back bet is at value, the lay bet isn’t. The result is loss.

back_at_val_lose

The trade in the image below, with respect to outcome, both the back and lay bet are not at value. The result is loss.

bk_and_ly_no_val

From these professional quality graphics we can see two things for sure –

  1. If both back and lay bets are at value then you have a profit.
  2. If both back and lay bets are not at value then you have a loss.

In the other masterfully created images where one bet is at value and the other isn’t, it is the relative price of the back and lay that determines profit or loss.

What’s it mean to me?

This brings us back to the point I was challenging last year regarding API crashes – “Every bet you place with a bot should be sent because you believe it to be value at that time and it should be allowed to stand on it’s own merits.” – Steve.

Looking again at the first image –

layatval

If my entry point is the lay at 2.34 then not closing would leave me with a value bet. If my entry point is the back at 2.42 then not closing would leave me exposed with a less than value bet. However, I see statistical value in backing at 2.42 and I’m predicting a move to 2.34 due to market conditions, with no regard to the runner/selection/sport. I need to close the trade to profit. (These figures are for illustration, in reality I’d be expecting a move from 2.42 to 2.40, one tick only.)

I have no idea at all if my bot is entering the market at value with regards to outcome. My only concern is the short-term price movements. My bot is scalping, chasing pennies, harvesting small profit from others intended trades, jumping in the middle, whatever you want to call it. I have no care for the outcome or the sport, only the market and it’s behaviour. Therefore my requirement is to close out every time, for profit or loss, within seconds of entry. I am aware this type of trading is disliked by some, such is life.

Out of interest and in response to a comment by Captain Sensible, below is a chart of the results (P&L) of all the back entry bets placed over 6 months on the Australian horses. As can be seen I’d currently be over £300 up, hitting a high of over £400 and a low of around -£300. But there is no consistency to be relied upon here. This chart suggests to me that I’m not relying on my entry being at good value with regards to outcome. Closing all these trades resulted in a steady consistent profit.

aus_horse_bk6_mth

 

2017 Results

Here are the numbers for 2017 –

Number of markets traded – 28,006

Number of bets settled – 167,836

Traded volume – £852,690.97

Profit and loss – £424.77

Return on traded volume – 0.058%

I haven’t really been bothered with it for a few months and am actually surprised with the final figures (DIY and family have had my time of late). I check in on the VPS now and again and was seeing the past few months not doing very well. The totals for 2017 are propped up by a strong start to the year (see image at bottom).

A little dig in to the numbers we can see that more markets were traded than in 2016 – up 1231 – I did run in other events for  a couple of months or so, which accounts for about the difference. Number of bets settled were down. Traded volume was down overall by around £150,000. Average traded per settled bet dropped from £5.27 to £5.08. Return dropped to 0.050% from 0.069% with a profit for the year of £424.77. (Taking into account the costs of the bot, currently at £21/month, gives a real profit of  £172.77 and a real return on traded volume of 0.020%.)

BIG FIGURE – Traded volume since restart in 2015 is –

£2,044,911.17

That’s a multi-million pound botting operation right there!

I spend more time thinking of coding than actually doing. I sat down to do some tonight but ended up sorting results and doing this post. We’ll have to see what I get up to this year but I would like to advance the current bot.

To my fellow bottors – I hope you all profit from your hard work, happy 2018.

 

2015_2016_2017_totals

August ’17

The streaming version of Gruss is better now, none of the issues of late with missed market list updates or getting stuck on expired markets.

The new Oscar on the Aus horses has performed flawlessly (apart from another schoolboy error that lead to it trading one race the first day out and not moving on). I now need to add all those changes to the UK dogs, not that I have any trouble there but the code is neater and more efficient, so good practice to implement.

I haven’t done any more with the bots other than update Gruss when new beta versions are released, as I’ve been busy with other things.

A good chart from the UK dogs, less up and down than last month.

chart_ukdogs170831

Generally good for the Aus horses. The sharp up then down was a run of four races where only one back bet was placed. No offset or green bets placed/matched. I’m assuming there was either an API issue or connection problem. These races don’t seem to suffer from early starts, so it isn’t that. And they were different venues. One of those things.

The sharp drop prior to those four errors was a failed offset/greening sequence. There were 7 back bets placed/matched fully but the seventh lay bet wasn’t matched and then greening only partially matched.

These were all before the new code for greening went in, so I’ll have to wait and see if it happens again. I’ve probably said it before but in the long run, these errors tend to have very little effect.

chart_aus_horse170831

Although I praised the US horses last month, compared to the Aus dogs, this chart has pushed me to stopping the bot. Four missed offset bets resulting in a gain overall. I think the way my algo trades the markets, it just isn’t worth the risk with too few bets placed. There isn’t the turnover to recover in time for the next problem/error.

chart_ushorse170831

As mentioned last month I went to the Ebor festival at York for the Saturday races. It was a good event, nice weather, plenty to eat and drink. I’d gone with a tight limit on the betting and placed bets with the on-site bookies, to enjoy the experience. I don’t really like gambling though (in the traditional way), I can’t get past thinking I’m just going to lose as I don’t know anything about picking winners. Won nothing, surprise, but had loads of laughs and enjoyed getting to the front to see the horses race past the finish post, great atmosphere and very impressive. And Saturday night in York was a laugh too, finished with a kebab, “large… hic… everything on it mate… hic…  “, which seems like the best thing ever at the time but probably best forgetting about afterwards, rather than contemplating it’s content.