Best way to track a token

I’m messing around with the v2 subscriptions and want to find the best way of tracking the buys and sells of a token. I’m new to v2 but from what I can tell so far I have to do two individual queries where I look for buys using the address, or sells using the address. I can put this into one subscription using the OR operator and then pull out what I need in my code, or I can do two subscriptions at the same time. Both of these are workable but seem somewhat clumsy. In v1 we could just search for the transfer and there was a flag to say if it was a buy or a sell, so I feel like I’m not doing it the best way. I’m also not sure how charging works with subscriptions.

  1. Is this the best way of doing it?
  2. If so, credit-wise, is it more efficient to run one subscription with the OR operator, or is it better to run two subscriptions?
  3. Do subscriptions get charged for each event? Am I right in assuming that each event gets charged differently depending on its complexity?

Thanks.

Can you share the query you’re currently testing? It will give us more context.

Try this api Subscription latest Trades of Token_dextrades - Blockchain Data API

Sorry, I haven’t had a chance to reply to this. Here’s the code I’m using right now:

subscription {
EVM {
DEXTrades(
where: {any: [{Trade: {Buy: {Currency: {SmartContract: {is: “ADDRESS”}}}}},
{Trade: {Sell: {Currency: {SmartContract: {is: “ADDRESS”}}}}}]}
) {
Trade {
Buy {
Price
Currency {
SmartContract
Symbol
}
Amount
}
Dex {
OwnerAddress
Pair {
SmartContract
Symbol
}
ProtocolName
SmartContract
}
Sell {
Buyer
Amount
Price
Currency {
SmartContract
Symbol
}
}
}
Block {
Time
}
}
}
}

Are you using same currency for both Buy and sell currency?