Tag Archives: Visual basic

A fellow PfB coder

Tony (@SportsBotter) commented –

Good to see you moving on to your own platform. I have had a go at it myself. At various stages I had to tick back what felt like most of the book. In a way making the mistakes forces you to understand how it all hangs together and what you need to change to implement your own strategies.

This is an important part of the learning process and can only be gained by doing the coding yourself. For those who just want to copy and paste the program, the ability to make it their own is reduced. As Tony points out, by making mistakes and then trying to find where you’ve gone wrong, you start to see how the modules come together, where variables get their data and then where and how that data is used/manipulated. Trying to skip this exercise will only make any future changes more difficult.

Now I am quite pleased that I can offer bets and cancel them just using basic non strategic triggers plus change the markets and periods that interest me etc. Quite confident I can now push on from this point with some trading techniques that I couldn’t be bothered to actually perform myself on a day today basis. Now if I can do it …with my reputation… then anyone can ;) 

The video shows an example of what Tony has created, something that fits his own criteria, using the Programming for Betfair code. He also has the Betfair site open so you can see the bets in the markets. Getting to this stage , with a working app, does give you confidence. I am now coding and testing my own bot following the same process that Tony has.

How’s it going?

Automated_trader commented –

How’s coding your own bot going? I got a copy of Programming for Betfair today so gonna try and code my own too. I’ve no coding experience other than a little VBA for my current bots that run on Gruss so hoping it won’t be too big of a leap into the unknown. Might even start a blog to document my progress too.

The coding is going really well with a bot now in testing. I doubt I’d have started without Programming for Betfair as I thought the amount to learn wasn’t worth it. The book helps by giving you everything you need to start auto trading, as in it gives you the code to request data, place bets and handle the responses from Betfair. It also gives you the basic tools to trade with such as profit take, fill/kill and stoploss. Once you’ve worked through the book, it’s just a case of adapting what you’ve learnt to get what you want.

My currently running and previous bots are written in VBA and running through Gruss. Before I started them I hadn’t written in VBA but picked it up from forums and searches. I hadn’t done any VB.net prior to this but understanding it isn’t that much of a leap. It’s the same style of object programming and the terms and layout are familiar after using VBA.

It’s true that any errors (after the corrections on the associated website are completed) are down to typos. A couple of times I thought it wasn’t me and something must have changed making the code not work. But it was me, with one mistake being a missing “A” in an url string. That took hours to find and I’d looked at the offending line of code more than once. Another biggy was missing a whole line of code, again taking forever to find. Sometimes the error message isn’t that helpful, not to me anyway. This one was an “overload” which, I’ve since found out, means you’re trying to put more variables into an object than you have declared. That’s what the missing line was, a variable declaration.

Some things to note, firstly, Visual Studio (VS) uses IntelliSense which highlights errors as you go. To begin with, this is quite annoying as you’ll finish a module and there’s a list of errors, so you spend time looking for what you’ve done wrong – which is nothing. The errors disappear when you complete the next couple of pages in the book. I found it’s better to ignore most of them until you get to a point where the book tells you to try running the code. The ones to correct as you go are missing or expected characters, such as “(“ expected.

Second – VS includes an autocomplete function. This will really mash your head at some points as you try to add a new declaration and it changes it to something else. If this happens, a quick tap on backspace should swap it back to what you typed.

Third – I find that the first run of the code after starting VS can sometimes fail. Just stop and run again. This problem goes once you publish your project.

If you enjoy coding you shouldn’t have any difficulty with it, just need patience. Let me know how you get on.

Milestones

Well they are to me. Towards the end of last week, the total number of markets I’ve taken part in topped 40,000. I like numbers. To think my bots have monitored at least double that amount of markets is amazing.

The second point came on Sunday when my balance hit three figures. In reality it’s irrelevant but visually, it’s encouraging.

And last but not least, bring out the bunting, I’ve started coding my very own bot using Programming For Betfair. Once I started I found visual studio easy to get on with, similar to the VBA IDE but better, a lot better. It was a little annoying at first with it’s auto correct and finish features (it adds end statements automatically but I keep typing them, giving two lines of the same thing) but I’m getting used to it. Can’t wait to get it running my own algorithms, the possibilities are endless…