Getting historic prices, works one day and not the next

I’m trying to get historic price data. Here’s an example query I’m using:

ethereum(network: bsc) {

        options: {desc: ["block.height", "tradeIndex"], limit: 1}
        exchangeName: {in: ["Pancake", "Pancake v2"]}
        baseCurrency: {is: "0x2dbe5158eb61bb4bc1084740e14e868c902e462b"}
        quoteCurrency: {is: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"}
        date: {before: "2021-10-14T23:50:01"}
        ) {
        smartContract {
            address {
            currency {
        date {
        buyCurrency {
        sellCurrency {
        tradeAmount(in: USD)
        block {
        block {
            height, timestamp {time(format: "%Y-%m-%d %H:%M:%S")}

I’m just trying to get the price of the last transaction so I’m using trying to essentially get the latest prices, starting from the current time, and limiting it to one result. Without the date this query works just fine for getting the latest info. I want the same result but for whatever time I specify (so the price of whatever was the last transaction before the given date).

The problem I’m having is that this date (“2021-10-14T23:50:01”) returns nothing, but if I add one hour to the date (“2021-10-15T00:50:01”) I get the information. This is just a test token I’m using but it was launched by that time so where is the info?


Please check this query

1 - You can use time filter instead of date filter if you are using full time. Date filter disregards the time ,…it only considers the date.

2- There is limit in the query … you can remove that, you will get the data.

That’s just solved everything, thanks.

I’ve asked this before but how do learn all of this? I haven’t found much documentation beyond a few blogs and the schema documentation, which I find confusing to use. This GraphQL is only a small part of a larger thing but it seems to be the most precarious. I feel like my queries are just houses of cards made up of every type of bracket. One slight change and suddenly nothing works.

Is there any kind of ebook I can read to help me with this?

There is currently no documentation or ebook but we are planning to do it soon…

tl;dr: It seems the value of a transaction changes over time. I want to get the price it would have had at the given time.

Long version:
Okay, so this still isn’t working as I expected it to but I’m somewhat onto the problem. This is a different problem so I’m half expecting to told it should be a new thread.

My code is working now but the prices coming back are much lower than they should be. This is using test data so I know what the prices should look like and I couldn’t figure out why they weren’t as expected. My code uses that pricing method of just pulling up the value of the latest transaction. That works fine for me normally but I have a few gaps in my data that I’m trying to fill. My code finds a gap in the data and I want it to pull the price as if it was pulling at that time.

I didn’t realise but it appears the value of a transaction can change over time, by looking at my original test data I can see there were no new transactions over a few hours but the value being returned from that transaction kept going down. How can I get this value as if I’d climbed into a time machine and run the transaction back then?