Currently I always have to use 1 api-call to output the BNB / USD price of a block or txhash.
Is there a way to calculate the BNB and USD price of a transaction? Without having to use 1 call every time?
Thanks in advance!
Currently I always have to use 1 api-call to output the BNB / USD price of a block or txhash.
Is there a way to calculate the BNB and USD price of a transaction? Without having to use 1 call every time?
Thanks in advance!
Let’s say someone received 2833912330852774633 Sabaka INU.
These are 0.013532793120368276 WBNB value.
To get from here by multiplying the current USD-WBNB to the USD value of 4.79 $ is not difficult.
But how is the calculation from 2833912330852774633 SABAKA to 0.013532793120368276 WBNB?
You can use Aliasing
For example, check here
And also here
I don’t think that’s what I’m looking for.
It should be possible to calculate the value in WBNB from the Sabaka tokens bought.
Perhaps from a balance calculation?
Maybe there is another idea or solution
Just get the latest trade of SABAKA token using our APIs. Give me SABAKA token address, I will show you.
That would be great, because with every entry and exit, the value of the token changes.
This is the token address: 0xc30f12cd65f61ded24db6c415c84f999c9704ebc
All the latest Swaps
{
ethereum(network: bsc) {
dexTrades(options: {limit: 1, desc: ["block.height", "tradeIndex"]},
date: {since: "2021-06-05"}
buyCurrency: {is: "0xc30f12cd65f61ded24db6c415c84f999c9704ebc"}
sellCurrency: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}
exchangeName: {in: ["Pancake", "Pancake v2"]}) {
transaction {
hash
}
smartContract{
address{
address
}
contractType
currency{
name
}
}
tradeIndex
date {
date
}
block {
height
}
buyAmount
buyAmountInUsd: buyAmount(in: USD)
buyCurrency {
symbol
address
}
sellAmount
sellAmountInUsd: sellAmount(in: USD)
sellCurrency {
symbol
address
}
sellAmountInUsd: sellAmount(in: USD)
tradeAmount(in: USD)
transaction{
gasValue
gasPrice
gas
}
}
}
}
Another way
{
ethereum(network: bsc) {
dexTrades(
options: {desc: ["block.height", "tradeIndex"], limit: 1, offset: 0}
date: {since: "2021-06-05"}
baseCurrency: {is: "0xc30f12cd65f61ded24db6c415c84f999c9704ebc"}
) {
block {
timestamp {
time(format: "%Y-%m-%d %H:%M:%S")
}
height
}
tradeIndex
exchange {
fullName
}
smartContract {
address {
address
annotation
}
}
baseAmount
baseCurrency {
address
symbol
}
quoteAmount
quoteCurrency {
address
symbol
}
transaction {
hash
}
}
}
}
Thank you very much!