Need to return empty rows

I’m writing some code that pulling historic data for Ethereum/BSC tokens and it would be much simpler if I was getting info returned even if there were no trades. Just basically a normal pin but with all the values at zero. I feel like this is possible but I don’t know which option to change.

Please show me your query

{
ethereum(network: bsc) {
dexTrades(
options: {limit: 100000, asc: “timeInterval.second”}
date: {between: [“2022-03-31T00:00:00”,“2022-04-01T00:00:00”]}
exchangeName: {in: [“Pancake”, “Pancake v2”]}
baseCurrency: {is: “0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c”}
quoteCurrency: {is: “0x9f7d235b7d3f4403133a559b0968361687e4fc62”}
) {
timeInterval {
second(count: 900)
}
baseCurrency {
symbol
address
}
baseAmount
quoteCurrency {
symbol
address
}
quoteAmount
trades: count
quotePrice
maximum_price: quotePrice(calculate: maximum)
minimum_price: quotePrice(calculate: minimum)
open_price: minimum(of: block, get: quote_price)
close_price: maximum(of: block, get: quote_price)
tradeAmount(in: USD)
}
}
}

Thanks.

What you are actually asking for is not possible while making the API call as the API call returns what is there in the database. In order to set the attribute’s value to 0, you need to make changes to your original code (especially, the part from where you initialized the GraphQL query while making the API call).

If you are comfortable then I can help you with the same. But for that you might need to share a part of your code.

Thanks for the offer. My actual code for making the call is just the Python code from one of the BitQuery tutorials, then Python iterates through it in a “for” loop. I was messing with it over the weekend and I’ve got it to pad out the gaps using a bit of extra code but it’s a bit clumsy. Is that what you would have done as well?

It would be a lot easier if BQ could return empty rows, even if there’s nothing in that time interval. It’d just be a simple “for” loop. No problem if that’s not possible, just a “nice to have”.

Thanks.

1 Like

If there are no data we return empty array, and I think it’s correct behaviour