Skip to content

Trading Intelligence & Signals


How do you identify key market metrics that are critical to deriving useful insights? Trading intelligence can be a great way to leverage markets for your advantage and find opportunities that would otherwise be missed. We’ve built our APIs to easily access digital asset metrics and value allowing for simple integration into your applications.

We'll need a few things to accomplish what we're after:

  • Historical market data for backtesting strategies
  • Real-time market data to respond to market signals
  • Blockchain data to watch DEXs and other metrics that could affect prices
Backtesting with historical market data

First you'll want to come up with a strategy and define some rules on how your code will operate. What we'll do is get historical market prices across all available exchanges and then simulate our signals on this data as if it's in real-time.

const Web3Data = require("web3data-js")
const w3d = new Web3Data(process.env.API_KEY)

// Initialize parameters
const BASE = 'eth'
const QUOTE = 'usd'
const endDate = +new Date()
const startDate = +new Date() - (86400000)

// Get historical pricing data for the pair 'eth/usd'
// We can adjust the window using the 'startDate' & 'endDate' parameters
// We'll use this data for backtesting
const histPrices = await"eth", { startDate, endDate })
//  you can iterate over this array of historical prices to backtest assumptions
Real-time Market Data

Once we've adjusted the parameters and are confident in our code, we'll now want to hook it up to real-time market data and start executing trades. Note: Amberdata provides market data, but to execute a trade you'll need to use the exchange's API. Using our comprehensive market data your code will be able to spot signals in the markets.

const Web3Data = require("web3data-js")
const w3d = new Web3Data(process.env.API_KEY)
const BASE = 'eth'
const QUOTE = 'usd'

// Initiate the websocket connection

// Watch for changes in market prices of the pair 'eth_usd'
w3d.on({eventName: 'market:prices:updates', filters: {pair:`${BASE}_${QUOTE}`}}, data => {
    // Here we could place our trading logic. For instance:
    // if price > n then executeTrade(pair, ammount)
    console.log(`Price update - was: ${data.previousPrice} is: ${data.price}`)
More context with Blockchain data

One final thing we can do to get an even better edge would be to combine blockchain and market data to find correlations between blockchain events and market prices. This would give our code a predictive advantage over other businesses that work only with market data. We can use our historical data for backtesting and then start integrating real-time blockchain data into our code and watch it's performance.

const Web3Data = require("web3data-js")

// Create the Web3Data instances passing in  your API Key (Get one! ->
const w3d = new Web3Data(process.env.API_KEY)

const BASE = 'eth'
const QUOTE = 'usd'
// Here we can watch for certain blockchain events and then make decisions based on these events

// Initiate the websocket connection

/* Token Transfers */
// Define the token that we want to make decisions against
const KYBER_TOKEN = '0xdd974d5c2e2928dea5f71b9825b8b646686bd200'

// Get historical token transfers and historical token prices to run correlation tests. Based on historical token transfers we can possibly determine how a token transfer might effect price and factor in amount of tokens transfered as well as time of day of the transfer. Then place logic to execute transfer of the token if it passes certain parameters
const histTokenTransfers = w3d.token.getTransfers(KYBER_TOKEN)

// Now that we have an idea of the corelation between token transfers and token prices we can now watch for token transfers and set some parameters for when we might want to make decisions against this data. For instance, if the amount of tokens transfered is above some threshold

const THRESHOLD = 1000
// Subscribes to all token transfer events
w3d.on({eventName: 'token_transfer'}, tokenTransfer => {

    // Execute a trade if the amount above some perdetermined threshold
    if(tokenTransfer.amount > THRESHOLD) {
        // triggerSignal(pair, amount)
        console.log('Execute Trade')
    // Log the token transfer data

/* Functions */
// Look for hist
// Watch for events such as 'mint' and 'burn' and execute trade

// Get the human readable text signature of the event
const getTextSig = async (hashSig) => w3d.signature.getSignature(hashSig).then( data => data.length > 0 ? data[0].textSignature : '')

w3d.on({eventName:'address:logs', filters: {address: KYBER_TOKEN} },
    async data => {
        const triggerSignal = false
        // Each log contains topics which tells us details about the event that was triggered
        // We'll use another one of our endpoints
        const hashSig = data.topics[0].slice(0, 10)
        const textSignature = await getTextSig(hashSig)

        // Check to see if it is a mint event
        if(textSignature.toLowerCase().includes('mint')) {
            // Check amount minted
            triggerSignal = true
        } else if(textSignature.toLowerCase().includes('burn')) {
            // Check amount burned
            triggerSignal = true
        if(triggerSignal) {
            // triggerSignal(pair, amount)

/* Pending Transactions */
// We may want to watch for pending transactions as there are times when there could be a large pending transaction that could effect the price. Therefore we could trigger a signal expecting that once this pending transaction gets confirmed it will effect the price of that blockchain's token
const VALUE_THRESHOLD = 1000000000000000000 // wei
w3d.on({eventName:'pending_transactions'}, (pndingTxn) => {
    if(pndingTxn.value > VALUE_THRESHOLD) {
        // triggerSignal('eth_usd', amount)