I've written a lot about generalities. About what works, and how it works. Or more likely, what doesn't work and why it doesn't work.
Now it's time to be a little more practical. There is no more useful thing for a Betfair professional than a dashboard. I find it somewhat bizarre that Betfair doesn't provide one themselves - but nevermind, let's build one. Let's start off really simple: let's allow you to enter a list of MarketIDs, and then the dashboard shows your markets and your NAVs for each one. We'll make it a little bit cleverer and allow you to click on each one to go to direct to the Betfair page.
In other words, we'll build something that looks exactly like this:
You can download this here. But the principle is pretty simple, and the whole sheet is driven by a slghtly improved version of the simple NAV generator discussed here. Let me run you through it:
# Define worksheet names
NAV = workbook['NAV']
This is pretty simple. The worksheet (as you can tell by the tab under it) we want to deal with is called NAV. Normally, to access it, we'd refer to workbook['NAV'], but as that's long-winded, let's create a shortcut.
import betfair
betfairGateway = betfair.BetfairGateway(username.Value, password.Value, productId=productID.Value)
Now, let's import the Betfair libraries, and then create a gateway object. The gateway object is how we interact with Betfair. It initiates the connection, and we can then query it for details on specific markets and bets.
for row in NAV.ContentRows:
Now, one of the great joys about Python (and indeed, Resolver) is the whole iterating process. Here we are asking to iterate over each of the content rows (i.e., the rows excluding the header row at the top). In each iteration, the code will have a row object to play with. You can access the contents of each row by name: so row['marketID'] would contain '100329014' for the first row, etc.
output = RunWorkbook("automated NAV generator.rsl", gatewayObject = betfairGateway, marketID = row['marketID'])
This is where it gets really clever. RunWorkbook allows us to run another workbook, passing it certain parameters. In this case, we're opening up the NAV generator we produced a few posts ago, and we're passing two arguments: firstly we're passing the Betfair Gateway object, so that the workbook doesn't have to generate its own. This is to save on resources (ours and Betfairs!) and to reduce the time needed to run the sheet. Secondly, we're passing the marketID from the row.
To put it another way, we're going through each market listed in the marketID column, and executing the NAV calculating sheet. The completed sheet is stored in the output object, and we could query anything we liked about this sheet. (We could find out the value of Sheet3!A1 by using output['Sheet3'].A1. Cool, huh?)
row['marketName'] = output.marketname
row['NAV'] = output.theNAV
And, indeed, we not pull out two bits of data from the sheet: the matketName that corresponds to the marketID, and the NAV the sheet has calculated. We then put that data into the row object. (Again, we're referencing by name - row['NAV'] means the NAV cell in that particular row.
href = "http://sports.betfair.com/Index.do?mi=%i&ex=1&origin=MRL" % (row['marketID'])
NAV.Cells['marketName', row['marketID']].Href = href
One last cool thing to do: let's create a hyperlink from the name of the market to the Betfair page that holds it.
This whole sheet does one thing reasonably well - it shows the NAVs for all the different marketIDs you feed it. It is not complex, and has no ability to act yet - but it is a useful aide memoir for your betting even at this relatively early stage.
We will enhance this sheet in the coming days and months - adding additional risk metrics, and buttons that allow the system to autimatically bet for you. We'll also get it working *in* a browser, so you won't need to fire up Resolver One, and we'll let it auto-generate the list of marketIDs dependent on what markets you are currently involved in.
'til next time...
Poipet Casino, the starting point of online casinos.
ReplyDeleteคาสิโนออนไลน์ It is a casino website. The top clubs of Cambodia A fun gambler that allows gamblers from all over the world to play casino games online simultaneously with just one internet connection and one mobile phone. Online gaming on the computer screen is one of the most innovative ways to make gambling and casino gaming fun by playing online gambling games. It is considered as the latest service. It allows players to play online gambling in each form can play easily. Even if the gambler can play online casino games online along the way. Today's online gambling games can generate real money for players by joining the fun. You can also play all day, night or all time that the player wants to be. So if players think to play online gambling games, do not forget to join the fun and play online gambling. With us at the website บาคาร่าออนไลน์
You can write an article very much. Thank you for making a great article to read.
ReplyDeleteAFC168
bandar slot online
ReplyDeletejudi slot online terbaik
slot online gacor
situs slot online
slot terpercaya
situs judi slot
ReplyDeletesitus judi slot online
situs judi slot online resmi
situs judi slot terpercaya
situs online