I am trying to get the prices from some Dex trades but I cannot seem to identify the squence of entries in the transactions (and who is the original buyer/seller of the token)
For example, this is my query (API1)
{
ethereum {
dexTrades(
options: {asc: ["block.height", "tradeIndex"], limit: 10}
smartContractAddress: {is: "0x3C2a37B1131Da9941a577E7155EE393A5a6D7667"}
time: {since: "2024-04-29T20:28:22Z"}
) {
transaction(
txHash: {is: "0xf3bbafef5d85a1a22c9dc698202fc44da96071d8a3ec22bd2547db8dbbbf90c7"}
) {
hash
txFrom {
address
}
to {
address
}
}
protocol
block {
height
timestamp {
iso8601
}
hash
}
quoteCurrency {
symbol
}
quoteAmount
buyCurrency {
symbol
}
sellCurrency {
symbol
}
quotePrice
sellAmount
buyAmount
side
baseCurrency {
address
symbol
}
baseAmount
maker {
address
}
taker {
address
}
tradeAmount(in: USD)
tradeIndex
}
}
}
The response shows 2 results with the same transaction ID, but one is a buy side and one is a sell. How can I determine what the original user did? Did they initiate a buy or sell instruction on the Dex?
{
"transaction": {
"hash": "0xf3bbafef5d85a1a22c9dc698202fc44da96071d8a3ec22bd2547db8dbbbf90c7",
"txFrom": {
"address": "0x2bf59f59ea3b190f9b27c6aaa000d08fac495ad7"
},
"to": {
"address": "0x80a64c6d7f12c47b7c66c5b4e20e72bc1fcd5d9e"
}
},
"protocol": "Uniswap v2",
"block": {
"height": 19763346,
"timestamp": {
"iso8601": "2024-04-29T20:28:23Z"
},
"hash": "0x9a3873003b97411945d664e49cf58fb3667ed26df05d2b4414c59b3edc2392b6"
},
"quoteCurrency": {
"symbol": "WETH"
},
"quoteAmount": 2.82780155717624,
"buyCurrency": {
"symbol": "THREE"
},
"sellCurrency": {
"symbol": "WETH"
},
"quotePrice": 0.00004589518413569014,
"sellAmount": 2.82780155717624,
"buyAmount": 61614.341688134,
"side": "BUY",
"baseCurrency": {
"address": "0xa059b81568fee88791de88232e838465826cf419",
"symbol": "THREE"
},
"baseAmount": 61614.341688134,
"maker": {
"address": "0x80a64c6d7f12c47b7c66c5b4e20e72bc1fcd5d9e"
},
"taker": {
"address": "0x80a64c6d7f12c47b7c66c5b4e20e72bc1fcd5d9e"
},
"tradeAmount": 8983.473347437011,
"tradeIndex": "5"
},
{
"transaction": {
"hash": "0xf3bbafef5d85a1a22c9dc698202fc44da96071d8a3ec22bd2547db8dbbbf90c7",
"txFrom": {
"address": "0x2bf59f59ea3b190f9b27c6aaa000d08fac495ad7"
},
"to": {
"address": "0x80a64c6d7f12c47b7c66c5b4e20e72bc1fcd5d9e"
}
},
"protocol": "Uniswap v2",
"block": {
"height": 19763346,
"timestamp": {
"iso8601": "2024-04-29T20:28:23Z"
},
"hash": "0x9a3873003b97411945d664e49cf58fb3667ed26df05d2b4414c59b3edc2392b6"
},
"quoteCurrency": {
"symbol": "THREE"
},
"quoteAmount": 61614.341688134,
"buyCurrency": {
"symbol": "THREE"
},
"sellCurrency": {
"symbol": "WETH"
},
"quotePrice": 21788.77847060113,
"sellAmount": 2.82780155717624,
"buyAmount": 61614.341688134,
"side": "SELL",
"baseCurrency": {
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"symbol": "WETH"
},
"baseAmount": 2.82780155717624,
"maker": {
"address": "0x80a64c6d7f12c47b7c66c5b4e20e72bc1fcd5d9e"
},
"taker": {
"address": "0x80a64c6d7f12c47b7c66c5b4e20e72bc1fcd5d9e"
},
"tradeAmount": 8983.473347437011,
"tradeIndex": "5"
}