Build a real-time crypto dashboard with live prices, trades, and charts using Codex API subscriptions.
In this guide we’ll build a nodejs application that listens for price changes on a token in realtime. We’ll show
how to do it two ways, one with webhooks and another with subscriptions.
Webhooks
Install the Codex SDK
npm install @codex-data/sdk
Create a new file called index.js and add the following code:
const { Codex } = require('@codex-data/sdk');const client = new Codex(process.env.CODEX_API_KEY);
Now we have to add the token address and network id to code so we can start listening for price changes.
Next, we’ll need be able to receive webhook deliveries on our local computer. Let’s use loophole to do this.https://loophole.cloud/downloadAfter getting that setup and seeing your loophole url, copy it and save it for later.Now lets make the request to make a webook subscription, replacing the value for the host