# Finding latest trade

**URL:** <https://community.bitquery.io/t/finding-latest-trade/1533>\
**Category:** GraphQL API\
**Created:** [June 20, 2023, 11:06pm UTC](https://community.bitquery.io/t/finding-latest-trade/1533 "2023-06-20T23:06:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![twinnie](https://avatars.discourse-cdn.com/v4/letter/t/c37758/32.png) [@twinnie](https://community.bitquery.io/u/twinnie)\
**Post date:** [June 20, 2023, 11:06pm UTC](https://community.bitquery.io/t/finding-latest-trade/1533/1 "2023-06-20T23:06:58Z")

</div>

Sorry, it seems like this question gets asked all the time but I’m struggling with it. I’m trying to get the absolute latest trade between two pairs but it’s not working for me. In my test code I’m getting trades between WBNB and BUSD but the timestamp on the latest trade it comes up with is about 14 hours old, and if I set the limit to more than 1 then the next trade is about an hour and a half earlier. On dextools I can see that there’s a trade between these pairs every few seconds but I’m not getting them.

Here’s my code:

{  
ethereum(network: bsc) {  
dexTrades(  
any: [{baseCurrency: {is: “0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c”}, quoteCurrency: {is: “0xe9e7cea3dedca5984780bafc599bd69add087d56”}}]  
date: {since: “2023-06-19T22:01:00.000Z”}  
options: {desc: [“tradeIndex”, “block.timestamp.time”], limit: 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  
quotePrice  
}  
}  
}

Thanks.

---

<div class="post-metadata">

**Author:** ![twinnie](https://avatars.discourse-cdn.com/v4/letter/t/c37758/32.png) [@twinnie](https://community.bitquery.io/u/twinnie)\
**Post date:** [June 20, 2023, 11:28pm UTC](https://community.bitquery.io/t/finding-latest-trade/1533/2 "2023-06-20T23:28:33Z")

</div>

Okay, after messing with this for ages of course I figure it out right after posting online. I changed the desc: option to just “block.timestamp.time” and now it seems to be working fine. I still don’t know what tradeIndex is and I don’t know how it can appear to allow you to sort by two different things, but at least my code works now.
