Skip to main content

Base URL

https://exchange.jogeshwar.xyz/backend/api/v1
All endpoints are prefixed with this base URL.

Market Data Endpoints

Get Order Book Depth

GET /depth
Retrieve the current order book depth for a specific market.
symbol
string
required
Market symbol (e.g., SOL_USDC, SOL_USDC)
Example Request:
import { getDepth } from './utils/requests';

const depth = await getDepth('SOL_USDC');
Response:
bids
[string, string][]
Array of bid orders as [price, quantity] pairs
asks
[string, string][]
Array of ask orders as [price, quantity] pairs
lastUpdateId
string
Last update identifier for the order book
{
  "bids": [
    ["50000.00", "0.5"],
    ["49999.00", "1.2"],
    ["49998.00", "0.8"]
  ],
  "asks": [
    ["50001.00", "0.3"],
    ["50002.00", "1.5"],
    ["50003.00", "2.0"]
  ],
  "lastUpdateId": "12345678"
}

Get Recent Trades

GET /trades
Fetch recent trade history for a specific market.
symbol
string
required
Market symbol (e.g., SOL_USDC, SOL_USDC)
Example Request:
import { getTrades } from './utils/requests';

const trades = await getTrades('SOL_USDC');
Response: Returns an array of Trade objects.
id
number
Unique trade identifier
isBuyerMaker
boolean
True if the buyer was the maker (placed limit order first)
price
string
Trade execution price
quantity
string
Base asset quantity traded
quoteQuantity
string
Quote asset quantity (price × quantity)
timestamp
number
Unix timestamp in milliseconds
[
  {
    "id": 123456,
    "isBuyerMaker": true,
    "price": "50000.00",
    "quantity": "0.5",
    "quoteQuantity": "25000.00",
    "timestamp": 1678901234567
  },
  {
    "id": 123457,
    "isBuyerMaker": false,
    "price": "50001.00",
    "quantity": "0.3",
    "quoteQuantity": "15000.30",
    "timestamp": 1678901234890
  }
]

Get Candlestick Data

GET /klines
Retrieve OHLCV (Open, High, Low, Close, Volume) candlestick data for charting.
symbol
string
required
Market symbol (e.g., SOL_USDC, SOL_USDC)
interval
string
required
Candlestick interval (e.g., 1m, 5m, 1h, 1d)
startTime
number
required
Start time in Unix timestamp (milliseconds)
Example Request:
import { getKlines } from './utils/requests';

const startTime = Date.now() - 24 * 60 * 60 * 1000; // 24 hours ago
const klines = await getKlines('SOL_USDC', '1h', startTime);
The response is automatically sorted by end time in ascending order.
Response: Returns an array of KLine objects.
open
string
Opening price for the period
high
string
Highest price during the period
low
string
Lowest price during the period
close
string
Closing price for the period
volume
string
Base asset volume traded
quoteVolume
string
Quote asset volume traded
start
string
Candlestick period start time
end
string
Candlestick period end time
trades
string
Number of trades in this period
[
  {
    "open": "50000.00",
    "high": "50500.00",
    "low": "49800.00",
    "close": "50200.00",
    "volume": "125.5",
    "quoteVolume": "6287500.00",
    "start": "1678901200000",
    "end": "1678904800000",
    "trades": "1234"
  }
]

Get All Market Tickers

GET /tickers
Retrieve 24-hour ticker statistics for all markets. Example Request:
import { getTickers } from './utils/requests';

const tickers = await getTickers();
Response: Returns an array of Ticker objects.
symbol
string
Market symbol
firstPrice
string
Price at the start of the 24-hour period
lastPrice
string
Current/last traded price
high
string
Highest price in 24 hours
low
string
Lowest price in 24 hours
priceChange
string
Absolute price change in 24 hours
priceChangePercent
string
Price change percentage in 24 hours
volume
string
Base asset volume in 24 hours
quoteVolume
string
Quote asset volume in 24 hours
trades
string
Number of trades in 24 hours
[
  {
    "symbol": "SOL_USDC",
    "firstPrice": "49500.00",
    "lastPrice": "50200.00",
    "high": "50500.00",
    "low": "49200.00",
    "priceChange": "700.00",
    "priceChangePercent": "1.41",
    "volume": "1234.56",
    "quoteVolume": "61728000.00",
    "trades": "45678"
  },
  {
    "symbol": "SOL_USDC",
    "firstPrice": "3000.00",
    "lastPrice": "3050.00",
    "high": "3100.00",
    "low": "2980.00",
    "priceChange": "50.00",
    "priceChangePercent": "1.67",
    "volume": "5678.90",
    "quoteVolume": "17320000.00",
    "trades": "23456"
  }
]

Get Specific Market Ticker

GET /ticker (via getTicker helper)
Retrieve 24-hour ticker statistics for a specific market.
This is a helper function that fetches all tickers and filters for the requested market. The backend endpoint is /tickers.
Example Request:
import { getTicker } from './utils/requests';

const ticker = await getTicker('SOL_USDC');
Response: Returns a single Ticker object with the same structure as shown in the /tickers endpoint above.

Trading Endpoints

Create Order

POST /order
Place a new limit order on the exchange. Request Body:
market
string
required
Market symbol (e.g., SOL_USDC)
side
string
required
Order side: buy or sell
quantity
number
required
Order quantity in base asset
price
number
required
Limit price for the order
user_id
string
required
User identifier for authentication
Example Request:
import { createOrder } from './utils/requests';

const order = {
  market: 'SOL_USDC',
  side: 'buy',
  quantity: 0.5,
  price: 50000,
  userId: 'user-123'
};

const orderId = await createOrder(order);
Response: Returns the created order ID as a string.
"order-abc123def456"

User Management

Create User

POST /users
Create a new user account and receive a unique user ID. Example Request:
import { createUser } from './utils/requests';

const userResponse = await createUser();
console.log('User ID:', userResponse.user_id);
Response:
status
string
Status of the user creation request
user_id
string
Unique identifier for the created user
{
  "status": "success",
  "user_id": "user-abc123def456"
}

Error Handling

All endpoints use standard HTTP status codes:
  • 200 - Success
  • 400 - Bad Request (invalid parameters)
  • 404 - Not Found (market/resource doesn’t exist)
  • 500 - Internal Server Error
Error Response Example:
{
  "error": "Market not found",
  "message": "No ticker found for INVALID_MARKET"
}
Implementation:
try {
  const ticker = await getTicker('SOL_USDC');
  console.log(ticker);
} catch (error) {
  console.error('API Error:', error.message);
}

Build docs developers (and LLMs) love