This document is also available at
http://bitcoinats.com/help .
The objective was to build a market data API that leverages the consolidated order book of a user-specified subset of major exchanges and exposes key functionality through a JSON API. I would appreciate your feedback, suggestions for new API endpoints that leverage the full order book, etc. Performance was a key consideration as we wanted these algorithms to work against a real-time feed. Please feel free to contact me at
[email protected] with any questions. If there is sufficient interest, we will continue development.
NOTE: This prototype JSON API will only be public for a limited time. To sign up for the API key waitlist, go to
http://signup.bitcoinats.comSince most exchanges don't have real-time feeds, this prototype API pulls the full depth from MtGox, Bitstamp, btc-e, and CampBX every 20 minutes and analyzes the cached data. Obviously, a production version will need to maintain the full order books using streaming APIs. We already handle exchange-specific commissions, and reflect the effect of commissions in all data we return. Rounding of commission-adjusted amounts needs to be better handled in a production version, however. Orders are described as they would be sent to the exchanges, but the proceeds of transactions reflect the cost of commissions.
You can select a subset of these exchanges by passing "exchanges" to the API containing a subset of:
M = MtGox
B = Bitstamp
E = btc-e
C = CampBX
The calls are:
ARBITRAGE -- Find all arbitrage opportunities across selected exchanges (including cost of commissions), calculate the total profits, and generate a list of pair trades to execute the arbitrage strategy
http://bitcoinats.com/arbitrage?exchanges=MBECreturns an object:
"profits" is the excess (commission adjusted) USD generated by executing
"trades" is an array of pair-trades of the type:
[BUY, exchange, BTC price in USD, # of BTC, commission, BTC purchased]
OR
[SELL, exchange, BTC price in USD, # of BTC, commission, commission adjusted USD proceeds]
BUY -- commission-adjusted optimal buy order routing to multiple exchanges
http://bitcoinats.com/buy?amount=100000&exchanges=BEC"amount" is the USD to buy BTC with.
Returns:
"totalspent" in USD
"totalpurchased" is BTC purchased after commissions
"transactions" is sorted array of "BUY" orders with routing to purchase maximum BTC.
SELL -- commission-adjusted optimal sell order routing to multiple exchanges
http://bitcoinats.com/sell?amount=100&exchanges=BEC"amount" is the BTC to sell for USD.
Returns:
"totalsold" in BTC
"totalproceeds" is the USD proceeds after commissions.
"transactions" is a sorted array of "SELL" orders with routing that maximizes proceeds.
QUOTE -- get a commission-adjusted best bid and ask in the marketplace
http://bitcoinats.com/quote?exchanges=BECReturns the best commission-adjusted bid/ask across the selected exchanges. "bestbid" and "bestask" are arrays of the type:
[exchange, BTC price in USD, commission, commission adjusted BTC price in USD, size in BTC]
DEPTH -- returns the consolidated market depth of the selected exchanges, including the effect of commissions on orders
http://bitcoinats.com/depth?exchanges=BECReturns the consolidated order book of the selected exchanges. The return object contains "bids" and "asks". Each bid or ask is an array of arrays, sorted by best bid/ask, containing:
[exchange, BTC price in USD, commission, commission adjusted BTC price in USD, size in BTC]