- 13 Dec 2017, 15:33
#1855
Excel Crypto / API / Json / Live quote…
You can find in this thread a spreadsheet that I have prepared to get cryptos live quotes from various Crypto’s exchanges.
I have prepared this spreadsheet thanks to tricks found here and there and I tried to put them together to make it easy for your guys to use them and develop your own spreadsheets (that you are free to share here).
Single crypto live quote
==========================================================
Basically, you can get the live quotes for individual cryptos, here a basic example:
I have included the live quotes for:
- Bittrex
- Bitfinex
- Binance
- CryptoCompare (thanks to cryptocompare you can get the quotes from a huge list of exchanges, but if I am correct, quotes are updated every 10 minutes). But it can be useful to have it available
For the technical part here are the links used to get the quotes:
- Bittrex:
https://bittrex.com/api/v1.1/public/getticker?market=
- Bitfinex:
https://api.bitfinex.com/v2/ticker/t
- Binance:
https://api.binance.com/api/v1/ticker/price?symbol=
- CryptoCompare:
https://min-api.cryptocompare.com/data/price?fsym=
To work correctly, you have to allow macros in Excel (the source code of those macros is visible and I tried to made it clear so as for you to adapt it).
For those individual pairs live quotes, I have coded the macro as a public function which can be used as a formula directly in Excel without having to modify the code. The formula looks like this:
=MyJSON( Base, Quote, Exchange, Volatile)
- Base is the base part of your instrument (for BTCUSD it would be BTC)
- Quote is the second part of your instrument (for BTCUSD it would be USD)
- Exchange is the exchange you want to use to get your quotes (for CryptoCompare you have to add the exchange used by cryptocompare)
- Volatile is just a reference to the cell A1. Explanation below.
In Excel, public functions are not volatile (not updated live or when a cell is modified) and if you set them as volatile, each time you modify a cell, the spreadsheet is recalculated which can be tricky in term of resources usage (CPU…). So, to make it easier to refresh the quotes, I have included a button which refresh the quotes when you click on it. Off course with further development you can program the macro to refresh the quotes every xx minutes…
So to get updates, just click the button and just let A1 as the volatile reference.
List and tickers of Cryptos from Exchanges
==========================================================
I have also included some macros to get the tickers from 3 exchanges:
- Bittrex
- Bitfinex
- Binance
I have associated the macro with some buttons, and so onclick the cryptos list are updated, here the example with Bittrex:
For the technical part here are the links used to get the quotes:
- Bittrex:
https://bittrex.com/api/v1.1/public/getmarketsummaries
- Bitfinex:
https://api.bitfinex.com/v1/symbols
https://api.bitfinex.com/v2/tickers?symbols=
- Binance:
https://api.binance.com/api/v1/ticker/allPrices
Json
==========================================================
The data are collected from the various Exchange’s API in a Json format which is not readable as it in Excel. So, we have to format the data with the macros to get something readable with Excel.
Some of those macros are formatting the “Json” directly, and some of them are using a library to do the job. The library used is the one which you can find at this link:
https://github.com/VBA-tools/VBA-JSON
The library needs to use a reference in Excel VBA which you can activate: Microsoft scripting runtime. (Tools > references > select)
Key reference for Json: JsonConverter.ParseJson, Parse Json,
You can use those examples to extend the quotes to other exchanges.
Feel free to share your developments here
You can find in this thread a spreadsheet that I have prepared to get cryptos live quotes from various Crypto’s exchanges.
I have prepared this spreadsheet thanks to tricks found here and there and I tried to put them together to make it easy for your guys to use them and develop your own spreadsheets (that you are free to share here).
Single crypto live quote
==========================================================
Basically, you can get the live quotes for individual cryptos, here a basic example:
I have included the live quotes for:
- Bittrex
- Bitfinex
- Binance
- CryptoCompare (thanks to cryptocompare you can get the quotes from a huge list of exchanges, but if I am correct, quotes are updated every 10 minutes). But it can be useful to have it available
For the technical part here are the links used to get the quotes:
- Bittrex:
https://bittrex.com/api/v1.1/public/getticker?market=
- Bitfinex:
https://api.bitfinex.com/v2/ticker/t
- Binance:
https://api.binance.com/api/v1/ticker/price?symbol=
- CryptoCompare:
https://min-api.cryptocompare.com/data/price?fsym=
To work correctly, you have to allow macros in Excel (the source code of those macros is visible and I tried to made it clear so as for you to adapt it).
For those individual pairs live quotes, I have coded the macro as a public function which can be used as a formula directly in Excel without having to modify the code. The formula looks like this:
=MyJSON( Base, Quote, Exchange, Volatile)
- Base is the base part of your instrument (for BTCUSD it would be BTC)
- Quote is the second part of your instrument (for BTCUSD it would be USD)
- Exchange is the exchange you want to use to get your quotes (for CryptoCompare you have to add the exchange used by cryptocompare)
- Volatile is just a reference to the cell A1. Explanation below.
In Excel, public functions are not volatile (not updated live or when a cell is modified) and if you set them as volatile, each time you modify a cell, the spreadsheet is recalculated which can be tricky in term of resources usage (CPU…). So, to make it easier to refresh the quotes, I have included a button which refresh the quotes when you click on it. Off course with further development you can program the macro to refresh the quotes every xx minutes…
So to get updates, just click the button and just let A1 as the volatile reference.
List and tickers of Cryptos from Exchanges
==========================================================
I have also included some macros to get the tickers from 3 exchanges:
- Bittrex
- Bitfinex
- Binance
I have associated the macro with some buttons, and so onclick the cryptos list are updated, here the example with Bittrex:
For the technical part here are the links used to get the quotes:
- Bittrex:
https://bittrex.com/api/v1.1/public/getmarketsummaries
- Bitfinex:
https://api.bitfinex.com/v1/symbols
https://api.bitfinex.com/v2/tickers?symbols=
- Binance:
https://api.binance.com/api/v1/ticker/allPrices
Json
==========================================================
The data are collected from the various Exchange’s API in a Json format which is not readable as it in Excel. So, we have to format the data with the macros to get something readable with Excel.
Some of those macros are formatting the “Json” directly, and some of them are using a library to do the job. The library used is the one which you can find at this link:
https://github.com/VBA-tools/VBA-JSON
The library needs to use a reference in Excel VBA which you can activate: Microsoft scripting runtime. (Tools > references > select)
Key reference for Json: JsonConverter.ParseJson, Parse Json,
You can use those examples to extend the quotes to other exchanges.
Feel free to share your developments here
You do not have the required permissions to view the files attached to this post.
Cheers,
G
G