How to access market price from Python?

4

I am struggling to get access to the kind of information I have on cryptowat.ch. For example on Kraken there is an API, but I didn't find how to get the past history, the volume information, etc.

Is there any straightforward solution for this?

nowox

Posted 2017-11-05T13:02:50.787

Reputation: 237

Answers

3

Perhaps you can use the Python library CCXT:

https://github.com/kroitor/ccxt

It offers an homogeneous interface for accessing market data at different exchanges like Kraken, Coinbase, Bitstamp, etc...

lackadaisical

Posted 2017-11-05T13:02:50.787

Reputation: 131

1

Here is the documentation: https://cryptowat.ch/docs/api

https://api.cryptowat.ch/assets This URL gives you a response with their assets, btc is also there as {"symbol":"btc","name":"Bitcoin","fiat":false,"route":"https://api.cryptowat.ch/assets/btc"}

We can see the "route" is https://api.cryptowat.ch/assets/btc Which should give us more information: {"exchange":"kraken","pair":"btcusd","active":true,"route":"https://api.cryptowat.ch/markets/kraken/btcusd"},

https://api.cryptowat.ch/markets/kraken/btcusd contains information on how to get btc/usd prices etc

.../markets/kraken/btcusd/price Gives following result: {"result":{"price":7208.6},"allowance":{"cost":864413,"remaining":7999135587}}

Which is the price in usd for btc on kraken.

In the last URL "kraken" is an asset and "btcusd" is a pair. These can be replaced with different assets(exchanges) and pairs(two currencies).

In order to get past history you can simply use: https://api.cryptowat.ch/markets/kraken/btcusd/trades Returns 50 last trades.

You can also pass arguments or "params" in the following way

.../markets/kraken/btcusd/trades?limit=100

.../markets/kraken/btcusd/trades?since=1481663244

Comined:

.../markets/kraken/btcusd/trades?limit=100&since=1481663244

This way you can get past history and all other info.

2313112441312

Posted 2017-11-05T13:02:50.787

Reputation: 163