
Finding arbitrage opportunities with Linear Programming (includes Python script) - Nezvanov
http://stochastix.wordpress.com/2010/12/20/fixed-odds-betting-arbitrage/
======
dansingerman
Finding arbitrages is the easy bit. (Ok it's not that easy)

The tricky bit is making sure you get both bets on before the arbitrage
opportunity disappears.

There are many bots already out there scooping up arbitrages, and the bookie
price algorithms will rapidly close these as bets are made, leaving a small
window of opportunity.

Also, most price movements (and therefore arbitrages) are when events are in-
running: in these cases bookies enforce a delay before your bet is processed,
which makes it doubly hard that both bets of your arbitrage get successfully
placed.

~~~
noname123
This.

Arbitrage is all about execution speed. Free-money by definition is scarce.
Assume you just sold the put and need to buy the call on the other side, some
one else may buy that cheap call and the next block of call's might be more
expensive and force you to eat a loss on your trading.

In options market, some brokers allows you to do a multi-leg execution
although the execution might be poor and oftentimes you might just get the
market price.

A safer way to play sports betting is do a rebate arbitrage which is to find
bookmakers with two different lines in really close games and ensure that you
just break even. Most bookmakers have a 10% bonus that you could cash out if
you bet more than 10 times (bonus for being a liquidity provider a la the
stock exchange), but it's more tedious and you have to deal with parking your
money in the Cayman Island's due to US ban on online sports betting.

~~~
bryanh
Isn't it possible to require the "scarcer" or most off-priced resource to be
the first resource to be acquired? Only then would you purchase the opposite,
more common resource.

Is that feasible? (Pardon my ignorance if not...)

------
dedward
That's the interesting theoretical bit.

The reality bit is where you have to ensure that you can get both bets checked
in with the bookie(s) involved at the price you wanted - and arbitrage
opportunities tend to show up more when the market is moving fast.

Further, just like the stock market, arbitrage acts to keep the market stable-
this is why most bookies have more or less the same odds on the same games at
the same price.

One also must factor in the transactional costs in moving money around
depending on who you are using for bookies, and also realize there are already
lots of guys out there running software 24/7 looking for arbitrage across the
entire bookmaker landscape globally - so such opportunities tend to not last
for long.

The more "fun" opportunity is the middle - when a line moves so much during
the time leading up to a game that a guy can make a bet with the same bookie
that he wins on no matter what, or at least can't lose on (at worst it's a
push - no loss). To find those you have to bet early on what are likely to be
fast moving lines, and then be quick enough to get your bets in (and have them
accepted)

------
ojbyrne
I know this is a blog post but it seems weird not to have any academic
references, which makes this look like it's new or novel research, which it
isn't. Perhaps its just me.

~~~
Nezvanov
If it were novel research, the author would have been an idiot to blog it
instead of publishing it in some peer-reviewed journal. No one claimed that it
was novel. I thought it was interesting, that's why I submitted it to HN.

~~~
ojbyrne
As I said, perhaps it was just me. But how hard is a footnote?

------
geuis
This is fascinating, but I have literally no idea what 99% of that math is.
Where would I begin studying to be able to understand what is being described
in those formulae?

~~~
RodCarvalho
The crux of the matter is the linear program. All that math using vec(),
diag(), and Hadamard / Kronecker products serves only to build the Q matrix.

If the numbers of bookies and outcomes are small, then you can build the Q
matrix by hand (like I did in the example at the end of the post). However, if
m and n are relatively large, then it's nice to have an algorithm that builds
the Q matrix automatically. Note that vec() and diag() in MATLAB are reshape()
and diag(). The Kronecker product in MATLAB is kron(). If one's acquainted
with the esoteric matrix operations being used, then it's very easy to convert
the math into code.

If you know basic matrix theory, and you learn the basics of linear
programming:

<http://en.wikipedia.org/wiki/Linear_programming>

then the following matrix cookbook should contain all the recipes (vec(),
diag(), Kronecker / Hadamard products) you need to follow my blog post:

[http://research.microsoft.com/en-
us/um/people/minka/papers/m...](http://research.microsoft.com/en-
us/um/people/minka/papers/matrix/)

Any questions, feel free to ask.

~~~
geuis
Thanks. Wow, I _still_ have next to no idea of what you're describing but I'll
happily take a look at the links. It sounds like I should start by learning
about basic matrix theory then?

~~~
RodCarvalho
The ideas are simple. Instead of having a double sum, we can have a matrix
product of the form 1_m^T X 1_n, which is nothing more than a compact way of
writing the sum of all the entries of matrix X. Note that vec(X) is a mn-
dimensional vector that contains the n stacked columns of X. Hence,

1_m^T X 1_n = 1_mn^T vec(X)

which is an inner product. Note that the equality 1_mn^T vec(X) = c defines a
hyper-plane, whereas the inequality 1_mn^T vec(X) <= c defines a half-space:

<http://en.wikipedia.org/wiki/Half-space>

The intersection of half-spaces defines a polytope, which is nothing more than
the higher dimensional equivalent of a polyhedron. Take a look at Boyd &
Vanderberghe's book on Convex Optimization for details:

<http://www.stanford.edu/~boyd/cvxbook/>

------
geebee
This is an aside... but does anyone know how well this python optimization
library (cvxopt) performs relative to CPLEX?

~~~
RodCarvalho
I don't know the answer to that. If somebody does, that person is probably
Erwin:

<http://yetanothermathprogrammingconsultant.blogspot.com/>

