Safemoon bsc token https://poocoin.app/tokens/0x8076c74c5e3f5852037f31ff0093eeb8c8add8d3
You need to multiply Median price of WBNB/BUSD and SAFEMOON/WBNB median price to get the end results. Check this query here multiple two median results ā¦
{
ethereum(network: bsc) {
dexTrades(
any: [{baseCurrency: {is: "0x8076c74c5e3f5852037f31ff0093eeb8c8add8d3"},
quoteCurrency: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}},
{baseCurrency: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"},
quoteCurrency: {is: "0xe9e7cea3dedca5984780bafc599bd69add087d56"}}]
date: {since: "2021-05-19T18:05:00.000Z"}
options: {desc: ["tradeIndex", "block.timestamp.time"], limitBy: {each: "baseCurrency.symbol", limit: 1}}
) {
timeInterval{
second(count: 1)
}
baseCurrency {
symbol
address
}
block {
timestamp {
time(format: "%Y-%m-%d %H:%M:%S")
}
height
}
tradeIndex
buyAmount: baseAmount
buyAmountInUsd: baseAmount
quoteCurrency {
symbol
address
}
sellAmountInUsd: quoteAmount
tradeAmount(in: USD)
volume: quoteAmount
trades: count
median: quotePrice (calculate: median)
high: quotePrice(calculate: maximum)
low: quotePrice(calculate: minimum)
open: minimum(of: block, get: quote_price)
close: maximum(of: block, get: quote_price)
}
}
}
Is there a way to use this to find a close BUSD value for transfers from a wallet for a particular token? @gaurav
The wallets Iām scanning were dedicated to a particular contract, so I was able to use ātransactionsā with āamountInUSDā to get the total BNB/WBNB it sent out after it sold the token via Dex.
Now, Iām hoping to get a close BUSD value for transfers out (not Dex transactions) for that particular token by roughly assuming the value at the time of the transfer.
Is this possible?
Yes. Just get the price of BUSD at that time.
If your token is not getting traded against BUSD and is only traded against WBNB, then get the WBNB price against BUSD and calculate your token price against BUSD.
Use a time filter to get the price for a specific time.
I really appreciate your help, @gaurav ā¦ Iām still learning, and Iām not quite sure how to do this. Could you please provide an example of the code? The token is not traded against BUSD.
Also, can the ātime filterā be set to automatically pull the price by using the time when it was transferred? Iām hoping to use a query that pulls in all the token total values (in BUSD) for the transfers made by a particular walletā¦ all at once so that they can be easily summed up.
Token: 0xa179248e50ce5afb507fd8c54e08a66fbac7b6ff
Wallet: 0x80d2388bc2a60694fc348fb30228a34857a24665
This is what Iām using to track the walletās BNB transfers after the wallet sells on PCS, but this doesnāt include the particular token transfers out to sell on exchanges, etc. Iām trying to calculate the USD value (or BUSD value) of token transfers at the time of each transfer so that I can sum.
Thank you for your patience and for helping me understand how to do this.
{
ethereum (network: bsc){
transactions(options: {limit: 1000, desc: "amountInUSD"}) {
amount
amountInUSD: amount(in: USD)
currency {
symbol
}
to {
address
}
date {
date
}
sender(txSender: {is: "0x80d2388bc2a60694fc348fb30228a34857a24665"}) {
address
}
}
}
}
Check this query to get USD price of token