Skip to content

Adding New Markets

jppade edited this page Dec 10, 2025 · 6 revisions

How to Add a new pair to a CEX Scraper / a new Pool to a DEX Scraper

Overview

All runtime pairs and pools are defined by JSON configuration files in the decentral-feeder repository. Scrapers hot-reload these configurations at a fixed interval. No code changes are required—only edits to the relevant JSON files.

Note

External contributors: please request changes and market additions via a pull request to the decentral-feeder repository.

Where to Edit

Centralized Exchanges' (CEX) markets

config/exchangePairs/<EXCHANGE>.json

Schema

{
  "ExchangePairs": [
    {
      "Pair": "BTC-USDT",
      "WatchDogDelay": 300
    },
    {
      "Pair": "ETH-USDC",
      "WatchDogDelay": 300
    }
  ]
}

Fields

  • Pair (string) – Ticker in QUOTE-BASE format (e.g., BTC-USDT).

  • WatchDogDelay (integer) – If no trade is seen within the last WatchdogDelay seconds, the scraper auto-resubscribes to the trades stream of the respective pair.

Decentralized Exchanges' (DEX) pools

config/pools/<EXCHANGE>.json

Curve-style schema (directional entries)

Each entry represents a single pair for the given pool address.

"Pools":
	[
	  {
	    "ForeignName": "WBTC-USDT",
	    "Address": "0xD51a44d3FaE010294C616388b506AcdA1bfAAE46",
	    "Order": "10",
	    "WatchDogDelay": 300
	  },
	  {
	    "ForeignName": "WETH-USDT",
	    "Address": "0xD51a44d3FaE010294C616388b506AcdA1bfAAE46",
	    "Order": "20",
	    "WatchDogDelay": 300
	  },
	  {
	    "ForeignName": "WBTC-WETH",
	    "Address": "0xD51a44d3FaE010294C616388b506AcdA1bfAAE46",
	    "Order": "12",
	    "WatchDogDelay": 300
	  },
	  {
	    "ForeignName": "WETH-WBTC",
	    "Address": "0xD51a44d3FaE010294C616388b506AcdA1bfAAE46",
	    "Order": "21",
	    "WatchDogDelay": 300
	  }
	]

Curve-style Fields

  • ForeignName (string) (optional): Human-readable pair label used in logs/metrics (e.g., WETH-USDT).

  • Address (string): Pool contract address (checksum or lowercased hex).

  • Order (string, two digits): Direction indices for the pool

    Order[0] = OutIndex (token bought)

    Order[1] = InIndex (token sold)

    Must be two digits and OutIndex != InIndex (e.g., "10", "21", "02").

  • WatchDogDelay (integer):If no trade is seen within the last WatchdogDelay seconds, the scraper auto-resubscribes to the trades stream of the respective pair.

Tip: For a 2-coin pool (indices 0 and 1), add two entries to cover both directions ("10" and "01") if you want trades in both orders.

UniswapV3 / PancakeswapV3 / UniswapV2-style schema

For these scrapers, Order is an integer between 0 and 2.

 "Pools": [
        {
            "ForeignName": "PRIME-WETH",
            "Address": "0xCD423F3ab39a11ff1D9208B7D37dF56E902C932B",
            "Order": "1",
            "WatchDogDelay": 3600
        },
        {
            "ForeignName": "PEAS-WETH",
            "Address": "0x44C95bf226A6A1385beacED2bb3328D6aFb044a3",
            "Order": "0",
            "WatchDogDelay": 600
        },
        {
            "ForeignName": "DAI-USDC",
            "Address": "0x5777d92f208679DB4b9778590Fa3CAB3aC9e2168",
            "Order": "2",
            "WatchDogDelay": 600
        }
      ]

UniswapV3 / PancakeV3 / UniswapV2-style Fields

  • ForeignName (string) (optional) – Human-readable pair label (used in logs/metrics), e.g., WETH-USDT.

  • Address (string) – Pool contract address.

  • WatchDogDelay (integer) – If no trade is seen within the last WatchdogDelay seconds, the scraper auto-resubscribes to the trades stream of the respective pair.

  • It supports a different integer Order behavior where:

    0 → token1 to token0,

    1 → token0 to token1,

    2 → both direction.

How scrapers pick up changes (hot reload)

Each scraper watches the configuration periodically and updates accordingly in case changes are detected:

CEX: <EXCHANGE>_WATCH_CONFIG_INTERVAL (seconds), e.g., BINANCE_WATCH_CONFIG_INTERVAL=3600.

DEX: <EXCHANGE>_WATCH_CONFIG_INTERVAL (seconds), e.g., CURVE_WATCH_CONFIG_INTERVAL=3600.

On change:

  • Added items → subscribe & start watchdog

  • Removed items → unsubscribe & stop watchdog

  • Changed WatchDogDelay → watchdog restarts with new delay

Step-by-step: Add a new item

CEX pair

  • Edit config/exchangePairs/<EXCHANGE>.json.

  • Append a new object under "ExchangePairs":

{ 
    "Pair": "PEPE-USDT", 
    "WatchDogDelay": 300 
}
  • Commit & push.

  • Submit a pull request to the decentral-feeder repository.

DEX pool

  • Edit config/pools/<EXCHANGE>.json.

  • Add an entry:

{
  "ForeignName": "crvUSD-USDT",
  "Address": "0x390f3595bCa2Df7d23783dFd126427CCeb997BF4",
  "Order": "10",
  "WatchDogDelay": 300
}
  • (Optional) Add the reverse direction ("01") if you want both sides.

  • Commit & push.

  • Submit a pull request to the decentral-feeder repository.

Validation checklist

  • JSON is valid: run jq . config/.../file.json.

  • No duplicate (Address, Order) pairs in DEX configs.

  • Order for Curve-style is two digits and not equal (e.g., "11" is invalid).

  • WatchDogDelay is a positive integer.

  • Pool address is correct and deployed on the target chain.

Confirm in logs

  • “Added pair … with delay …” (CEX)

  • “Added pool … (wd=…, order=…)” (DEX)

Clone this wiki locally