Base URL
https://exchange.jogeshwar.xyz/backend/api/v1
All endpoints are prefixed with this base URL.
Market Data Endpoints
Get Order Book Depth
Retrieve the current order book depth for a specific market.
Market symbol (e.g., SOL_USDC, SOL_USDC)
Example Request:
import { getDepth } from './utils/requests';
const depth = await getDepth('SOL_USDC');
Response:
Array of bid orders as [price, quantity] pairs
Array of ask orders as [price, quantity] pairs
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
Fetch recent trade history for a specific market.
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.
True if the buyer was the maker (placed limit order first)
Base asset quantity traded
Quote asset quantity (price × quantity)
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
Retrieve OHLCV (Open, High, Low, Close, Volume) candlestick data for charting.
Market symbol (e.g., SOL_USDC, SOL_USDC)
Candlestick interval (e.g., 1m, 5m, 1h, 1d)
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.
Opening price for the period
Highest price during the period
Lowest price during the period
Closing price for the period
Quote asset volume traded
Candlestick period start time
Candlestick period end time
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
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.
Price at the start of the 24-hour period
Current/last traded price
Highest price in 24 hours
Absolute price change in 24 hours
Price change percentage in 24 hours
Base asset volume in 24 hours
Quote asset volume in 24 hours
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
Place a new limit order on the exchange.
Request Body:
Market symbol (e.g., SOL_USDC)
Order quantity in base asset
Limit price for the order
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.
User Management
Create User
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 of the user creation request
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);
}