Hey i’ve been following this guild (https://stackoverflow.com/questions/67998154/how-to-calculate-the-total-volume-transacted-for-a-token-on-rsk) in the ✔️ answer section to calculate the volume for the ticker but the problem is when listening to “Transfers” event it would get all the transfer transaction but i only want to calculate volume on the swap transaction. Is there a way for me to filter through all the transfer transactions i got from the “Transfer” event to only get swap transactions? The picture is what i got when listening to “Transfer” event

enter image description here

1 Answer 1


Depends on what volume you're trying to calculate, for instance if you are trying to calculate volume for a specific DEX pair, you could listen to Swap event (almost every pair has one) of that pairs swap function instead of Transfer event.

If you want volume for multiple pairs while only listening to Transfer events, then you can try to filter by specific sender/recipient addresses. When said token is being bought, sender will be DEX pair or router, depending on implementation, and for every sell recipient will also be DEX pair or router. So you can get a list of pair addresses or router address(es) to filter the transfers.

  • hey yeah listening to swap event and then calculate volume for the specific pair was what i was trying to do. i was able to figure it out but i was wondering if you know a better way of calculating the volume than what i have right now? stackoverflow.com/questions/77815642/…
    – irregular
    Commented Jan 23 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.