How to access market price from Python?


I am struggling to get access to the kind of information I have on 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?


Posted 2017-11-05T13:02:50.787

Reputation: 237



Perhaps you can use the Python library CCXT:

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


Posted 2017-11-05T13:02:50.787

Reputation: 131


Here is the documentation: This URL gives you a response with their assets, btc is also there as {"symbol":"btc","name":"Bitcoin","fiat":false,"route":""}

We can see the "route" is Which should give us more information: {"exchange":"kraken","pair":"btcusd","active":true,"route":""}, 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: Returns 50 last trades.

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





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


Posted 2017-11-05T13:02:50.787

Reputation: 163