Skip to content

API

REST

Spot

ExchangeInfo

Get rules

GET /spot/exchangeInfo/symbols/{symbol}

Gets exchange rules for required symbol

Request

Parameters

Parameter Type Location Description
symbol string required path Symbol name (e.g ETH-USDT)

Example

curl -L -X GET 'https://dex-api.pepe.team/spot/exchangeInfo/symbols/ETH-USDT'
import requests

base_url = "https://dex-api.pepe.team"
prefix = "spot/exchangeInfo/fees"
symbol = "ETH-USDT"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

response = requests.request("GET", '{}/{}/{}'.format(base_url, prefix, symbol) , headers=headers)

print(response.json())
const baseUrl = 'https://dex-api.pepe.team';
const prefix = 'spot/exchangeInfo/fees';
const symbol = 'ETH-USDT';

const res = await fetch(`${baseUrl}/${prefix}/${symbol}`);

console.log(await res.json());
Response

200

Field Type Description
object ExchangeRule response
name string Symbol name
base_asset string Base asset name
quote_asset string Quote asset name
rules object Rules for price and volume
price object Price rule
min string Minimum price in an order that can be placed
max string Maximum price in an order that can be placed
multiplicity string Order price must be a multiple of this value (i.e. divisible without remainder)
base object Base asset rule
min string Minimum base amount in an order that can be placed
max string Maximum base amount in an order that can be placed
multiplicity string Order base amount must be a multiple of this value (i.e. divisible without remainder)
quote object Quote asset rule
min string Minimum quote amount in an order that can be placed
max string Maximum quote amount in an order that can be placed
multiplicity string Order quote amount must be a multiple of this value (i.e. divisible without remainder)

Example

{
    "name": "ETH-USDT",
    "base_asset": "ETH",
    "quote_asset": "USDT",
    "rules": {
        "price": {
            "min": "0.01",
            "max": "1000000.0",
            "multiplicity": "0.01"
        },
        "base": {
            "min": "0.002",
            "max": "1000000.0",
            "multiplicity": "0.0001"
        },
        "quote": {
            "min": "5",
            "max": "1000000000.0",
            "multiplicity": "0.0001"
        }
    }
}

400

Field Type Value
object Error response
reason string unexpected symbol '{symbol}'
code number 1003

Example

{
    "reason": "unexpected symbol 'PEPEPPP-USDT'",
    "code": 1003
}
Get fees

GET /spot/exchangeInfo/fees/{symbol}

Gets default exchange fees for required symbol

Request

Parameters

Parameter Type Location Description
symbol string required path Symbol name (e.g ETH-USDT)

Example

curl -L -X GET 'https://dex-api.pepe.team/spot/exchangeInfo/fees/ETH-USDT'
import requests

base_url = "https://dex-api.pepe.team"
prefix = "spot/exchangeInfo/fees"
symbol = "ETH-USDT"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

response = requests.request("GET", '{}/{}/{}'.format(base_url, prefix, symbol) , headers=headers)

print(response.json())
const baseUrl = 'https://dex-api.pepe.team';
const prefix = 'spot/exchangeInfo/fees';
const symbol = 'ETH-USDT';

const res = await fetch(`${baseUrl}/${prefix}/${symbol}`);

console.log(await res.json());
Response

200

Field Type Description
object Default ExchangeFees response
taker_fee string Taker fee ratio. 0.001 = 0.1%
maker_fee string Maker fee ratio. 0.001 = 0.1%

Example

{
    "taker_fee": "0.001",   // 0.1%
    "maker_fee": "0.001"    // 0.1%
}

400

Field Type Value
object Error response
reason string unexpected symbol '{symbol}'
code number 1003

Example

{
    "reason": "unexpected symbol 'PEPEPPP-USDT'",
    "code": 1003
}

Market

Get KLines

GET /spot/market/klines/{symbol}/{interval}

Gets klines(candles, candlesticks) for required symbol and interval. Klines are uniquely identified by their ts_ms. KLine is not returned if trades_count==0

Request

Parameters

Parameter Type Location Description
symbol string required path Symbol name (e.g ETH-USDT)
interval string required path Candle interval. Available values: m1,m5,m15,m30,h1,h3,d1
limit number query Maximum count of records to be returned in a single list. Default: 500, Min: 1, Max: 1000
after string query Base64 encoded previous cursor
since number query Minimum candle unixtime (inclusive). Default 0
until number query Maximum candle unixtime (inclusive). Default now()

Example

curl -L -X GET 'https://dex-api.pepe.team/spot/market/klines/ETH-USDT/m1'
curl -L -X GET 'https://dex-api.pepe.team/spot/market/klines/ETH-USDT/m1?limit=5'
import requests

base_url = "https://dex-api.pepe.team"
prefix = "spot/market/klines"
symbol = "ETH-USDT"
interval = "d1"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

# first kline
first_response = requests.request("GET", '{}/{}/{}/{}?limit=1'.format(base_url, prefix, symbol, interval) , headers=headers)
first_response_data = first_response.json()
print(first_response_data)

# second kline
if first_response_data['has_next_page']:
    second_response = requests.request("GET", '{}/{}/{}/{}?limit=1&after={}'.format(base_url, prefix, symbol, interval, first_response_data['last_cursor']) , headers=headers)
    second_response_data = second_response.json()
    print(second_response_data)
type CandleInterval = 'm1' | 'm5' | 'm15' | 'm30' | 'h1' | 'h3' | 'd1';

const baseUrl = 'https://dex-api.pepe.team';
const prefix = 'spot/market/klines';
const symbol = 'ETH-USDT';
const interval: CandleInterval = 'd1';
const limit = 1;

// first kline
const firstResponse = await fetch(`${baseUrl}/${prefix}/${symbol}/${interval}?limit=${limit}`);
const firstResponseData = await firstResponse.json();
console.log(firstResponseData);

// second kline
if (firstResponseData.has_next_page) {
    const afterCursor = firstResponseData.last_cursor;
    const secondResponse = await fetch(`${baseUrl}/${prefix}/${symbol}/${interval}?limit=${limit}&after=${afterCursor}`);
    const secondResponseData = await secondResponse.json();
    console.log(secondResponseData);
}
Response

200

Field Type Description
object KLines response
last_cursor string | null Base64 encoded subsequent data retrieval cursor
has_next_page boolean true if data retrieval can continue
data array Klines. Order by ts_ms desc
object Kline
ts_ms number Kline start unixtime in ms
open_price string First trade price
close_price string Last trade price
high_price string Highest price
low_price string Lowest price
base_volume string Volume in base asset
quote_volume string Volume in quote asset
trades_count number Count of trades

Example

{
    "last_cursor": "2N6XPeWTvGQTckUxH8zoNUfYv1fkvHxwNDNQg",
    "has_next_page": true,
    "data": [
        {
            "ts_ms": 1741651200000,
            "open_price": "1906.28",
            "close_price": "1895.13",
            "low_price": "1895.13",
            "high_price": "1906.28",
            "base_volume": "0.0324",
            "quote_volume": "61.582842",
            "trades_count": 2
        },
        {
            "ts_ms": 1741305600000,
            "open_price": "2193.56",
            "close_price": "2191.39",
            "low_price": "2177.35",
            "high_price": "2193.56",
            "base_volume": "0.0419",
            "quote_volume": "91.669655",
            "trades_count": 3
        }
    ]
}

400

Field Type Value
object Error response
reason string unexpected symbol '{symbol}'
code number 1003

Example

{
    "reason": "unexpected symbol 'PEPEPPP-USDT'",
    "code": 1003
}
Get Orderbook

GET /spot/market/orderbook/{symbol}

Gets orderbook (level2) for required symbol

Request

Parameters

Parameter Type Location Description
symbol string required path Symbol name (e.g ETH-USDT)
limit number query Maximum count of order depth data in asks or bids. Min: 1

Example

curl -L -X GET 'https://dex-api.pepe.team/spot/market/orderbook/ETH-USDT'
curl -L -X GET 'https://dex-api.pepe.team/spot/market/orderbook/ETH-USDT?limit=2'
import requests

base_url = "https://dex-api.pepe.team"
prefix = "spot/market/orderbook"
symbol = "ETH-USDT"
limit = 2
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

res = requests.request("GET", '{}/{}/{}?limit={}'.format(base_url, prefix, symbol, limit) , headers=headers)
print(res.json())
const baseUrl = 'https://dex-api.pepe.team';
const prefix = 'spot/market/orderbook';
const symbol = 'ETH-USDT';
const limit = 2;

const res = await fetch(`${baseUrl}/${prefix}/${symbol}?limit=${limit}`);
console.log(await res.json());
Response

200

Field Type Description
object Orderbook response
data object Snapshot data
ts_ms number Snapshot unixtime in ms
update_id number ID of the last orderbook change
open_interest string Active orders sum in base asset
asks array Orders to sell base asset. Order by price asc
array L2 order
price string L2 order price
quantity string L2 order quantity in base asset
bids array Orders to buy base asset. Order by price desc
array L2 order
price string L2 order price
quantity string L2 order quantity in base asset

Example

{
    "data": {
        "ts_ms": 1741789952126,
        "update_id": 18970556,
        "open_interest": "1.7351",
        "asks": [
            [
                "1882.83",  // price
                "0.0821"    // quantity
            ],
            [
                "1883.53",  // price
                "0.0412"    // quantity
            ]
        ],
        "bids": [
            [
                "1858.75",  // price
                "0.0527"    // quantity
            ],
            [
                "1858.68",  // price
                "0.10"      // quantity
            ]
        ]
    }
}

400

Field Type Value
object Error response
reason string unexpected symbol '{symbol}'
code number 1003

Example

{
    "reason": "unexpected symbol 'PEPEPPP-USDT'",
    "code": 1003
}

400

Field Type Value
object Error response
reason string query validation: invalid digit found in string, request: ...
code number 1099

Example

{
    "reason": "query validation: invalid digit found in string, request: ...",
    "code": 1099
}
Get Ticker 24h by symbol

GET /spot/market/tickers/24h/{symbol}

Gets the 24 hour ticker for required symbol

Request

Parameters

Parameter Type Location Description
symbol string required path Symbol name (e.g ETH-USDT)

Example

curl -L -X GET 'https://dex-api.pepe.team/spot/market/tickers/24h/ETH-USDT'
import requests

base_url = "https://dex-api.pepe.team"
prefix = "spot/market/tickers/24h"
symbol = "ETH-USDT"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

res = requests.request("GET", '{}/{}/{}'.format(base_url, prefix, symbol) , headers=headers)
print(res.json())
const baseUrl = 'https://dex-api.pepe.team';
const prefix = 'spot/market/tickers/24h';
const symbol = 'ETH-USDT';

const res = await fetch(`${baseUrl}/${prefix}/${symbol}`);
console.log(await res.json());
Response

200

Field Type Description
array Ticker response
symbol string Symbol name
ts_ms number Calculation start unixtime in ms
open_price string | null First trade price
close_price string | null Last trade price
high_price string | null Highest price
low_price string | null Lowest price
base_volume string Volume in base asset
quote_volume string Volume in quote asset
trades_count number Count of trades

Example

[
    "ETH-USDT",     // symbol
    1741002650310,  // ts_ms
    "2100.05",      // open_price
    "2200.45",      // close_price
    "2210.65",      // high_price
    "2000.42",      // low_price
    "3.0022",       // base_volume
    "6454.73",      // quote_volume
    47              // trades_count
]
[
    "ETH-USDT",     // symbol
    1741002650310,  // ts_ms
    null,           // open_price
    null,           // close_price
    null,           // high_price
    null,           // low_price
    "0",            // base_volume
    "0",            // quote_volume
    0               // trades_count
]

400

Field Type Value
object Error response
reason string unexpected symbol '{symbol}'
code number 1003

Example

{
    "reason": "unexpected symbol 'PEPEPPP-USDT'",
    "code": 1003
}
Get Tickers 24h

GET /spot/market/tickers/24h

Gets all 24 hour tickers for required symbols

Request

Parameters

Parameter Type Location Description
symbols string[] query Symbols array (e.g ["ETH-USDT"])

Example

curl -L -X GET 'https://dex-api.pepe.team/spot/market/tickers/24h'
curl -L -X GET 'https://dex-api.pepe.team/spot/market/tickers/24h?symbols[]=ETH-USDT&symbols[]=WBTC-USDT'
import requests

base_url = "https://dex-api.pepe.team"
prefix = "spot/market/tickers/24h"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

# get all tickers
res = requests.request("GET", '{}/{}'.format(base_url, prefix) , headers=headers)
print(res.json())

# get required tickers
symbols = ["ETH-USDT", "WBTC-USDT"]
payload = {"symbols[]": symbols }
res = requests.request("GET", '{}/{}'.format(base_url, prefix) , headers=headers, params=payload)
print(res.json())
const baseUrl = 'https://dex-api.pepe.team';
const prefix = 'spot/market/tickers/24h';
let url = new URL(`${baseUrl}/${prefix}`);

// get all tickers
const allTickersResopnse = await fetch(url);
console.log(await allTickersResopnse.json());

// get required tickers
let queryParams = new URLSearchParams();
queryParams.append('symbols[]', 'ETH-USDT');
queryParams.append('symbols[]', 'WBTC-USDT');
url.search = queryParams;

const requiredTickersResponse = await fetch(url);
console.log(await requiredTickersResponse.json());
Response

200

Field Type Description
array Tickers
array Ticker
symbol string Symbol name
ts_ms number Calculation start unixtime in ms
open_price string | null First trade price
close_price string | null Last trade price
high_price string | null Highest price
low_price string | null Lowest price
base_volume string Volume in base asset
quote_volume string Volume in quote asset
trades_count number Count of trades

Example

[
    [
        "ETH-USDT",     // symbol
        1741553924310,  // ts_ms
        null,           // open_price
        null,           // close_price
        null,           // high_price
        null,           // low_price
        "0",            // base_volume
        "0",            // quote_volume
        0               // trades_count
    ],
    [
        "WBTC-USDT",    // symbol
        1741553924453,  // ts_ms
        "79244.4",      // open_price
        "79244.4",      // close_price
        "79244.4",      // high_price
        "79244.4",      // low_price
        "0.00051",      // base_volume
        "40.414644",    // quote_volume
        1               // trades_count
    ]
]

400

Field Type Value
object Error response
reason string unexpected symbol '{symbol}'
code number 1003

Example

{
    "reason": "unexpected symbol 'PEPEPPP-USDT'",
    "code": 1003
}

400

Field Type Value
object Error response
reason string query validation: invalid type: {type} {value}, expected a sequence, request: ...
code number 1099

Example

{
    "reason": "query validation: invalid type: string \"ETH-USDT\", expected a sequence, request: ...",
    "code": 1099
}
Get Trades

GET /spot/market/trades/{symbol}

Gets trades for required symbol

Request

Parameters

Parameter Type Location Description
symbol string required path Symbol name (e.g ETH-USDT)
limit number query Maximum count of records to be returned in a single list. Default: 100, Min: 1, Max: 1000
after string query Base64 encoded previous cursor
since number query Minimum trade unixtime (inclusive)
until number query Maximum trade unixtime (inclusive)

Example

curl -L -X GET 'https://dex-api.pepe.team/spot/market/trades/ETH-USDT'
curl -L -X GET 'https://dex-api.pepe.team/spot/market/trades/ETH-USDT?limit=2'
curl -L -X GET 'https://dex-api.pepe.team/spot/market/trades/ETH-USDT?limit=2&after=54JH4AwCivKaTLmHK7Bp8eY7sEfDk16zFi&since=1695956121'
import requests

base_url = "https://dex-api.pepe.team"
prefix = "spot/market/trades"
symbol = "ETH-USDT"
headers = {'Accept': 'application/json', 'Content-Type': 'application/json'}

# first trade
first_response = requests.request("GET", '{}/{}/{}?limit=1'.format(base_url, prefix, symbol) , headers=headers)
first_response_data = first_response.json()
print(first_response_data)

# second trade
if first_response_data['has_next_page']:
    second_response = requests.request("GET", '{}/{}/{}?limit=1&after={}'.format(base_url, prefix, symbol, first_response_data['last_cursor']) , headers=headers)
    second_response_data = second_response.json()
    print(second_response_data)
const baseUrl = 'https://dex-api.pepe.team';
const prefix = 'spot/market/trades';
const symbol = 'ETH-USDT';
const limit = 1;

// first trade
const firstResponse = await fetch(`${baseUrl}/${prefix}/${symbol}?limit=${limit}`);
const firstResponseData = await firstResponse.json();
console.log(firstResponseData);

// second trade
if (firstResponseData.has_next_page) {
    const afterCursor = firstResponseData.last_cursor;
    const secondResponse = await fetch(`${baseUrl}/${prefix}/${symbol}?limit=${limit}&after=${afterCursor}`);
    const secondResponseData = await secondResponse.json();
    console.log(secondResponseData);
}
Response

200

Field Type Description
object Trades response
last_cursor string | null Base64 encoded subsequent data retrieval cursor
has_next_page boolean true if data retrieval can continue
data array Trades. Order by ts_ms desc
array Trade
ts_ms number Trade unixtime in ms
side "S" | "B" Trade side. Sell: S, Buy: B
price string Trade price
base_volume string Trade volume in base quantity

Example

{
    "last_cursor": "54JH4AwCivKaTLmHK7Bp8eXsa8KQirFf9z",
    "has_next_page": true,
    "data": [
        [
            1741349509729,  // ts_ms
            "S",            // side
            "2191.39",      // price
            "0.007"         // base_volume
        ],
        [
            1741336035968,  // ts_ms
            "B",            // side
            "2177.35",      // price
            "0.0139"        // base_volume
        ]
    ]
}

400

Field Type Value
object Error response
reason string unexpected symbol '{symbol}'
code number 1003

Example

{
    "reason": "unexpected symbol 'PEPEPPP-USDT'",
    "code": 1003
}

WebSocket

Public

Endpoints

  • mainnet: wss://dex-ws.pepe.team/public
  • testnet: wss://dex-testnet-ws.pepe.team/public
Subscribe
Request

Parameters

Parameter Type Description
object JsonRPC request
jsonrpc "2.0" JsonRPC version
id number JsonRPC request Id
method "subscribe" JsonRPC method name
params array JsonRPC params
channels string[] Subscription channels max count is 50. Available channels format:
{symbol}@t - trades
{symbol}@t24 - ticker24 updates
{symbol}@ob - l2 orderbook updates
{symbol}@kline_{interval} - kline updates (interval: "m1", "m5", "m15", "m30", "h1", "h3", "d1")

Example

echo 'subscribe [["ETH-USDT@t24","ETH-USDT@ob","ETH-USDT@t","ETH-USDT@kline_h1"]]' | websocat -n --jsonrpc wss://dex-ws.pepe.team/public
echo 'subscribe [["ETH-USDT@t","WBTC-USDT@t","TRX-USDT@t"]]' | websocat -n --jsonrpc wss://dex-ws.pepe.team/public
import asyncio
import signal
from jsonrpc_websocket import Server

ws_url = "wss://dex-ws.pepe.team/public"
channels = ["ETH-USDT@t24","ETH-USDT@ob","ETH-USDT@t","ETH-USDT@kline_h1"]

def handler(subscription, result):
    print(subscription, result)

async def routine(url):
    server = Server(url)
    try:
        await server.ws_connect()
        server.t = handler
        server.t24 = handler
        server.ob = handler
        server.kline = handler
        subscribtion_id = await server.subscribe(channels)
        await asyncio.wait([asyncio.Future()])
    except asyncio.CancelledError:
        await server.unsubscribe(subscribtion_id)
    finally:
        await server.close()

event_loop = asyncio.new_event_loop()
asyncio.set_event_loop(event_loop)
main_task = asyncio.ensure_future(routine(ws_url))
event_loop.add_signal_handler(signal.SIGINT, main_task.cancel)
event_loop.add_signal_handler(signal.SIGTERM, main_task.cancel)

try:
    event_loop.run_until_complete(main_task)
finally:
    event_loop.close()
const jayson = require('jayson');

const url = "wss://dex-ws.pepe.team/public"
const channels = ["ETH-USDT@t24", "ETH-USDT@ob", "ETH-USDT@t", "ETH-USDT@kline_h1"];
const client = jayson.client.websocket({ url });

client.ws.on('open', function () {
    client.request('subscribe', [channels], () => { });
});

client.ws.on('message', console.log)
Response

New Subscription

Field Type Description
object JsonRPC response
jsonrpc string JsonRPC version
id number JsonRPC request id
result number Subscription id (needed to unsubscribe)

Example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": 6505855244401708
}
Notification

OrderBookUpdate

Field Type Description
object JsonRPC notification
jsonrpc string JsonRPC version
method "ob" JsonRPC method name
params object JsonRPC parameters
subscription number Subscription ID
result object Orderbook update notification
s string Symbol name (e.g ETH-USDT)
u number Update id. Sequential counter
U number Update unixtime in ms
oi string New active orders sum in base asset
A array Orders update to sell base asset
array L2 order update
price string L2 order update price
price string New L2 order quantity in base asset
B string Orders update to buy base asset
array L2 order update
price string L2 order update price
price string New L2 order quantity in base asset

Example

{
    "jsonrpc": "2.0",
    "method": "ob",
    "params": {
        "subscription": 6505855244401708,
        "result": {
            "s": "ETH-USDT",
            "u": 24194558,
            "U": 1742225188600,
            "oi": "1.7948",
            "A": [
                [
                    "1920.37",  // price
                    "0.10"      // quantity
                ]
            ],
            "B":[
                [
                    "1910.14",  // price
                    "0.25"      // quantity
                ]
            ]
        }
    }
}

Ticker24

Field Type Description
object JsonRPC notification
jsonrpc string JsonRPC version
method "t24" JsonRPC method name
params object JsonRPC parameters
subscription number Subscription ID
result object Ticker update notification
s string Symbol name (e.g ETH-USDT)
U number Calculation start unixtime in ms
op string | null First trade price
cp string | null Last trade price
lp string | null Lowest price
hp string | null Highest price
bv string Volume in base asset
qv string Volume in quote asset
t number Count of trades

Example

{
    "jsonrpc": "2.0",
    "method":"t24",
    "params": {
        "subscription": 3173456689615655,
        "result": {
            "s": "TRX-USDT",
            "U": 1742205918869,
            "op": "0.22009",
            "cp": "0.22022",
            "lp": "0.22007",
            "hp": "0.22022",
            "bv": "9156.06",
            "qv": "2015.0752650",
            "t": 373
        }
    }
}

Trade

Field Type Description
object JsonRPC notification
jsonrpc string JsonRPC version
method "t" JsonRPC method name
params object JsonRPC parameters
subscription number Subscription ID
result object Trade notification
s string Symbol name (e.g ETH-USDT)
U number Trade unixtime in ms
S "BUY" | "SELL" Trade side
p string Trade price
q string Trade volume in base quantity

Example

{
    "jsonrpc": "2.0",
    "method": "t",
    "params": {
        "subscription": 967773343367031,
        "result": {
            "s": "WBTC-USDT",
            "U": 1742296733479,
            "S": "BUY",
            "p": "82884",
            "q": "0.00012"
        }
    }
}

KLineUpdate

Field Type Description
object JsonRPC notification
jsonrpc string JsonRPC version
method "kline" JsonRPC method name
params object JsonRPC parameters
subscription number Subscription ID
result object KLine update notification
s string Symbol name (e.g ETH-USDT)
I "M1" | "M5" | "M15" | "M30" | "H1" | "H3" | "D1" KLine interval
T number Kline start unixtime in ms
op string First trade price
cp string Last trade price
lp string Lowest price
hp string Highest price
bv string Volume in base asset
qv string Volume in quote asset
t number Count of trades

Example

{
    "jsonrpc": "2.0",
    "method": "kline",
    "params": {
        "subscription": 967773343367031,
        "result": {
            "s": "WBTC-USDT",
            "I": "H1",
            "T": 1742295600000,
            "op": "82884",
            "cp": "82884",
            "lp": "82884",
            "hp": "82884",
            "bv": "0.00012",
            "qv": "9.94608",
            "t": 1
        }
    }
}
Unsubscribe
Request

Parameters

Parameter Type Description
object JsonRPC request
jsonrpc "2.0" JsonRPC version
id number JsonRPC request Id
method "unsubscribe" JsonRPC method name
params array JsonRPC params
subscription string Subscription ID

Example

echo 'unsubscribe ["4261410335241361"]' | websocat -n --jsonrpc wss://dex-ws.pepe.team/public
echo 'unsubscribe ["4261410335241361"]' | websocat -n --jsonrpc wss://dex-ws.pepe.team/public
import asyncio
import signal
from jsonrpc_websocket import Server

ws_url = "wss://dex-ws.pepe.team/public"
channels = ["ETH-USDT@t24","ETH-USDT@ob","ETH-USDT@t","ETH-USDT@kline_h1"]

def handler(subscription, result):
    print(subscription, result)

async def routine(url):
    server = Server(url)
    try:
        await server.ws_connect()
        server.t = handler
        server.t24 = handler
        server.ob = handler
        server.kline = handler
        subscribtion_id = await server.subscribe(channels)
        await asyncio.wait([asyncio.Future()])
    except asyncio.CancelledError:
        await server.unsubscribe(subscribtion_id)
    finally:
        await server.close()

event_loop = asyncio.new_event_loop()
asyncio.set_event_loop(event_loop)
main_task = asyncio.ensure_future(routine(ws_url))
event_loop.add_signal_handler(signal.SIGINT, main_task.cancel)
event_loop.add_signal_handler(signal.SIGTERM, main_task.cancel)

try:
    event_loop.run_until_complete(main_task)
finally:
    event_loop.close()
const jayson = require('jayson');

const url = "wss://dex-ws.pepe.team/public"
const channels = ["ETH-USDT@t24", "ETH-USDT@ob", "ETH-USDT@t", "ETH-USDT@kline_h1"];
const client = jayson.client.websocket({ url });

client.ws.on('open', function () {
    client.request('subscribe', [channels], () => { });
});

client.ws.on('message', console.log)
Response

Unsubscribe result

Field Type Description
object JsonRPC response
jsonrpc string JsonRPC version
id number JsonRPC request id
result boolean Subscribtion result (true - success)

Example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": true
}

Private

Endpoints

  • mainnet: wss://dex-ws.pepe.team/private
  • testnet: wss://dex-testnet-ws.pepe.team/private
Auth
Request

Parameters

Parameter Type Description
object JsonRPC request
jsonrpc "2.0" JsonRPC version
id number JsonRPC request Id
method "auth" JsonRPC method name
params array JsonRPC params
web3_id string Web3 account id
ts_ms number Signature unixtime in ms
web3_alg number Signature algorithm id
sig string Signature string (see Signature generation)
Signature data bytes:
- ts_ms
- web3_id
- web3_alg

Example

import asyncio
import signal
import time
import struct
from eth_account import Account, messages
from jsonrpc_websocket import Server

# Replace with your Ethereum private key (without "0x" prefix)
private_key = "0FBAF463D26EF8DDFA03366ACF0B42B461C2B4F816D5EEECA778E6AB1C716B6C"
account = Account.from_key(private_key)

ws_url = "wss://dex-ws.pepe.team/private"
ts_ms = int(time.time() * 1000)
web3_id = account.address
sig_alg = 2 # EVM
signature_data_bytes = struct.pack('>q', ts_ms) + bytes.fromhex(web3_id[2:]) + struct.pack('>q', sig_alg)
signed_message = account.sign_message(messages.encode_defunct(signature_data_bytes))
signature = '0x' + signed_message.signature.hex()

def handler(subscription, result):
    print(subscription, result)

async def routine(url):
    server = Server(url)
    try:
        await server.ws_connect()
        server.o = handler
        server.to = handler
        subscribtion_id = await server.auth(web3_id, ts_ms, sig_alg, signature)
        await asyncio.wait([asyncio.Future()])
    except asyncio.CancelledError:
        await server.logout(subscribtion_id)
    finally:
        await server.close()

event_loop = asyncio.new_event_loop()
asyncio.set_event_loop(event_loop)
main_task = asyncio.ensure_future(routine(ws_url))
event_loop.add_signal_handler(signal.SIGINT, main_task.cancel)
event_loop.add_signal_handler(signal.SIGTERM, main_task.cancel)

try:
    event_loop.run_until_complete(main_task)
finally:
    event_loop.close()
const jayson = require('jayson');
const ethers = require('ethers');

const privateKey = "0FBAF463D26EF8DDFA03366ACF0B42B461C2B4F816D5EEECA778E6AB1C716B6C";
const wallet = new ethers.Wallet(privateKey);

const url = "wss://dex-ws.pepe.team/private"
const tsMs = Date.now();
const web3Id = wallet.address;
const sigAlg = 2; // EVM
const messageBytes = Buffer.alloc(8 + 20 + 8); // (timestamp + address + algorithm ID)
messageBytes.writeBigInt64BE(BigInt(tsMs), 0);
Buffer.from(web3Id.slice(2), "hex").copy(messageBytes, 8);
messageBytes.writeBigInt64BE(BigInt(sigAlg), 8 + 20);
const signedMessage = wallet.signMessage(messageBytes);

(async () => {
    const client = jayson.client.websocket({ url });
    client.ws.on('open', async function () {
        client.request('auth', [web3Id, tsMs, sigAlg, await signedMessage], () => { });
    });
    client.ws.on('message', console.log)
})();
Response

New Subscription

Field Type Description
object JsonRPC response
jsonrpc string JsonRPC version
id number JsonRPC request id
result number Subscription id (needed to unsubscribe)

Example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": 6505855244401708
}
Notification

OrderUpdate

Field
Type Description
object JsonRPC notification
jsonrpc string JsonRPC version
method "o" JsonRPC method name
params object JsonRPC parameters
subscription number Subscription ID
result object Order update notification
s string Symbol name (e.g ETH-USDT)
U number Order update unixtime in ms
i string Order Id
S "BUY" | "SELL" Order side
o "LIMIT" Order type
p string Order price
q string Order quantity in base asset
st "ACCEPTED" | "PLACED" | "PARTIALLY_CANCELLED" | "CANCELLED" | "EXPIRED" | "EXPIRED_IN_MATCH" | "REJECTED" Order state

Example

{
    "jsonrpc": "2.0",
    "method": "o",
    "params": {
        "subscription": 5665783607960183,
        "result": {
            "s": "BNB-USDT",
            "U": 1742308799910,
            "i": "c54b30e9-57f2-4c1c-be04-1649677fe9d4",
            "S": "SELL",
            "o": "LIMIT",
            "p": "629.90",
            "q": "0.1747",
            "st": "PLACED"
        }
    }
}

TradedOrderUpdate

Field
Type Description
object JsonRPC notification
jsonrpc string JsonRPC version
method "to" JsonRPC method name
params object JsonRPC parameters
subscription number Subscription ID
result object Traded Order update notification
s string Symbol name (e.g ETH-USDT)
U number Order update unixtime in ms
i string Order Id
S "BUY" | "SELL" Order side
o "LIMIT" Order type
p string Order price
q string Order quantity in base asset
st "FILLED" | "PARTIALLY_FILLED" Order state
fb string Filled order quantity in base asset
fq string Filled order quantity in quote asset
ff string Filled order fee quantity in base asset
fa string Fee asset name (e.g ETH)

Example

{
    "jsonrpc": "2.0",
    "method": "to",
    "params": {
        "subscription": 4192341877843937,
        "result": {
            "s": "WBTC-USDT",
            "U": 1742313804800,
            "i": "56d720ed-0376-474c-bcee-c98d38a02f3a",
            "S": "BUY",
            "o": "LIMIT",
            "p": "81946.2",
            "q": "0.00012",
            "st": "FILLED",
            "fb": "0.00012",
            "fq": "9.833544",
            "ff": "0.00000012",
            "fa": "WBTC"
        }
    }
}
Logout
Request

Parameters

Parameter Type Description
object JsonRPC request
jsonrpc "2.0" JsonRPC version
id number JsonRPC request Id
method "logout" JsonRPC method name
params array JsonRPC params
subscription string Subscription ID

Example

echo 'logout ["4261410335241361"]' | websocat -n --jsonrpc wss://dex-ws.pepe.team/public
echo 'logout ["4261410335241361"]' | websocat -n --jsonrpc wss://dex-ws.pepe.team/public
import asyncio
import signal
import time
import struct
from eth_account import Account, messages
from jsonrpc_websocket import Server

# Replace with your Ethereum private key (without "0x" prefix)
private_key = "0FBAF463D26EF8DDFA03366ACF0B42B461C2B4F816D5EEECA778E6AB1C716B6C"
account = Account.from_key(private_key)

ws_url = "wss://dex-ws.pepe.team/private"
ts_ms = int(time.time() * 1000)
web3_id = account.address
sig_alg = 2 # EVM
signature_data_bytes = struct.pack('>q', ts_ms) + bytes.fromhex(web3_id[2:]) + struct.pack('>q', sig_alg)
signed_message = account.sign_message(messages.encode_defunct(signature_data_bytes))
signature = '0x' + signed_message.signature.hex()

def handler(subscription, result):
    print(subscription, result)

async def routine(url):
    server = Server(url)
    try:
        await server.ws_connect()
        server.o = handler
        server.to = handler
        subscribtion_id = await server.auth(web3_id, ts_ms, sig_alg, signature)
        await asyncio.wait([asyncio.Future()])
    except asyncio.CancelledError:
        await server.logout(subscribtion_id)
    finally:
        await server.close()

event_loop = asyncio.new_event_loop()
asyncio.set_event_loop(event_loop)
main_task = asyncio.ensure_future(routine(ws_url))
event_loop.add_signal_handler(signal.SIGINT, main_task.cancel)
event_loop.add_signal_handler(signal.SIGTERM, main_task.cancel)

try:
    event_loop.run_until_complete(main_task)
finally:
    event_loop.close()
const jayson = require('jayson');
const ethers = require('ethers');

const privateKey = "0FBAF463D26EF8DDFA03366ACF0B42B461C2B4F816D5EEECA778E6AB1C716B6C";
const wallet = new ethers.Wallet(privateKey);

const url = "wss://dex-ws.pepe.team/private"
const tsMs = Date.now();
const web3Id = wallet.address;
const sigAlg = 2; // EVM
const messageBytes = Buffer.alloc(8 + 20 + 8); // (timestamp + address + algorithm ID)
messageBytes.writeBigInt64BE(BigInt(tsMs), 0);
Buffer.from(web3Id.slice(2), "hex").copy(messageBytes, 8);
messageBytes.writeBigInt64BE(BigInt(sigAlg), 8 + 20);
const signedMessage = wallet.signMessage(messageBytes);

(async () => {
    const client = jayson.client.websocket({ url });
    client.ws.on('open', async function () {
        client.request('auth', [web3Id, tsMs, sigAlg, await signedMessage], () => { });
    });
    client.ws.on('message', console.log)
})();
Response

Unsubscribe result

Field Type Description
object JsonRPC response
jsonrpc string JsonRPC version
id number JsonRPC request id
result boolean Subscribtion result (true - success)

Example

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": true
}