I'm using Symbol Price Ticker method (/api/v3/ticker/price
) to have all the prices for a symbol.
When I used this method to have the prices of pools with USDC I have this answer :
[['USDCBNB', 0.21755], ['BNBUSDC', 295.7], ['BTCUSDC', 21416.42], ['ETHUSDC', 1624.66], ['XRPUSDC', 0.3447], ['EOSUSDC', 1.455], ['XLMUSDC', 0.0497], ['USDCUSDT', 1.0001], ['USDCTUSD', 1.0], ['USDCPAX', 1.0002], ['LINKUSDC', 7.095], ['WAVESUSDC', 1.2036], ['BCHABCUSDC', 220.3], ['BCHSVUSDC', 57.5], ['LTCUSDC', 55.19], ['TRXUSDC', 0.06559], ['USDSUSDC', 1.0], ['BTTUSDC', 0.002776], ['ZECUSDC', 65.0], ['ADAUSDC', 0.4647], ['NEOUSDC', 28.27], ['ATOMUSDC', 10.579], ['ETCUSDC', 4.71], ['BATUSDC', 0.6313], ['PHBUSDC', 0.00587], ['TFUELUSDC', 0.003565], ['ONEUSDC', 0.0052], ['FTMUSDC', 0.01107], ['BCPTUSDC', 0.02728], ['ALGOUSDC', 0.238], ['GTOUSDC', 0.01196], ['ERDUSDC', 0.0013573], ['DOGEUSDC', 0.0021277], ['DUSKUSDC', 0.0179], ['BGBPUSDC', 1.39], ['ANKRUSDC', 0.002097], ['ONTUSDC', 0.5708], ['WINUSDC', 0.0001283], ['NPXSUSDC', 0.0001702], ['TOMOUSDC', 0.367], ['PERLUSDC', 0.02447], ['BCHUSDC', 119.1], ['USDCBUSD', 1.0], ['SOLUSDC', 36.14], ['AUDUSDC', 0.6866]]
So, for example I have this ['BTCUSDC', 21416.42]
['SOLUSDC', 36.14]
, so I have the price of 1 BTC and 1 SOL in USDC, but how can I have the price for 1 USDC in BTC or SOL ?
Thanks for your help !
CodePudding user response:
1 divided by price of crypto coin
Ex.
1 / 21,416.42 = 0,00004669
(you probably want more decimals tho)