Description Usage Arguments Author(s) Examples
Betfair updateBets
1 | updateBets(bets = list(), service = Exchange)
|
bets |
bets |
service |
service |
colin@betwise.co.uk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function(bets=list(), service=Exchange)
{
# Single bet convenience call:
if(!is.list(bets[[1]])) {
bets = list(UpdateBets=bets)
}
# Argument not named as required
if(length(names(bets)) < length(bets)) {
names(bets) <- rep("UpdateBets",length(bets))
}
v <- .bfapi(call("updateBets", bets=bets), service=service, debug=TRUE)
return(v)
z <- .xmlp("errorCode", v)
if(is.null(z)) return(v)
if(z != "OK") return(z)
x <- .xmlp("betResults", v)
a1 <- unlist(strsplit(x,"><"))
a2 <- a1[grep(".*>.*<.*",a1)]
l <- unique(sub("[ >].*","",a2)) # labels
l <- sub("<","",l)
v <- sub(".*>(.*)<.*","\1",a2) # values
m <- matrix(v, ncol=length(l), byrow=T)
colnames(m) <- l
x <- as.data.frame(m, stringsAsFactors=FALSE)
# XXX column type conversion
x
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.