Messages
No examples found{
"action": "<string>",
"chain_id": 123,
"dataset_id": "<string>"
}No examples foundNo examples foundNo examples foundYields & ROI
Yields
Subscribe to real-time rolling pool yield and ROI predictions.
WSS
/
Overview
- Dataset ID:
0411 - Liquidity Pool Yields - Description: Rolling yield/ROI predictions per pool over fixed horizons (1D, 3D, 7D, 14D, 30D, 90D, 365D), based on historical swap fees (blockdb_evm.b0303_liquidity_pools_swap_fees_v1) and current reserves (latest blockdb_evm.b0301_liquidity_pools_reserves_v1 snapshot).
- Sample: Hugging Face Sample
Subscription Parameters
number
Target horizon in days (e.g., 1, 7, 30).
string[]
Filter updates to specific BlockDB pool identifiers.
Message Fields
string
BlockDB pool identifier.
number
Exchange/DEX identifier.
number
Pool type identifier.
number
Block height of the prediction anchor.
string
Block time (ISO-8601).
number
Transaction index.
number
Log index.
number
Target horizon in days.
number
History actually used (must be
> 0 and <= target_period_days).boolean
true when observed_period_days == target_period_days.boolean
true when the row is scaled from shorter history.string
Scaling factor applied when extrapolating (string to preserve precision).
string
Start time of the observed window.
string
End time of the observed window.
string[]
Pool token addresses (aligned arrays index by this order).
string[]
Current reserves per token (decimals-adjusted).
string[]
Observed traded volume per token in the window.
string[]
Predicted traded volume per token for the target horizon.
string[]
Observed user/LP fees per token in the window.
string[]
Predicted user/LP fees per token for the target horizon.
string[]
Predicted ROI fraction per token for the target horizon.
string
Row-level lineage hash for correlation.
string[]
Parent lineage ids (hex).
string
Record creation time (ISO-8601).
string
Record last update time (ISO-8601).
Subscription Example
# Use wscat to connect and subscribe
wscat -c wss://api.blockdb.io/v1/evm/ \
-H "Authorization: Bearer $BLOCKDB_API_KEY" \
-x '{"action": "subscribe", "dataset_id": "0411", "chain_id": 1, "params": {"target_period_days": 7}}'
#include <libwebsockets.h>
#include <string.h>
#include <stdio.h>
static int callback_blockdb(struct lws *wsi, enum lws_callback_reasons reason,
void *user, void *in, size_t len) {
switch (reason) {
case LWS_CALLBACK_CLIENT_ESTABLISHED:
lws_callback_on_writable(wsi);
break;
case LWS_CALLBACK_CLIENT_RECEIVE:
printf("Received: %s\n", (char *)in);
break;
case LWS_CALLBACK_CLIENT_WRITEABLE: {
unsigned char buf[LWS_PRE + 512];
unsigned char *p = &buf[LWS_PRE];
size_t n = sprintf((char *)p, "{\"action\": \"subscribe\", \"dataset_id\": \"0411\", \"chain_id\": 1, \"params\": {\"target_period_days\": 7}}");
lws_write(wsi, p, n, LWS_WRITE_TEXT);
break;
}
}
return 0;
}
using System;
using System.Net.WebSockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
class Program {
static async Task Main() {
using var ws = new ClientWebSocket();
ws.Options.SetRequestHeader("Authorization", $"Bearer {Environment.GetEnvironmentVariable("BLOCKDB_API_KEY")}");
await ws.ConnectAsync(new Uri("wss://api.blockdb.io/v1/evm/"), CancellationToken.None);
var subMsg = "{\"action\": \"subscribe\", \"dataset_id\": \"0411\", \"chain_id\": 1, \"params\": {\"target_period_days\": 7}}";
await ws.SendAsync(new ArraySegment<byte>(Encoding.UTF8.GetBytes(subMsg)), WebSocketMessageType.Text, true, CancellationToken.None);
var buffer = new byte[1024 * 4];
while (ws.State == WebSocketState.Open) {
var result = await ws.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);
Console.WriteLine(Encoding.UTF8.GetString(buffer, 0, result.Count));
}
}
}
import websocket
import json
import os
def on_message(ws, message):
print(f"Received: {message}")
def on_open(ws):
msg = {
"action": "subscribe",
"dataset_id": "0411",
"chain_id": 1,
"params": {
"target_period_days": 7
}
}
ws.send(json.dumps(msg))
ws = websocket.WebSocketApp(
"wss://api.blockdb.io/v1/evm/",
header={"Authorization": f"Bearer {os.getenv('BLOCKDB_API_KEY')}"},
on_message=on_message,
on_open=on_open
)
ws.run_forever()
const WebSocket = require('ws');
const ws = new WebSocket('wss://api.blockdb.io/v1/evm/', {
headers: { 'Authorization': `Bearer ${process.env.BLOCKDB_API_KEY}` }
});
ws.on('open', () => {
ws.send(JSON.stringify({
action: 'subscribe',
dataset_id: '0411',
chain_id: 1,
params: {
target_period_days: 7
}
}));
});
ws.on('message', (data) => {
console.log('Received:', JSON.parse(data));
});
package main
import (
"fmt"
"log"
"net/http"
"os"
"github.com/gorilla/websocket"
)
func main() {
header := http.Header{"Authorization": []string{"Bearer " + os.Getenv("BLOCKDB_API_KEY")}}
c, _, err := websocket.DefaultDialer.Dial("wss://api.blockdb.io/v1/evm/", header)
if err != nil {
log.Fatal("dial:", err)
}
defer c.Close()
sub := `{"action": "subscribe", "dataset_id": "0411", "chain_id": 1, "params": {"target_period_days": 7}}`
err = c.WriteMessage(websocket.TextMessage, []byte(sub))
if err != nil {
log.Fatal("write:", err)
}
for {
_, message, err := c.ReadMessage()
if err != nil {
log.Fatal("read:", err)
}
fmt.Printf("Received: %s\n", message)
}
}
Response Example
{
"chain_id": 1,
"dataset_id": "0411",
"is_reorg": false,
"data": {
"pool_uid": "00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
"exchange_id": 3,
"type_id": 302,
"block_number": 19001234,
"block_time": "2025-12-20T12:34:56Z",
"tx_index": 7,
"log_index": 12,
"target_period_days": 30,
"observed_period_days": 30,
"is_full_period": true,
"is_extrapolated": false,
"extrapolation_factor": "1.000000",
"window_start_time": "2025-11-20T12:34:56Z",
"window_end_time": "2025-12-20T12:34:56Z",
"tokens": [
"c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
],
"current_reserves": [
"1250.000000000000000000",
"3950000.000000000000000000"
],
"volume_observed": [
"12000.000000000000000000",
"0.000000000000000000"
],
"volume_predicted": [
"12000.000000000000000000",
"0.000000000000000000"
],
"user_fees_observed": [
"36.000000000000000000",
"0.000000000000000000"
],
"user_fees_predicted": [
"36.000000000000000000",
"0.000000000000000000"
],
"roi_predicted": [
"0.028800000000000000",
"0.000000000000000000"
],
"_tracing_id": "041100000000000000000000000000007401",
"_parent_tracing_ids": ["030300000000000000000000000000007401", "030100000000000000000000000000007401"],
"_created_at": "2025-12-20T12:35:01Z",
"_updated_at": "2025-12-20T12:35:01Z"
}
}
Messages
No examples found{
"action": "<string>",
"chain_id": 123,
"dataset_id": "<string>"
}No examples foundNo examples foundNo examples foundsubscribe
type:object
unsubscribe
type:object
subscribe_response
type:object
unsubscribe_response
type:object
update
type:object
Last modified on July 19, 2026
Was this page helpful?