Skip to main content

Tracking Asset Exchanges on Whales with Tokenview Transaction Tracking API

tokenviewAbout 2 min

Tracking Asset Exchanges on Whales with Tokenview Transaction Tracking API

Overview

Read this article if you are getting insights of Assets Exchangs happened on Whales. For example, you are watching a wallet address list which hold more than 1000 ETH on each, you want to get the marketing trend from their activities. Firstly, you expect to get the ETH balance changes, secondly you also care much about the asset exchanges on them, e.g. exchanging 300 ETH to 1,050,000 USDT. This will somehow impact the market trend which is the signal for you to do next trading decision-making.

In this article, we will learn how to get alerts on asset exchanges happened on Whales by utilizing Tokenview Transaction Tracking API.

Track Exchanges on Whales

Basic Preparation

To track asset exchanges on whale, you need to know,

  1. The Whale address - which you want to track.
  2. The Trade/Swap event - which is the high-liquidity exchanges' emitted event on which whales usually do trading on.

The high-liquidity exchanges are Uniswap, SushiSwap, KyberSwap, CoW Swap etc.

Set Tracking Parameters

With the above knowledge, next we will target two parameters in Tokenview Transaction Tracking APIopen in new window:

  1. The whale address.
  2. The Trade/Swap event's Keccak-256 hash - (we use CoW in this example)

To monitor event, we actually are identifying the events' Keccak-256 hash, to get the Keccak-256 hash, you can open CoW Protocol: GPv2Settlementopen in new window from blockchain explorer, and click any of the transaction from its transaction list, for instance, this oneopen in new window. And then check its "Event Logs(10)" tab, Ctrl+F to search "Trade", Topics[0] is the event requested, "0xa07a543ab8a018198e99ca0184c93fe9050a79400a0a723441f84de1d972cc17"


With the above parameters, build a HTTP request,

curl --location 'https://services.tokenview.io/vipapi/txmonitor/addTrackingItem?apikey={apikey}' \
--header 'Content-Type: application/json' \
--data '{
    "currency": "ETH",
    "trackType": "event",
    "contract": "your whale address",
    "topic": "0xa07a543ab8a018198e99ca0184c93fe9050a79400a0a723441f84de1d972cc17"
}'

Get Alerts of Asset Exchanges

Once the HTTP request is settled, you will receive the following alert message,

{
	"coin": "ETH",
	"confirmations": 1,  // confirmations
	"contract": "{monitored whale address}",  // monitored whale address
	"event": "{\"address\": \"0x9008d19f58aabd9ed0d60971565aa8510560ab41\", \"topics\": [\"0xa07a543ab8a018198e99ca0184c93fe9050a79400a0a723441f84de1d972cc17\", \"0x9c489e4efba90a67299c1097a8628e233c33bb7b\"], \"data\": \"0x09f8f72aa9304c8b593d555f12ef6589cc3a579a2000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000006f05b59d3b20000000000000000000000000000000000000000000000000000065ce5ee05924d73000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000038ded799036080d502fb53d8273452e0c69de62a33f6f0583816d08aa5a1126b709c489e4efba90a67299c1097a8628e233c33bb7b662b6cda0000000000000000\", \"transactionIndex\": \"0xd\", \"logIndex\": \"0xa5\", \"removed\": false}",
	"height": 19738353,  // block height
	"network": "ETH",    // The chain where the transaction occurs
	"time": 1714120199,  // UTC timestamp
	"topic": "0xa07a543ab8a018198e99ca0184c93fe9050a79400a0a723441f84de1d972cc17", // monitored topic
	"txChangeType": "event", // message type
	"txid": "0x2521563c267c32dceeb96d26f3187f010a78383a00e632963cff1251f64913b3" // transaction hash
}

Get the exchanged Asset Pair, Quantity and the Closing Price

From the event part in the alert message, seperating them by 64 chars as a group:

0x09f8f72aa9304c8b593d555f12ef6589cc3a579a2000000000000000000000 - sellToken
000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000 - buyToken
00000000000000000000000000006f05b59d3b20000000000000000000000000 - sellAmount
000000000000000000000000000065ce5ee05924d73000000000000000000000 - buyAmount
0000000000000000000000000000000000000000000000000000000000000000 - feeAmount
00000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000038ded799036080d502fb53d8273452e0c69de62a33f6f0583816d08aa5a1126b709c489e4efba90a67299c1097a8628e233c33bb7b662b6cda0000000000000000 - orderUid

Based on the definition of the event,

Trade (index_topic_1 address owner, address sellToken, address buyToken, uint256 sellAmount, uint256 buyAmount, uint256 feeAmount, bytes orderUid)

We can parse out

  1. the Asset Pair [sellToken vs. buyToken = Maker(MKR)open in new window vs. ETHopen in new window], and
  2. the exchange Quantity [sellAmount vs. buyAmount = 0.5 vs. 0.458494072543399283], then

caculate the Closing Price of MKR (equal to the swap rate) 0.5/0.458494072543399283 = 1.0905 MKR/ETH.

Conclusion

By leveraging Tokenview Transaction Trackingopen in new window, monitoring asset exchanges and closing prices is straightforward, which provides market traders with valuable insights to enhance profitability..

About Tokenview Blockchain APIs & Data Service Platform:

Tokenview blockchain APIs & data service platform contained 120+ blockchains has powerful endpoints that simplify complex blockchain data into single API calls. Code for all supported blockchains using unified API calls. From here to easily get transaction, address, gas, contract, token, NFT, logs and any information from chain. And Yes you can also send tx to chain. One-click configuration with APIKey helps developers to Use, to Create, to Build.
Last update: