-1

I would like to obtain the HNT/Helium price via the API. Getting the rates through https://api.coinbase.com/v2/exchange-rates?currency=HNT seems to work like with any other currency, but the rates are completely off.

I noticed that on the website, there actually are two tokens called HNT: Helium and Hento (with Helium definitely being the main one, I had not heard of the other one). However, the rates provided by the API don't correspond to either.

The current results:

API result
0.02013283 = $49.67

HNT - Helium (https://www.coinbase.com/price/helium)
$38.92

HNT - Hinto (https://www.coinbase.com/price/hinto)
$0.0669
Toine Lille
  • 55
  • 1
  • 7

2 Answers2

0

That's pretty awesome. Searching for HINTO on CB comes back with no results but you can get to it directly with the link you provided. Searching for HNT only returns Helium. Yet the API returns the un-searchable results for Hinto when using HNT...

But to answer your question, in case you haven't discovered the solution yet, you can simply change the currency to HELIUM

https://api.coinbase.com/v2/exchange-rates?currency=HELIUM

repsonse:

{"data":{"currency":"HELIUM","rates": [...] {"USD":"30.096511279999998"} [...] }}
genericHCU
  • 4,394
  • 2
  • 22
  • 34
  • The API results for HNT don't seem to belong to Hinto either. It's off by about $49 for that to be it. I really can't figure out what they use for HNT. I only discovered Hinto when typing 'HNT CoinBase' into Google. It indeed doesn't show up in Coinbase's own search. I do use HELIUM in full now as suggested, but it means that all and only for HNT I'm using an exception, using the full name instead of its code. I'm fairly certain that whoever uses HNT actually thinks they are obtaining Helium values, which would cause numerous issues. – Toine Lille Dec 09 '21 at 14:10
  • @ToineLille hinto price seemed about right for me when I did HNT. either way you can use the full name for the currency not just the symbol. – genericHCU Dec 09 '21 at 14:13
0

From a cell, you could call this function:

"colon separated parameters"

=INDEX( SPLIT( INDEX ( SPLIT( IMPORTDATA("https://api.coinbase.com/v2/exchange-rates?currency=HELIUM", "|", ","), ":"), 0, 48), ","), 0, 1)

"semi colon separated parameters"

=INDEX( SPLIT( INDEX ( SPLIT( IMPORTDATA("https://api.coinbase.com/v2/exchange-rates?currency=HELIUM"; "|"; ","); ":"); 0; 48); ","); 0; 1)

This will get you quoted value: "22.87244131153848"

IMPORTDATA will get the JSon, I use the "|" separator so it comes alltogether

{"data":{"currency":"HELIUM","rates":{"AED":"92.539849932...

SPLIT will separate values on every ":"

col 1. {"data"

col 2. {"currency"

col n. ...

INDEX will get the column where the price of Helium is (the FJD is the next element)

"22.87244131153848","FJD"

SPLIT will separate again the value on the ","

col 1: "22.87244131153848"

col 2: "FJD"

INDEX will finally get the resultant value

"22.87244131153848"

Dharman
  • 30,962
  • 25
  • 85
  • 135
Taochok
  • 359
  • 4
  • 7