Cryptowatch API¶
api_client module¶
Module related to the client interface to cryptowat.ch API.
- class ¶
Bases:
The public client to the cryptowat.ch api.
- = 'https://api.cryptowat.ch'¶
- = ['prices', 'summaries']¶
- = ['price', 'summary', 'orderbook', 'trades', 'ohlc']¶
- = ['trades', 'ohlc']¶
- (*args)¶
Retrieves the prices and summaries of all markets on the site in a single request.
Prices
To get the current price for all supported markets use:
get_aggregates('prices'){"result":{{"bitfinex:bfxbtc":0.00067133,"bitfinex:bfxusd":0.52929,"bitfinex:btcusd":776.73,...}}}Summaries
To get the market summary for all supported markets use:
get_aggregates('summaries'){"result":{{"bitfinex:bfxbtc":{"price":{"last":0.00067133,"high":0.0006886,"low":0.00066753,"change":{"percentage":-0.02351996,"absolute":-1.6169972e-05}},"volume":84041.625},"bitfinex:bfxusd":{...},"bitfinex:btcusd":{...},...}}}
- (asset=None)¶
An asset can be a crypto or fiat currency.
Index
{"result":[{"symbol":"aud","name":"Australian Dollar","fiat":true,"route":"https://api.cryptowat.ch/assets/aud"},{"symbol":"etc","name":"Ethereum Classic","fiat":false,"route":"https://api.cryptowat.ch/assets/etc"},...]}Asset
Returns a single asset. Lists all markets which have this asset as a base or quote.
get_assets('btc'){"result":{"symbol":"btc","name":"Bitcoin","fiat":false,"markets":{"base":[{"exchange":"bitfinex","pair":"btcusd","active":true,"route":"https://api.cryptowat.ch/markets/bitfinex/btcusd"},{"exchange":"gdax","pair":"btcusd","route":"https://api.cryptowat.ch/markets/gdax/btcusd"},...],"quote":[{"exchange":"bitfinex","pair":"ltcbtc","active":true,"route":"https://api.cryptowat.ch/markets/bitfinex/ltcbtc"},{"exchange":"bitfinex","pair":"ethbtc","active":true,"route":"https://api.cryptowat.ch/markets/bitfinex/ethbtc"},...]}}}
- (exchange=None)¶
Exchanges are where all the action happens!
Index
Returns a list of all supported exchanges.
{"result":[{"symbol":"bitfinex","name":"Bitfinex","active":true,"route":"https://api.cryptowat.ch/exchanges/bitfinex"},{"symbol":"gdax","name":"GDAX","active":true,"route":"https://api.cryptowat.ch/exchanges/gdax"},...]}Exchange
Returns a single exchange, with associated routes.
get_exchanges('kraken'){"result":{"id":"kraken","name":"Kraken","active":true,"routes":{"markets":"https://api.cryptowat.ch/markets/kraken"}}}
- (path=None, **kwargs)¶
A market is a pair listed on an exchange. For example, pair btceur on exchange kraken is a market.
Index
Returns a list of all supported markets.
{"result":[{"exchange":"bitfinex","pair":"btcusd","active":true,"route":"https://api.cryptowat.ch/markets/bitfinex/btcusd"},{"exchange":"bitfinex","pair":"ltcusd""active":true,"route":"https://api.cryptowat.ch/markets/bitfinex/ltcusd"},{"exchange":"bitfinex","pair":"ltcbtc""active":true,"route":"https://api.cryptowat.ch/markets/bitfinex/ltcbtc"},...]}To get the supported markets for only a specific exchange:
get_markets('kraken')Market
Returns a single market, with associated routes.
Parameters: - exchange (str) – required
- pair (str) – required
data={'exchange':'gdax','pair':'btcusd'}{"result":{"exchange":"gdax","pair":"btcusd","active":true,"routes":{"price":"https://api.cryptowat.ch/markets/gdax/btcusd/price","summary":"https://api.cryptowat.ch/markets/gdax/btcusd/summary","orderbook":"https://api.cryptowat.ch/markets/gdax/btcusd/orderbook","trades":"https://api.cryptowat.ch/markets/gdax/btcusd/trades","ohlc":"https://api.cryptowat.ch/markets/gdax/btcusd/ohlc"}}}Price
Returns a market’s last price.
Parameters: - exchange (str) – required
- pair (str) – required
- route (str) – ‘price’
data={'exchange':'gdax','pair':'btcusd','route':'price'}{"result":{"price":780.63}}Summary
Returns a market’s last price as well as other stats based on a 24-hour sliding window.
Parameters: - exchange (str) – required
- pair (str) – required
- route (str) – ‘summary’
data={'exchange':'gdax','pair':'btcusd','route':'summary'}{"result":{"price":{"last":780.31,"high":790.34,"low":772.76,"change":{"percentage":0.0014373838,"absolute":1.12}},"volume":5345.0415}}Trades
Returns a market’s most recent trades, incrementing chronologically.
Parameters: - exchange (str) – required
- pair (str) – required
- route (str) – ‘trades’
- params (dict) – supported params
- params.limit (int (defaults to 50)) – limit amount of trades returned
- params.since (UNIX timestamp) – only return trades at or after this time.
data={'exchange':'gdax','pair':'btcusd','route':'trades','params':{'limit':10,'since':1481663244}}{"result":[[0,1481676478,734.39,0.1249],[0,1481676537,734.394,0.0744],[0,1481676581,734.396,0.1],[0,1481676602,733.45,0.061],...]}Trades are lists of numbers in this order:
[ID,Timestamp,Price,Amount]Order Book
To get market’s order book use ‘orderbook’ route.
Parameters: - exchange (str) – required
- pair (str) – required
- route (str) – ‘orderbook’
data={'exchange':'gdax','pair':'btcusd','route':'orderbook'}{"result":{"asks":[[733.73,2.251],[733.731,7.829],[733.899,1.417],...],"bids":[[733.62,0.273],...]]}Orders are lists of numbers in this order:
OHLC
Returns a market’s OHLC candlestick data. Returns data as lists of lists of numbers for each time period integer.
Parameters: - exchange (str) – required
- pair (str) – required
- route (str) – ‘ohlc’
- params (dict) – supported params
- params.before (int (defaults to 50)) – Only return candles opening before this time
- params.after (UNIX timestamp) – Only return candles opening after this time
- params.periods (Comma-separated integers 60,180,108000) – return these time periods
data={'exchange':'gdax','pair':'btcusd','route':'ohlc''params':{'before':1481663244,'after':1481663244,'periods':'60,180'}}Return values are in list:
[CloseTime,OpenPrice,HighPrice,LowPrice,ClosePrice,Volume,QuoteVolume]
- (pair=None)¶
A pair of assets. Each pair has a base and a quote. For example, btceur has base btc and quote eur.
Index
All pairs (in no particular order).
{"result":[{"symbol":"xmrusd","id":82,"base":{"symbol":"xmr","name":"Monero","fiat":false,"route":"https://api.cryptowat.ch/assets/xmr"},"quote":{"symbol":"usd","name":"United States dollar","fiat":true,"route":"https://api.cryptowat.ch/assets/usd"},"route":"https://api.cryptowat.ch/pairs/xmrusd"},{"symbol":"ltcusd","id":189,"base":{"symbol":"ltc","name":"Litecoin","fiat":false,"route":"https://api.cryptowat.ch/assets/ltc"},"quote":{"symbol":"usd","name":"United States dollar","fiat":true,"route":"https://api.cryptowat.ch/assets/usd"},"route":"https://api.cryptowat.ch/pairs/ltcusd"},...]}Pair
Returns a single pair. Lists all markets for this pair.
get_pairs('ethbtc'){"result":{"symbol":"ethbtc","id":23,"base":{"symbol":"eth","name":"Ethereum","isFiat":false,"route":"https://api.cryptowat.ch/assets/eth"},"quote":{"symbol":"btc","name":"Bitcoin","isFiat":false,"route":"https://api.cryptowat.ch/assets/btc"},"route":"https://api.cryptowat.ch/pairs/ethbtc","markets":[{"exchange":"bitfinex","pair":"ethbtc","active":true,"route":"https://api.cryptowat.ch/markets/bitfinex/ethbtc"},{"exchange":"gdax","pair":"ethbtc","active":true,"route":"https://api.cryptowat.ch/markets/gdax/ethbtc"},...]}}
© Copyright 2017, uoshvis Revision .
0 thoughts to “Cryptowatch bitfinex btc”