Cryptorank

CryptoRank Cryptocurrency rates

CryptoRank provides crowdsourced and professionally curated research, analysis and market-moving news to help market participants make more informed trading decisions.
The function getRate(cryptoSymbol) takes cryptocurrency symbol as an argument and returns the USD price for this cryptocurrency according to the latest rate by CryptoRank.

Support

This function is Blockchain independent
Currently, it is possible to only retrieve the USD price for a cryptocurrency

Details

Parameters
cryptoSymbol: string; the cryptocurrency symbol to retrieve USD price for (i.e. "ETH")
Output
{value: int256,decimals: int256}; the USD price for requested cryptocurrency symbol returned as a decimal structure

Example

1
stream EthWalletTransfers
2
from Transfers
3
where @to in MyWallets || @from in MyWallets
4
process
5
let cryptorankProvider_fiatRateUSD = getRate("ETH")
6
let cryptorankProvider_fiatRateUSD_transferAmount = { value: @value * cryptorankProvider_fiatRateUSD.value, decimals: 18 + cryptorankProvider_fiatRateUSD.decimals }
7
emit { cryptorankProvider_fiatRateUSD, cryptorankProvider_fiatRateUSD_transferAmount }
8
end
9
​
Copied!
If at the moment of Smart-Trigger execution the rate for ETH/USD pair would be 404.67361234 and the value of ETH transfer would be 20 ETH (20000000000000000000 wei), then
cryptorankProvider_fiatRateUSD
1
{
2
value: 40467361234,
3
decimals: 8
4
}
Copied!
cryptorankProvider_fiatRateUSD_transferAmount
1
{
2
value: 809347224680000000000000000000,
3
decimals: 26
4
}
Copied!
Smart-Trigger resulting Event
1
{
2
cryptorankProvider_fiatRateUSD: {
3
value: 40467361234,
4
decimals: 8
5
},
6
cryptorankProvider_fiatRateUSD_transferAmount: {
7
value: 809347224680000000000000000000,
8
decimals: 26
9
}
10
}
Copied!
Last modified 10mo ago