moosecat a55be980fe send indicative quotes to mainnet (#374)
* Bumping drift-common to ab538e0c1efbf64a3dfecf2af16e5a75aab81400

* Bumping drift-common to cf7f6ec63febe0d3b661f187e4e26e729797c4d0

* Bumping drift-common to 149f5efe5444d89b53b5370dcea4a3115fec8c5f

* Bumping drift-common to c879f8a85bfcbaef1f1c6d9c6bf4a05e8970fa0a

* Bumping drift-common to d089c9ed7e7400a0f3ea98a0184a4e3bf273fcf5

* dlob add fetch indicative quotes (#372)

* dlob add fetch indicative quotes

* indicative ws stream

* prettify

* allow for oracle orders

* Bumping drift-common to 56331c89a2285a04cc86a639e0fceeda03366f43

* add console log for debugging indicative

* add indicative in l2 queries

* add more console logging for debugging

* bump common and remove logging

* Bumping drift-common to 43104f473f43111f8cc34733a43a85b5fef7f778

* Bumping drift-common to 6d75612fa1fab858daa90cdb91f0c8c9edbc8242

* Bumping drift-common to 3a42e9665c04a27bcf92e7faa50c168690312880

* Bumping drift-common to 20351d45f2644fb7194ffce441d3d2cb8d6c6b4b

* Bumping drift-common to 04216dfc03aa659db24fc24ba42aa8a4e9a8bb9a

* Bumping drift-common to ad20bbe9d3a262c547f66ec464306fabac539fd8

* Bumping drift-common to 5539ad5f3849b19e1b7106f783a16a182fc9a411

* Bumping drift-common to 8b7e118f1aed9d1d7a786cd165f0ceef2a07297c

* Bumping drift-common to 52b7948cebb0ed6bc1f8278b0f549366a1be3ba0

* Bumping drift-common to 26a603c2d78f7f662cb872075bdff1fd6b75ec43

* Bumping drift-common to 683bfc5cefe5097a257511507f22831f185f1549

* Bumping drift-common to b66eaade382a58b563fdc5ee6c03bc98e5bb2195

* Bumping drift-common to 9a48bea13265723c5d17377e68aaf9984b24c722

* Bumping drift-common to a147ab129f6eb59d77889ac2b7a915ca910d83dd

* Bumping drift-common to 65891abfcd5f59c726aecb211ae77ca38394bdf1

* Bumping drift-common to 540cdbbc9b322990d288af8f4f3183f2c96087b7

* Bumping drift-common to 978b8a03b59d0dc24d1269f319ff6a7ff711775a

* Bumping drift-common to af74d01953db3683bca585c2111910cbbe171a72

* Bumping drift-common to cd684e22082438f0cb784ec234fd9e5d3cd63bb2

---------

Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
2025-04-28 10:16:44 -07:00
2024-12-03 13:47:02 -08:00
2023-07-05 20:09:22 -07:00
2024-12-18 11:28:01 +08:00
2024-07-31 09:06:51 +10:00
2023-05-23 12:40:57 -07:00
2024-12-02 17:38:18 -08:00
2025-01-30 14:43:12 -08:00
2025-01-08 16:54:19 +11:00
2024-12-18 11:28:01 +08:00
2025-01-30 14:43:12 -08:00
2024-12-02 17:38:18 -08:00
2024-10-24 13:43:17 -07:00

DLOB Server for Drift Protocol v2

Docs Discord Chat License

DLOB Server

This is the backend server that provides a REST API for the drift DLOB.

Run the server

Setup

The build dependencies

git submodule update --init
bash build_all.sh

First set the necessary environment variables:

cp .env.example .env

Environment Configuration

To properly configure the DLOB server, set the following environment variables in your .env file:

Variable Description Example Value
ENDPOINT The Solana RPC node http endpoint. https://your-private-rpc-node.com
WS_ENDPOINT The Solana RPC node websocket endpoint. wss://your-private-rpc-node.com
USE_WEBSOCKET Flag to enable WebSocket connection. true
USE_ORDER_SUBSCRIBER Flag to enable order subscriber DLOB source. true
DISABLE_GPA_REFRESH Flag to disable periodic refresh using getProgramAccounts. true
ENV The network environment the server is connecting to. mainnet-beta
PORT The port number the HTTP server listens on. 6969
METRICS_PORT The port number for Prometheus metrics. 9465
PRIVATE_KEY Path to the Solana private key file. /path/to/keypair.json
RATE_LIMIT_CALLS_PER_SECOND Maximum number of API calls per second. 100
PERP_MARKETS_TO_LOAD Number of perpetual markets to load at startup. 0
SPOT_MARKETS_TO_LOAD Number of spot markets to load at startup. 5
ELASTICACHE_HOST (for websocket server) Redis host endpoint. localhost
ELASTICACHE_PORT (for websocket server) Redis port. 6379
REDIS_CLIENT (for websocket server) Redis client type (DLOB/DLOB_HELIUS). DLOB
WS_PORT (for websocket server) The port to run the websocket server on. 3000

Note: multiple Redis hosts can be provided by providing a comma separated string.

HTTP mode

The HTTP server as documented here can be run with, and by default accessible on http://127.0.0.1:6969:

yarn run dev

Websocket mode

The websocket server has 2 components, the dlob-publisher that takes frequent snapshots of the DLOB and publishes them to Redis, and ws-manager listens for new connections and sends the latest DLOB to ws clients, the two components communicate through Redis pub-sub.

To run the websocket server, a Redis cache is required, and the following environment variables must be set:

  • REDIS_HOSTS
  • REDIS_PASSWORDS
  • REDIS_PORTS

In the first terminal, start the redis cluster:

bash redisCluster.sh start
bash redisCluster.sh create

In second terminal, run:

yarn run dlob-publish

In a third terminal, run:

yarn run ws-manager

Then connect to the ws server at ws://127.0.0.1:3000

When you're done, stop the redis cluster:

bash redisCluster.sh stop

Run the example client

Documentation for connecting to the dlob server are available here

TODO: complete client examples.

Description
No description provided
Readme 2.2 MiB
Languages
TypeScript 89.8%
HTML 6.8%
Shell 3%
JavaScript 0.2%
Dockerfile 0.2%