Docs: Reya DEX REST API
This document provides comprehensive information about the trading API endpoints in the Reya DEX.
Base URL
Table of Contents
Market Information
Get Markets
Get Market by ID
Get Markets Data
Get Market Data
Get Market Orders
Get Markets Configuration
Asset and Price Information
Get Assets
Get Prices
Get Price by Asset Pair ID
Get Pool Balance
Account and Wallet Information
Get Wallet Positions
Get Wallet Conditional Orders
Get Wallet Accounts
Get Wallet Account Balances
Get Wallet Orders
Get Wallet Configuration
Fee Configuration
Get Fee Tier Parameters
Get Global Fee Parameters
Candle Data
Get Historical Candles
Market Information
Get Markets
Returns a list of all markets, with some additional information for each market.
Endpoint: GET /api/trading/markets
Parameters: None
Response Fields:
id
string
Unique identifier for the market
ticker
string
Trading pair symbol (e.g., "BTC-rUSD")
markPrice
number
Current mark price of the asset
isActive
boolean
Whether the market is currently active
maxLeverage
number
Maximum leverage allowed for this market
description
string
Description of the market
name
string
Always set to market
tickSizeDecimals
number
Number of decimal places for the tick size, e.g. 'tickSizeDecimals' 2 means tick size is 0.01
priority
number
Display priority for the market
Example Response:
Get Market by ID
Same as GetMarkets, but returns information about a specific market by its ID.
Endpoint: GET /api/trading/market/:marketId
Parameters:
marketId
: The ID of the market
Get Markets Data
Returns data for all markets.
Endpoint: GET /api/trading/marketsData
Parameters: None
Response Fields:
marketId
string
Unique identifier for the market
updatedAt
number
Timestamp of the last update, in milliseconds
longOI
number
Long open interest
shortOI
number
Short open interest
longSkewPercentage
number
Percentage of open interest that is long
shortSkewPercentage
number
Percentage of open interest that is short
openInterest
number
Total open interest
fundingRate
number
Current funding rate
last24hVolume
number
24-hour trading volume
maxAmountBaseLong
number
Maximum base amount for long positions
maxAmountBaseShort
number
Maximum base amount for short positions
maxAmountSizeLong
number
Maximum size for long positions
maxAmountSizeShort
number
Maximum size for short positions
priceChange24H
number
Absolute price change in the last 24 hours
priceChange24HPercentage
number
Percentage price change in the last 24 hours
poolPrice
number
Current pool price
oraclePrice
number
Current oracle price
pricesUpdatedAt
number
Timestamp when prices were last updated, in milliseconds
Example Response:
Get Market Data
Same as Get Markets Data, but returns data for a specific market by ID.
Endpoint: GET /api/trading/market/:marketId/data
Parameters:
marketId
(path): The ID of the market
Get Market Orders
Returns orders for a specific market.
Endpoint: GET /api/trading/market/:marketId/orders
Parameters:
marketId
(path): The ID of the marketbefore
(query, optional): Pagination parameter, unique ID to fetch orders beforeafter
(query, optional): Pagination parameter, unique ID to fetch orders afterdirection
(query, optional): Sorting direction, either 'asc' or 'desc'limit
(query, optional): Number of orders to return (default: 100, max: 100)
Response Fields:
data
array
Array of order objects
» id
string
Unique identifier for the order
» market_id
string
ID of the market
» account_id
string
ID of the account
» executed_base
string
Executed base amount of the order
» fee
string
Fee paid for the order
» price
string
Execution price of the order
» is_match_order
boolean
Whether the order was a match order
» liquidation_type
string
Type of liquidation, if applicable (e.g., "-1" if not a liquidation)
» position_base
string
Base amount of the resulting position
» position_realized_pnl
string
Realized PnL for the position
» position_last_price
string
Last price for the position
» position_last_price_timestamp
string
Timestamp of the last price for the position
» position_funding_value
string
Funding value for the position
» position_base_multiplier
string
Base multiplier for the position
» position_adl_unwind_price
string
ADL unwind price for the position
» counterparty_account_id
string
Account ID of the counterparty
» counterparty_base
string
Base amount for the counterparty
» counterparty_realized_pnl
string
Realized PnL for the counterparty
» counterparty_last_price
string
Last price for the counterparty
» counterparty_last_price_timestamp
string
Timestamp of the last price for the counterparty
» counterparty_funding_value
string
Funding value for the counterparty
» counterparty_base_multiplier
string
Base multiplier for the counterparty
» counterparty_adl_unwind_price
string
ADL unwind price for the counterparty
» transaction_hash
string
Hash of the transaction
» block_timestamp
string
Timestamp of the block
» block_number
string
Number of the block
» unique_id
number
Unique sequential ID for the order event
» created_at
string
Creation timestamp (ISO 8601 format)
meta
object
Metadata for the order list
» limit
number
Number of orders requested per page
» count
number
Number of orders returned in the current response
» before
string
Cursor to fetch orders before this unique_id
» after
string
Cursor to fetch orders after this unique_id
Example Response:
Get Markets Configuration
Returns configuration information for all markets.
Endpoint: GET /api/trading/markets/configuration
Parameters: None
Response Fields:
market_id
string
Unique identifier for the market configuration
risk_matrix_index
string
Index in the risk matrix
max_open_base
string
Maximum open base amount
velocity_multiplier
string
Velocity multiplier for the market
minimum_order_base
string
Minimum order base amount
base_spacing
string
Spacing for base amounts
price_spacing
string
Spacing for prices
oracle_node_id
string
Node ID for the oracle
mtm_window
string
Mark-to-Market (MTM) window in milliseconds
dutch_config_lambda
string
Lambda parameter for Dutch auction configuration
dutch_config_min_base
string
Minimum base for Dutch auction configuration
slippage_params_phi
string
Phi parameter for slippage
slippage_params_beta
string
Beta parameter for slippage
depth_factor
string
Depth factor for the market
max_exposure_factor
string
Maximum exposure factor
max_p_slippage
string
Maximum price slippage allowed
price_spread
string
Price spread for the market
volatility_index_multiplier
string
Multiplier for the volatility index
block_timestamp
string
Timestamp of the block when the configuration was recorded
block_number
string
Number of the block when the configuration was recorded
unique_id
number
Unique sequential ID for the configuration event
Example Response:
Asset and Price Information
Get Assets
Returns all assets supported by the platform.
Endpoint: GET /api/trading/assets
Response Fields:
address
string
Contract address of the asset
name
string
Full name of the asset
short
string
Short symbol for the asset
createdAt
string
Timestamp when the asset was created
updatedAt
string
Timestamp when the asset was last updated
asset_price_contract_id
string
Contract ID for asset price
asset_price_usdc_contract_id
string
Contract ID for asset price in USDC
decimals
number
Number of decimals for the asset
Example Response:
Get Prices
Returns current prices for all symbols.
Endpoint: GET /api/trading/prices
Response Fields:
marketId
number
ID of the market
oraclePrice
string
Price from oracle
poolPrice
string
Price from pool
price
string
Current price
updatedAt
number
Timestamp of the last update
Example Response:
Get Price by Asset Pair ID
Same as Get Prices, but returns price information for a specific asset pair.
Endpoint: GET /api/trading/prices/:assetPairId
Parameters:
assetPairId
(path): Identifier of the asset pair (e.g., ETHUSDMARK)
Get Pool Balance
Returns the balance information for a specific pool.
Endpoint: GET /api/trading/poolBalance/:poolId
Parameters:
poolId
(path): Identifier of the pool
Response Fields:
id
number
Unique identifier for the pool balance entry
pool_id
number
ID of the pool
timestamp
number
Timestamp of the balance record
value
string
Current value of the pool
apy
string
Annual percentage yield
share_price
string
Price per share
share_price_index
string
Share price index
Example Response:
Fee Configuration
Get Fee Tier Parameters
Returns parameters for all fee tiers.
Endpoint: GET /api/trading/feeTierParameters
Response Fields:
tier_id
string
ID of the fee tier
taker_fee
string
Fee applied to takers
maker_fee
string
Fee applied to makers
volume
string
Volume threshold for the tier
Example Response:
Get Global Fee Parameters
Returns global fee parameters for the platform.
Endpoint: GET /api/trading/globalFeeParameters
Response Fields:
og_discount
string
Discount for OG users
referee_discount
string
Discount for referees
referrer_rebate
string
Rebate for referrers
affiliate_referrer_rebate
string
Rebate for affiliate referrers
Example Response:
Account and Wallet Information
Get Wallet Positions
Returns all positions for a wallet.
Endpoint: GET /api/trading/wallet/:address/positions
Parameters:
address
(path): Wallet address
Response Fields:
market_id
string
Identifier for the market
account_id
string
Identifier for the account
base
string
Base amount of the position
quote
string
Quote amount of the position
leverage_hi
number
High leverage value
leverage_lo
number
Low leverage value
is_long
boolean
Whether the position is long
updated_block_number
string
Block number of the last update
updated_timestamp_ms
string
Timestamp of the last update (in milliseconds)
is_auto_exchange
boolean
Whether auto exchange is enabled
liquid_price
number
Liquidation price
mark_price
number
Current mark price
pnl
number
Profit and loss
pnl_perc
number
Profit and loss percentage
entry_price
number
Entry price of the position
leverage
number
Current leverage
unrealized_funding
number
Unrealized funding amount
Example Response:
Get Wallet Conditional Orders
Returns all pending conditional orders for a wallet.
Endpoint: GET /api/trading/wallet/:address/conditionalOrders
Parameters:
address
(path): Wallet address
Response Fields:
id
string
Unique identifier for the order
account_id
string
Identifier for the account
market_id
string
Identifier for the market
order_type
string
Type of order (e.g., "Limit Order")
is_long
boolean
Whether the position is long
trigger_price
number
Price at which the order is triggered
order_base
string
Base amount of the order
exchange_id
number
Exchange identifier
inputs
string
Order inputs in hex format
counterparty_account_id
number
Counterparty account ID
reya_chain_id
number
Reya chain identifier
deadline
number
Order deadline timestamp
signer_address
string
Address of the signer
nonce
string
Unique nonce for the order
signature
string
Cryptographic signature
status
string
Current status of the order (e.g., "pending")
creation_timestamp_ms
number
Creation timestamp (in milliseconds)
last_update_timestamp_ms
number
Last update timestamp (in milliseconds)
transaction_hash
string
Hash of the transaction, or null if not yet processed
Example Response:
Get Wallet Account Balances
Return balances for a all accounts belonging to a wallet
Endpoint: GET /api/trading/wallet/:address/accounts/balances
Parameters:
address
(path): Wallet address
Response Fields:
account_id
string
Identifier for the account
collateral
string
Collateral address
balance
number
balance
Example Response:
Get Wallet Configuration
Returns configuration for a specific account owner.
Endpoint: GET /api/trading/wallet/:address/configuration
Parameters:
address
(path): Wallet address
Response Fields:
tier_id
string
ID of the fee tier
og_status
boolean
Status of OG users
referee_status
boolean
Status of referees
affiliate_status
boolean
Status of affiliates
main_account_id
string
ID of the main account
Example Response:
Get Wallet Orders
Returns all orders for a wallet, with pagination.
Endpoint: GET /api/trading/wallet/:address/orders
Parameters:
address
(path): Wallet addresslimit
(query, optional): Number of orders to return (default: 100)before
(query, optional): Return orders before this ID for paginationafter
(query, optional): Return orders after this ID for pagination
Response Fields:
data
array
Array of order objects
» id
string
Unique identifier for the order
» market_id
string
Identifier for the market
» account_id
string
Identifier for the account
» executed_base
string
Base amount executed
» fee
string
Fee paid for the order
» price
string
Order price
» is_match_order
boolean
Whether the order is a match order
» liquidation_type
string
Type of liquidation, if applicable (e.g., "-1" if not a liquidation)
» position_base
string
Position base amount after the order
» position_realized_pnl
string
Realized PnL for the position after this order
» position_last_price
string
Last price for the position after this order
» position_last_price_timestamp
string
Timestamp of the last price for the position
» position_funding_value
string
Funding value for the position
» position_base_multiplier
string
Base multiplier for the position
» position_adl_unwind_price
string
ADL unwind price for the position
» counterparty_account_id
string
Account ID of the counterparty
» counterparty_base
string
Base amount for the counterparty
» counterparty_realized_pnl
string
Realized PnL for the counterparty
» counterparty_last_price
string
Last price for the counterparty
» counterparty_last_price_timestamp
string
Timestamp of the last price for the counterparty
» counterparty_funding_value
string
Funding value for the counterparty
» counterparty_base_multiplier
string
Base multiplier for the counterparty
» counterparty_adl_unwind_price
string
ADL unwind price for the counterparty
» transaction_hash
string
Hash of the transaction
» block_timestamp
string
Timestamp of the block
» block_number
string
Block number
» unique_id
number
Unique identifier for the event
» created_at
string
Creation timestamp
meta
object
Metadata for pagination
» limit
number
Number of results returned
» count
number
Total count of results in this batch
» before
number
ID to use for fetching previous page
» after
number
ID to use for fetching next page
Example Response:
Candle Data
Get Historical Candles
Returns historical candle data for a specific asset pair and resolution.
Endpoint: GET /candles/:assetPairId/:resolution
Path Parameters:
assetPairId
string
The ID of the asset pair (e.g., "ETH-rUSD")
resolution
string
The candle resolution (e.g., "1", "5", "15", "60", "240", "1D")
Query Parameters:
from
number
Optional. Unix timestamp (in seconds) for the start of the historical data range. Defaults to 200 candles back from to
if to
is provided, or 200 candles back from now.
to
number
Optional. Unix timestamp (in seconds) for the end of the historical data range. Defaults to the current time.
Response Fields:
t
number[]
Array of timestamps for each candle (epoch seconds)
o
number[]
Array of opening prices for each candle
h
number[]
Array of highest prices for each candle
l
number[]
Array of lowest prices for each candle
c
number[]
Array of closing prices for each candle
Example Response:
Last updated