Hello,
in this thread I would like to discuss spot/futures arbitrage basic ideas, provide reference implementations and listen to your suggestions.
Classical ArbitrageWikipedia explanation:
http://en.wikipedia.org/wiki/Spot-future_parityBasically, arbitraging means that
you get the profit no matter which way the price moves. Futures arbitrage is a way of taking advantage from price difference of the underlying asset and the price of its futures contract.
Every futures contract gets mispriced from time to time and arbitragers can profit from that.
For example, right now average rate of BTC/USD futures at ICBIT is $14.66 and spot price at MtGox is $13.30, hence the difference being $1.30 !
How to actually get profit from that? Two ways exist:
1. "Long the basis":
a. Buy BTC on MtGox for USD (which you own) and sell futures contracts on ICBIT.
b. Close positions (buy futures contracts on ICBIT and sell BTC on MtGox) when the futures spread (spot/futures price difference) changed enough for you to get profit.
or
c. Wait till futures contract is settled and sell BTC on MtGox
2. "Short the basis":
a. Sell BTC (which you own) on MtGox for USD and buy futures contracts on ICBIT
b. Close positions (sell futures contracts on ICBIT and buy BTC on MtGox back) when the futures spread (spot/futures price difference) changed enough for you to get profit.
or
c. Wait till futures contract is settled and buy BTC on MtGox
Both ways will get you profit.
As it's already noted, it's not necessary to wait till futures settlement. Many (the vast majority of traders on fiat-money exchanges for example) trade futures spread instead: open arbitrage positions when the spread is high, close arbitrage positions when the spread is low.
Arbitraging with bitcoins is not harder than arbitraging on fiat-money exchanges, even simpler, but you need to understand a few important points:
1. BTCUSD futures contracts price is in USD, however profit/loss is accounted in BTC. Every contract is for $10. This makes it a bit harder to understand, but it makes it very easy to arbitrage (you have the same price scale: US dollars per 1 bitcoin). Contract explained here:
https://icbit.se/BUH32. To buy/sell contracts on ICBIT you only need bitcoins. Marginal trading is available at no additional cost.
3. To buy/sell BTC on MtGox, you need to either have US dollars, or to have BTC which you want to sell in exchange for US dollars.
4. If you want to get your profit in US dollars, you may need to convert it to US dollars on some exchange (might be using ICBIT's exchange section, but it lacks volume now).
Example:
John opens his arbitrage position by buying 100 BTC on MtGox spending $1330, and selling 133 futures contracts on ICBIT for $14.66 (requiring a maintenance deposit of 14 BTC on his account there).
Some hours later the prices converge a bit, with MtGox being at $13.8, and ICBIT being $14.0.
So John buys back 133 futures contracts for $14.00 providing him positive variation margin on ICBIT equal to Profit = ((1 / 14.0 - 1 / 14.66) * -10) * -133 = 4.277 BTC (converted to US dollars that's $59)
and sells his position on MtGox which gives him $1380, plus $59 on ICBIT's account in BTC, thus totalling in $109 profit.
Another example:
John opens his arbitrage position by buying 100 BTC on MtGox spending $1330, and selling 133 futures contracts on ICBIT for $14.66 (requiring a maintenance deposit of 14 BTC on his account there).
Some days later the contract is settled on the sport price at MtGox being $13.0.
So John gets his 133 futures contracts settled on $13.00 providing him positive variation margin on ICBIT equal to Profit = ((1 / 13.0 - 1 / 14.66) * -10) * -133 = 11.585 BTC (converted to US dollars that's $150)
and sells his position on MtGox which gives him $1300 (a loss of $30 bucks) and $150 on ICBIT's account in BTC, thus totalling in $120 profit.
The basic idea is, wherever market moves, your profit is guaranteed.
Capt. Obvious suggests that automated arbitrage would be the best
I will edit this post to add information about actual automated trading bots and API discussion, but before I do that, please let me know if you have any questions about the above.