Market Data - Public

GET /v3/markets

Get a list of markets by OX.FUN.

chevron-rightCurlhashtag

chevron-rightPythonhashtag
import requests

def fetch_market_data():
    market_code = 'BTC-USD-SWAP-LIN'
    url = f'https://api.ox.fun/v3/markets?marketCode={market_code}'

    try:
        response = requests.get(url)
        response.raise_for_status()  # Raise an error for bad responses
        print('Market Data:', response.json())
    except requests.exceptions.RequestException as error:
        print('Error fetching market data:', error)

fetch_market_data()
chevron-rightJavascripthashtag
const axios = require('axios');

async function fetchMarketData() {
  const marketCode = 'BTC-USD-SWAP-LIN';
  const url = `https://api.ox.fun/v3/markets?marketCode=${marketCode}`;

  try {
    const response = await axios.get(url);
    console.log('Market Data:', response.data);
  } catch (error) {
    console.error('Error fetching market data:', error.response ? error.response.data : error.message);
  }
}

fetchMarketData();
Request Parameter
Type
Required
Description

marketCode

STRING

YES

Response Field
Type
Description

marketCode

STRING

Market Code

name

STRING

Name of the contract

referencePair

STRING

Reference pair

base

STRING

Base asset

counter

STRING

Counter asset

type

STRING

Type of the contract

tickSize

STRING

Tick size of the contract

minSize

STRING

Minimum tradable quantity and quantity increment

listedAt

STRING

Listing date of the contract

settlementAt

STRING

Timestamp of settlement if applicable i.e. Quarterlies and Spreads

upperPriceBound

STRING

Sanity bound

lowerPriceBound

STRING

Sanity bound

markPrice

STRING

Mark price

indexPrice

STRING

index price

lastUpdatedAt

STRING

GET /v3/assets

Get a list of assets supported by OX.FUN

chevron-rightCurlhashtag

Request

Successful response format

chevron-rightPythonhashtag
chevron-rightJavascripthashtag
Request Parameter
Type
Required
Description

asset

STRING

YES

Asset name

Response Field
Type
Description

asset

STRING

Asset name

isCollateral

BOOL

Indicates if the asset can be used as collateral to trade perps

loanToValue

STRING

Ignore

loanToValueFactor

STRING

Ignore

networkList

LIST

List of dictionaries

network

STRING

Network for deposit and withdrawal

tokenId

STRING

Token ID

transactionPrecision

STRING

Precision for the transaction

isWithdrawalFeeChargedToUser

BOOL

Indicates if there is a withdrawal fee

canDeposit

BOOL

Indicates can deposit or not

canWithdraw

BOOL

Indicates can withdraw or not

minDeposit

STRING

Minimum deposit amount

minWithdrawal

STRING

Minimum withdrawal amount

GET /v3/tickers

Get tickers.

chevron-rightCurlhashtag

Request

Successful response format

chevron-rightPythonhashtag
chevron-rightJavascripthashtag

Request Parameter
Type
Required
Description

marketCode

STRING

NO

Market code

Response Field
Type
Description

marketCode

STRING

Market code

markPrice

STRING

Mark price

open24h

STRING

Rolling 24 hour opening price

high24h

STRING

Rolling 24 hour highest price

low24h

STRING

Rolling 24 hour lowest price

volume24h

STRING

Rolling 24 hour notional trading volume in OX terms

currencyVolume24h

STRING

Rolling 24 hour trading volume in Contracts

openInterest

STRING

Open interest in Contracts

lastTradedPrice

STRING

Last traded price

lastTradedQuantity

STRIN

Last traded quantity

lastUpdatedAt

STRING

Millisecond timestamp of lastest update

GET /v3/funding/estimates

chevron-rightCurlhashtag

Request

Successful response format

chevron-rightPythonhashtag
chevron-rightJavascripthashtag

Request Parameter
Type
Required
Description

marketCode

STRING

NO

Market code

Response Field
Type
Description

marketCode

STRING

Market code

estFundingRate

STRING

Estimates funding rate

fundingAt

STRING

Millisecond timestamp

GET /v3/candles

Get candles.

chevron-rightCurlhashtag

Request

Successful response format

chevron-rightPythonhashtag
chevron-rightJavascripthashtag
Request Parameter
Type
Required
Description

marketCode

STRING

YES

Market code

timeframe

STRING

NO

Available values: 60s,300s,900s,1800s,3600s,7200s,14400s,86400s, default is 3600s

limit

LONG

NO

Default 200, max 500

startTime

LONG

NO

Millisecond timestamp. Default 24 hours ago. startTime and endTime must be within 7 days of each other. startTime is INCLUSIVE

endTime

LONG

NO

Millisecond timestamp. Default time now. startTime and endTime must be within 7 days of each other. endTime is INCLUSIVE

Response Field
Type
Description

timeframe

STRING

Available values: 60s,300s,900s,1800s,3600s,7200s,14400s,86400s

open

STRING

Opening price

high

STRING

Highest price

low

STRING

Lowest price

close

STRING

Closing price

volume

STRING

Trading volume in OX terms

currencyVolume

STRING

Trading volume in Contract terms

openedAt

STRING

Millisecond timestamp of the candle open

GET /v3/depth

Get depth.

chevron-rightCurlhashtag

Request

Successful response format

chevron-rightPythonhashtag
chevron-rightJavascripthashtag

Request Parameter
Type
Required
Description

marketCode

STRING

YES

Market code

level

LONG

NO

Default 5, max 100

Response Field
Type
Description

level

LONG

Level

marketCode

STRING

Market code

lastUpdatedAt

STRING

Millisecond timestamp of the lastest depth update

asks

LIST of floats

Sell side depth: [price, quantity]

bids

LIST of floats

Buy side depth: [price, quantity]

GET /v3/markets/operational

Get markets operational.

chevron-rightCurlhashtag

Request

Successful response format

chevron-rightPythonhashtag
chevron-rightJavascripthashtag
Request Parameter
Type
Required
Description

marketCode

STRING

YES

Market code

Response Field
Type
Description

marketCode

STRING

Market code

operational

BOOL

whether the market of the marketCode is operational

GET /v3/exchange-trades

chevron-rightCurlhashtag

Request

Successful response format

chevron-rightPythonhashtag
chevron-rightJavascripthashtag
Request Parameter
Type
Required
Description

marketCode

STRING

NO

Market code

limit

LONG

NO

Default 200, max 500

startTime

LONG

NO

Millisecond timestamp. Default 24 hours ago. startTime and endTime must be within 7 days of each other. startTime is INCLUSIVE

endTime

LONG

NO

Millisecond timestamp. Default time now. startTime and endTime must be within 7 days of each other. endTime is INCLUSIVE

Response Field
Type
Description

marketCode

STRING

matchPrice

STRING

matchQuantity

STRING

side

STRING

matchType

STRING

matchedAt

STRING

GET /v3/funding/rates

Get all historical funding rates

chevron-rightCurlhashtag

Request

Successful response format

chevron-rightPythonhashtag
chevron-rightJavascripthashtag

Request Parameter
Type
Required
Description

marketCode

STRING

NO

Market code

limit

LONG

NO

Default 200, max 500

startTime

LONG

NO

Millisecond timestamp. Default 24 hours ago. startTime and endTime must be within 7 days of each other. startTime is INCLUSIVE

endTime

LONG

NO

Millisecond timestamp. Default time now. startTime and endTime must be within 7 days of each other. endTime is INCLUSIVE

Response Field
Type
Description

marketCode

STRING

Market code

fundingRate

STRING

Funding rate

createdAt

STRING

Millisecond timestamp

GET /v3/leverage/tiers

Get markets leverage tiers

chevron-rightCurlhashtag

Request

Successful response format

chevron-rightPythonhashtag
chevron-rightJavascripthashtag
Request Parameter
Type
Required
Description

marketCode

STRING

NO

Market code

Response Field
Type
Description

marketCode

STRING

Market code

tier

STRING

Leverage tier

leverage

STRING

Market leverage

positionFloor

STRING

The lower position limit

positionCap

STRING

The upper position limit

initialMargin

STRING

Initial margin

maintenanceMargin

STRING

Maintenance margin

Last updated