Order Book
get
https://api.cryptowat.ch
/markets/:exchange/:pair/orderbook
Order Book
Each response includes a
seqNum
which is intended for use with the WebSocket API; you can use this to resynchronize your order book and replay deltas received over the live feed which have a higher seqNum
.Fetching the entire order book:
curl
python
curl "https://api.cryptowat.ch/markets/kraken/btcusd/orderbook"
import requests
def main():
resp = requests.get("https://api.cryptowat.ch/markets/kraken/btcusd/orderbook")
orderbook = resp.json()['result']
print orderbook
if __name__ == '__main__':
main()
Fetching only the spread (best bid and best ask):
curl "https://api.cryptowat.ch/markets/binance/btcusdt/orderbook?limit=1"
Fetching only the orders within 0.5% of the top of the book:
curl "https://api.cryptowat.ch/markets/binance/btcusdt/orderbook?span=0.5"
Fetching only enough orders to add up to 100 BTC on each side:
curl "https://api.cryptowat.ch/markets/binance/btcusdt/orderbook?depth=100"
get
https://api.cryptowat.ch
/markets/:exchange/:pair/orderbook/liquidity
Order Book Liquidity
get
https://api.cryptowat.ch
/markets/:exchange/:pair/orderbook/calculator
Order Book Calculator
Example usage:
# Project cost to buy 50 BTC
curl --silent -G \
https://api.cryptowat.ch/markets/binance/btcusdt/orderbook/calculator \
-d 'amount=50' | jq ".result.buy.spend"
# Project average price received for selling 12.5 BTC
curl --silent -G \
https://api.cryptowat.ch/markets/binance/btcusdt/orderbook/calculator \
-d 'amount=12.5' | jq ".result.sell.avgPrice"
# Project average slippage, in basis points, for buying 150 BTC
curl --silent -G \
https://api.cryptowat.ch/markets/binance/btcusdt/orderbook/calculator \
-d 'amount=150' | jq ".result.buy.avgDeltaBps"
Last modified 2yr ago