๐Ÿ‹
Moby
  • Letโ€™s Get Started
    • ๐Ÿ‹ About Moby
    • โšก Our Vision
    • ๐Ÿค“ Your Guidebook
      • Get Setup
        • Connect Wallet
        • Trade Options
        • 0DTE Options
        • Provide Liquidity
      • Fees & Instruments
        • Fee Generation
        • Fee Distribution
        • Instruments
      • Testnet
  • How itโ€™s Built
    • ๐Ÿš€ Synchronized Liquidity Engine (SLE)
    • ๐Ÿงฎ Options Pricing Model
      • Mark Price
        • Futures Index
        • Implied Volatility
      • Risk Premium
        • Deriving Greeks
        • Risk Premium Calculation
        • Risk Managing Mechanism
    • ๐Ÿค– Architecture
      • Liquidity Provision Mechanism
      • Options Listing Standard
      • How to Open / Close / Settle Position
      • Synchronized Liquidity Engine (SLE)
      • Options Position Tokens
      • Tools to Maximize Capital Efficiency
    • โš™๏ธ Key Features
      • High Leverage & Limited Risk with No Liquidation
      • Narrow Spread with Dynamic Risk Premium
      • Guaranteed Settlement
      • Capital Efficiency Improvements with Combo Options
      • Even Higher Capital Efficiency with Clearing House
      • Abundant Liquidity for All Options
      • Composable Options for Structured Products
      • High Profitability for LPs
      • Real-Time Automatically Hedged OLP
      • Upcoming Features
    • โ›“ DeFi Options Vault
      • ๐Ÿป Berachain DeFi Options Vault
        • ๐Ÿ”’ Architecture
        • ๐Ÿ“ˆ Options Strategy
  • How itโ€™s Driven
    • ๐Ÿ›ก๏ธ Building the Safest DeFi Protocol
      • Safety Features
      • Smart Contract Audit & Real-Time Security Monitoring
    • ๐Ÿ› Backed by Decentralized Governance
      • Governance
    • ๐ŸŒ Led by the Best Partners & Community
      • Arbitrum X Moby
      • Engagement Programs
  • Need More Info?
    • ๐Ÿ“š Resource Library
      • Developer Resources & Educational Contents
      • Terms & Conditions
      • Glossary
      • FAQ
  • Developers
    • Moby Traders API
      • REST API
        • General
        • Account
        • Market
    • Trade Scripts
      • Prerequisites
      • Open Positions
      • Close Positions
    • Interfaces & ABI
      • PositionManager.sol
      • SettleManager.sol
      • RewardRouterV2.sol
      • OptionsMarket.sol
    • Appendix 1: Parameters for Open/Close Options
    • Appendix 2: the Diff between optionId and optionTokenId
    • Appendix 3: Sample Moby Contract Module for Developers
Powered by GitBook
On this page
  • GET all
  • GET Spot Price
  • GET instrumentList
  • GET instrument
  • GET Forecast Execution Price for Buy Position
  • GET Forecast Execution Price for Sell Position
  • GET Option ID by Instrument
  • GET A list of Instruments by Option ID
  • GET optionTokenId by Instrument Name
  • GET A list of Instruments by optionTokenId
  1. Developers
  2. Moby Traders API
  3. REST API

Market

GET all

GET /v1/market/all

Fetch all market data used in Moby.

Query Examples

curl --request GET \
     --url https://api.moby.trade/v1/market/all \
     --header 'accept: application/json' \
     --header 'content-type: application/json'
import axios from 'axios';

async function sendRequest() {
  try {
    const response = await axios.get('https://api.moby.trade/v1/market/all', {
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });
    console.log(response.data);
  } catch (error) {
    console.error('Error fetching market data:', error);
  }
}

sendRequest();
import requests

def send_request():
    url = 'https://api.moby.trade/v1/market/all'
    headers = {
        'accept': 'application/json',
        'content-type': 'application/json'
    }

    response = requests.get(url, headers=headers)
    print(response.json())

send_request()
async function sendRequest() {
  try {
    const response = await fetch('https://api.moby.trade/v1/market/all', {
      method: 'GET',
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });
    const data = await response.json();
    console.log(data);
  } catch (error) {
    console.error('Error fetching market data:', error);
  }
}

sendRequest();

Response Examples

{
    "market": {
        "BTC": {
            "expiries": [...],
            "options": {...}
        },
        "ETH": {
            "expiries": [...],
            "options": {...}
        }
    },
    "futuresIndices": {...},
    "riskFreeRates": {...},
    "olpStats": {...},
    "options": {...},
    "olpGreeks": {...},
    "olpAssetAmounts": {...},
    "olpUtilityRatio": {...}
}

Properties in the Response

Name
Type
Description

market

Object

Contains market data for various cryptocurrencies.

market.BTC

Object

Contains data related to Bitcoin (BTC) market.

market.BTC.expiries

Array

An array of expiry dates for BTC options.

market.BTC.options

Object

Contains BTC options data.

market.ETH

Object

Contains data related to Ethereum (ETH) market. Structure of object is same as BTC.

futuresIndices

Object

The value of futures index regarding underlying assets.

riskFreeRates

Object

Risk-free rates corresponding all active options' each underlying asset and its expiry

olpStats

Object

Contains OLP (Option Liquidity Pool) statistics: greeks, assetAmounts, and utilityRatio for each vault.

options

Object

Contains all active and inactive instrument data.

olpGreeks

Object

Contains Greek metrics (e.g., delta, gamma) for each OLP.

olpAssetAmounts

Object

Contains the utilizedAmount, availableAmount, depositedAmount of all underlying assets and vault in OLP.

olpUtilityRatio

Object

Calculate the sum of all utilizedAsset and depositedAsset amounts in USD to display utilizedUsd and depositedUsd for each OLP

GET Spot Price

GET /v1/market/spotPrice

Fetch spot prices of all supported underlying asset in Moby.

Query Examples

curl --request GET \
     --url https://api.moby.trade/v1/market/spotPrice \
     --header 'accept: application/json' \
     --header 'content-type: application/json'
import axios from 'axios';

async function sendRequest() {
  try {
    const response = await axios.get('https://api.moby.trade/v1/market/spotPrice', {
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });

    console.log(response.data);
  } catch (error) {
    console.error('Error fetching spot price:', error);
  }
}

sendRequest();
import requests

def send_request():
    url = 'https://api.moby.trade/v1/market/spotPrice'
    headers = {
        'accept': 'application/json',
        'content-type': 'application/json'
    }

    response = requests.get(url, headers=headers)
    print(response.json())

send_request()
async function sendRequest() {
  try {
    const response = await fetch('https://api.moby.trade/v1/market/spotPrice', {
      method: 'GET',
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });
    const data = await response.json();
    console.log(data);
  } catch (error) {
    console.error('Error fetching spot price:', error);
  }
}

sendRequest();

Response Examples

{
    "BTC": 59185.00333333333,
    "btc": 59185.00333333333,
    "ETH": 3110.6466666666665,
    "eth": 3110.6466666666665,
    "USDC": 1.0000666666666667,
    "usdc": 1.0000666666666667
}

GET instrumentList

GET /v1/market/instrumentList

Fetch the name of all active and inactive instruments.

Path Parameters

Name
Type
Description

instrument_name*

String

The name of instrument which is active. You can query the list of instrument_name via here.

Query Examples

curl --request GET \
     --url https://api.moby.trade/v1/market/instrumentList \
     --header 'accept: application/json' \
     --header 'content-type: application/json'
import axios from 'axios';

async function sendRequest() {
  try {
    const response = await axios.get('https://api.moby.trade/v1/market/instrumentList', {
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });

    console.log(response.data);
  } catch (error) {
    console.error('Error fetching instrument list:', error);
  }
}

sendRequest();
import requests

def send_request():
    url = 'https://api.moby.trade/v1/market/instrumentList'
    headers = {
        'accept': 'application/json',
        'content-type': 'application/json'
    }

    response = requests.get(url, headers=headers)
    print(response.json())

send_request()
async function sendRequest() {
  try {
    const response = await fetch('https://api.moby.trade/v1/market/instrumentList', {
      method: 'GET',
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });
    const data = await response.json();
    console.log(data);
  } catch (error) {
    console.error('Error fetching instrument list:', error);
  }
}

sendRequest();

Response Examples

{
    "instruments": {
        "active": [...],
        "inactive": [...]
    },
    "updatedAt": 1720575152781
}

GET instrument

GET /v1/market/instrument/{instrument_name}

Fetch the information of certain instrument by its name.

Path Parameters

Name
Type
Description

instrument_name*

String

The name of instrument which is active. You can query the list of instrument_name via here.

Query Examples

curl --request GET \
     --url https://api.moby.trade/v1/market/instrument/BTC-10JUL24-57500-P \
     --header 'accept: application/json' \
     --header 'content-type: application/json'
import axios from 'axios';

const url = 'https://moby-data.s3.ap-northeast-2.amazonaws.com/market-data.json';
const headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
};

axios.get(url, { headers })
  .then(response => {
    console.log(response.data);
  })
  .catch(error => {
    console.error('Error:', error);
  });
import requests

url = 'https://moby-data.s3.ap-northeast-2.amazonaws.com/market-data.json'
headers = {
    'accept': 'application/json',
    'content-type': 'application/json'
}

response = requests.get(url, headers=headers)
print(response.text)
const url = 'https://moby-data.s3.ap-northeast-2.amazonaws.com/market-data.json';
const headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/json'
};

fetch(url, { method: 'GET', headers })
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));

Response Examples

{
    "optionId": "0x000100668e3f8000000000e09c00000000000000000000000000000000000000",
    "strikePrice": 57500,
    "markIv": 0.4763663587432049,
    "markPrice": 133.64147670623424,
    "riskPremiumRateForBuy": 0.00030108891800288804,
    "riskPremiumRateForSell": 0.013620006349789781,
    "delta": -0.2851112950414407,
    "gamma": 0.0004545865894053803,
    "vega": 5.324574907963104,
    "theta": -474.02275519292436,
    "isActive": true
}

GET Forecast Execution Price for Buy Position

GET /v1/market/forecastExecutionPrice/buy

Keep in mind that the forecasted value is dynamic, so the actual value may differ at the time of trade.

Estimate the execution price for a specific instrument and option contract size for buying position.

Query Parameters

Name
Type
Description

instrument*

String

The name of instrument which is active. You can query the list of instrument_name via here.

size*

number

The amount of option contracts that you want to buy

Query Examples

curl --request GET \
     --url https://api.moby.trade/v1/market/forecastExecutionPrice/buy?instrument=BTC-19JUL24-66000-P&size=3 \
     --header 'accept: application/json' \
     --header 'content-type: application/json'
import axios from 'axios';

async function sendRequest() {
  try {
    const response = await axios.get('https://api.moby.trade/v1/market/forecastExecutionPrice/buy', {
      params: {
        instrument: 'BTC-19JUL24-66000-P',
        size: 3
      },
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });

    console.log(response.data);
  } catch (error) {
    console.error('Error fetching forecast execution price:', error);
  }
}

sendRequest();
import requests

def send_request():
    url = 'https://api.moby.trade/v1/market/forecastExecutionPrice/sell'
    headers = {
        'accept': 'application/json',
        'content-type': 'application/json'
    }
    params = {
        'instrument': 'BTC-19JUL24-66000-P',
        'size': 3
    }

    response = requests.get(url, headers=headers, params=params)
    print(response.json())

send_request()
async function sendRequest() {
  try {
    const response = await fetch('https://api.moby.trade/v1/market/forecastExecutionPrice/buy?instrument=BTC-19JUL24-66000-P&size=3', {
      method: 'GET',
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });
    const data = await response.json();
    console.log(data);
  } catch (error) {
    console.error('Error fetching forecast execution price:', error);
  }
}

sendRequest();

Response Examples

You can estimate the risk premium(RP) and total execution prices through the response.

{
    "RP_rate": 0.0030122401844937335,
    "G0_delta": -3.076047014405784,
    "G0_vega": 146.31805031870834,
    "G0_theta": -444.33322715213035,
    "G1_delta": -1.4449699935214169,
    "G1_vega": 87.62053705108039,
    "G1_theta": 398.74707515601676,
    "UG_delta": 33.59971322022118,
    "UG_vega": 0.3987695145573606,
    "UG_theta": 0.8506829912102671,
    "forecast": {
        "markPrice": 1374.5565772454065,
        "size": 3,
        "RP": 4.140494557838778,
        "singleOptionPrice": 1378.6970718032453,
        "totalOptionPrice": 4136.091215409736,
        "tradeFee": 59.007534,
        "totalExecutionPrice": 4195.098749409736
    }
}

Properties in the Response

Additional Context

  • G0 (Original Greeks):

    • Represents the initial Greeks (delta, vega, theta) of the existing OLP before any new trade is factored in.

    • These values are critical for understanding the baseline risk parameters.

  • G1 (Updated Greeks):

    • Represents the updated Greeks after accounting for the new trade.

    • These values reflect the adjusted risk parameters post-trade, showing the immediate impact of the new position.

  • UG (Unit Greeks):

    • Scaled and adjusted values of the updated Greeks (G1).

    • These normalized values are used for calculating the risk premium rate, taking into account the size of the OLP and other scaling factors.

Name
Type
Description

RP_rate

number

The risk premium rate applied to the forecast execution price.

G0_delta

number

The initial delta value of the OLP Greeks before the new trade.

G0_vega

number

The initial vega value of the OLP Greeks before the new trade.

G0_theta

number

The initial theta value of the OLP Greeks before the new trade.

G1_delta

number

The updated delta value of the OLP Greeks after the new trade.

G1_vega

number

The updated vega value of the OLP Greeks after the new trade.

G1_theta

number

The updated theta value of the OLP Greeks after the new trade.

UG_delta

number

The scaled and adjusted (Unit) delta value for calculating the risk premium.

UG_vega

number

The scaled and adjusted (Unit) vega value for calculating the risk premium.

UG_theta

number

The scaled and adjusted (Unit) theta value for calculating the risk premium.

forecast

object

Contains detailed forecast data for the execution price.

forecast.markPrice

number

The current mark price of the instrument.

forecast.size

number

The size of the position for which the execution price is forecasted.

forecast.RP

number

The risk premium (RP) of a single option.

forecast.singleOptionPrice

number

The price of a single option including the risk premium.

forecast.totalOptionPrice

number

The total price for the specified size of options.

forecast.tradeFee

number

The fee for executing the trade.

forecast.totalExecutionPrice

number

The total execution price including trade fees and risk premiums.

GET Forecast Execution Price for Sell Position

GET /v1/market/forecastExecutionPrice/sell

Keep in mind that the forecasted value is dynamic, so the actual value may differ at the time of trade.

Estimate the execution price for a specific instrument and option contract size for selling position.

Query Parameters

Name
Type
Description

instrument*

String

The name of instrument which is active. You can query the list of instrument_name via here.

size*

number

The amount of option contracts that you want to sell

Query Examples

curl --request GET \
     --url https://api.moby.trade/v1/market/forecastExecutionPrice/sell?instrument=BTC-19JUL24-66000-P&size=3 \
     --header 'accept: application/json' \
     --header 'content-type: application/json'
import axios from 'axios';

async function sendRequest() {
  try {
    const response = await axios.get('https://api.moby.trade/v1/market/forecastExecutionPrice/sell', {
      params: {
        instrument: 'BTC-19JUL24-66000-P',
        size: 3
      },
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });

    console.log(response.data);
  } catch (error) {
    console.error('Error fetching forecast execution price:', error);
  }
}

sendRequest();
import requests

def send_request():
    url = 'https://api.moby.trade/v1/market/forecastExecutionPrice/sell'
    headers = {
        'accept': 'application/json',
        'content-type': 'application/json'
    }
    params = {
        'instrument': 'BTC-19JUL24-66000-P',
        'size': 3
    }

    response = requests.get(url, headers=headers, params=params)
    print(response.json())

send_request()
async function sendRequest() {
  try {
    const response = await fetch('https://api.moby.trade/v1/market/forecastExecutionPrice/sell?instrument=BTC-19JUL24-66000-P&size=3', {
      method: 'GET',
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });
    const data = await response.json();
    console.log(data);
  } catch (error) {
    console.error('Error fetching forecast execution price:', error);
  }
}

sendRequest();

Response Examples

{
    "RP_rate": 0.03792843087288748,
    "G0_delta": -3.0365582425903628,
    "G0_vega": 150.48604291046834,
    "G0_theta": -455.133828188879,
    "G1_delta": -4.5994947568479,
    "G1_vega": 209.77247541582796,
    "G1_theta": -1303.9947987846938,
    "UG_delta": 90.8652681843935,
    "UG_vega": 0.858533916923668,
    "UG_theta": 3.071134592865212,
    "forecast": {
        "markPrice": 1292.3400473676884,
        "size": 3,
        "RP": 49.016430150849494,
        "singleOptionPrice": 1243.3236172168388,
        "totalOptionPrice": 3729.970851650516,
        "tradeFee": 59.145684,
        "totalExecutionPrice": 3789.116535650516
    }
}

Response Properties

Name
Type
Description

RP_rate

number

The risk premium rate applied to the forecast execution price.

G0_delta

number

The initial delta value of the OLP Greeks before the new trade.

G0_vega

number

The initial vega value of the OLP Greeks before the new trade.

G0_theta

number

The initial theta value of the OLP Greeks before the new trade.

G1_delta

number

The updated delta value of the OLP Greeks after the new trade.

G1_vega

number

The updated vega value of the OLP Greeks after the new trade.

G1_theta

number

The updated theta value of the OLP Greeks after the new trade.

UG_delta

number

The scaled and adjusted (Unit) delta value for calculating the risk premium.

UG_vega

number

The scaled and adjusted (Unit) vega value for calculating the risk premium.

UG_theta

number

The scaled and adjusted (Unit) theta value for calculating the risk premium.

forecast

object

Contains detailed forecast data for the execution price.

forecast.markPrice

number

The current mark price of the instrument.

forecast.size

number

The size of the position for which the execution price is forecasted.

forecast.RP

number

The risk premium (RP) of a single option.

forecast.singleOptionPrice

number

The price of a single option including the risk premium.

forecast.totalOptionPrice

number

The total price for the specified size of options.

forecast.tradeFee

number

The fee for executing the trade.

forecast.totalExecutionPrice

number

The total execution price including trade fees and risk premiums.

GET Option ID by Instrument

GET /v1/market/optionIdByInstrument/{instrument}

Fetch the optionId by querying with instrument name.

Path Parameters

Name
Type
Description

instrument*

String

The name of instrument which is active. You can query the list of instrument_name via here.

Query Examples

curl --request GET \
     --url https://api.moby.trade/v1/market/optionIdByInstrument/BTC-10JUL24-57500-P \
     --header 'accept: application/json' \
     --header 'content-type: application/json'
import axios from 'axios';

async function sendRequest(instrument: string): Promise<void> {
  try {
    const response = await axios.get(`https://api.moby.trade/v1/market/optionIdByInstrument/${instrument}`, {
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });
    console.log(response.data);
  } catch (error) {
    console.error('Error fetching option ID by instrument:', error);
  }
}

const instrument = 'BTC-10JUL24-57500-P';
sendRequest(instrument);
import requests

def sendRequest(instrument):
    url = f'https://api.moby.trade/v1/market/optionIdByInstrument/{instrument}'
    headers = {
        'accept': 'application/json',
        'content-type': 'application/json'
    }
    try:
        response = requests.get(url, headers=headers)
        response.raise_for_status()
        print(response.json())
    except requests.exceptions.RequestException as e:
        print(f'Error fetching option ID by instrument: {e}')

instrument = 'BTC-10JUL24-57500-P'
sendRequest(instrument)
async function sendRequest(instrument) {
  const url = `https://api.moby.trade/v1/market/optionIdByInstrument/${instrument}`;
  try {
    const response = await fetch(url, {
      method: 'GET',
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });
    if (!response.ok) {
      throw new Error(`Error fetching option ID by instrument: ${response.statusText}`);
    }
    const data = await response.json();
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

const instrument = 'BTC-10JUL24-57500-P';
sendRequest(instrument);

Response Examples

{
    "instrument": "BTC-10JUL24-57500-P",
    "optionId": "0x000100668e3f8000000000e09c"
}

GET A list of Instruments by Option ID

GET /v1/market/instrumentsByOptionId/{instrument}

Fetch the instrument list related with optionId.

Path Parameters

Name
Type
Description

optionId*

String(hex)

The encoded type of instrument information.

Query Examples

curl --request GET \
     --url https://api.moby.trade/v1/market/instrumentsByOptionId/0x000100668e3f8000000000e09c \
     --header 'accept: application/json' \
     --header 'content-type: application/json'
import axios from 'axios';

async function sendRequest(optionId: string): Promise<void> {
  try {
    const response = await axios.get(`https://api.moby.trade/v1/market/instrumentsByOptionId/${optionId}`, {
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });
    console.log(response.data);
  } catch (error) {
    console.error('Error fetching instruments by option ID:', error);
  }
}

const optionId = '0x000100668e3f8000000000e09c';
sendRequest(optionId);
import requests

def send_request(option_id):
    url = f'https://api.moby.trade/v1/market/instrumentsByOptionId/{option_id}'
    headers = {
        'accept': 'application/json',
        'content-type': 'application/json'
    }
    try:
        response = requests.get(url, headers=headers)
        response.raise_for_status()
        print(response.json())
    except requests.exceptions.RequestException as e:
        print(f'Error fetching instruments by option ID: {e}')

option_id = '0x000100668e3f8000000000e09c'
send_request(option_id)
async function sendRequest(optionId) {
  const url = `https://api.moby.trade/v1/market/instrumentsByOptionId/${optionId}`;
  try {
    const response = await fetch(url, {
      method: 'GET',
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });
    if (!response.ok) {
      throw new Error(`Error fetching instruments by option ID: ${response.statusText}`);
    }
    const data = await response.json();
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

const optionId = '0x000100668e3f8000000000e09c';
sendRequest(optionId);

Response Examples

{
    "optionId": "0x000100668e3f8000000000e09c",
    "instruments": [
        "BTC-10JUL24-57500-C",
        "BTC-10JUL24-57500-P"
    ]
}

GET optionTokenId by Instrument Name

GET /v1/market/optionTokenIdByInstrument/{instrument}/{buyOrSell}

Fetch the instrument list related with optionId.

Path Parameters

Name
Type
Description

instrument*

String

The name of instrument.

buyOrSell*

String

The direction of the position.

option: ["buy", "sell"]

Query Examples

curl --request GET \
     --url https://api.moby.trade/v1/market/optionTokenIdByInstrument/BTC-10JUL24-57500-P/buy \
     --header 'accept: application/json' \
     --header 'content-type: application/json'
import axios from 'axios';

async function sendRequest(instrument: string, type: string): Promise<void> {
  try {
    const response = await axios.get(`https://api.moby.trade/v1/market/optionTokenIdByInstrument/${instrument}/${type}`, {
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });
    console.log(response.data);
  } catch (error) {
    console.error('Error fetching option token ID by instrument:', error);
  }
}

const instrument = 'BTC-10JUL24-57500-P';
const type = 'buy';
const index = 0;
sendRequest(instrument, type, index);
import requests

def send_request(instrument, type):
    url = f'https://api.moby.trade/v1/market/optionTokenIdByInstrument/{instrument}/{type}'
    headers = {
        'accept': 'application/json',
        'content-type': 'application/json'
    }
    try:
        response = requests.get(url, headers=headers)
        response.raise_for_status()
        print(response.json())
    except requests.exceptions.RequestException as e:
        print(f'Error fetching option token ID by instrument: {e}')

instrument = 'BTC-10JUL24-57500-P'
type = 'buy'
index = 0
send_request(instrument, type, index)
async function sendRequest(instrument, type) {
  const url = `https://api.moby.trade/v1/market/optionTokenIdByInstrument/${instrument}/${type}`;
  try {
    const response = await fetch(url, {
      method: 'GET',
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });
    if (!response.ok) {
      throw new Error(`Error fetching option token ID by instrument: ${response.statusText}`);
    }
    const data = await response.json();
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

const instrument = 'BTC-10JUL24-57500-P';
const type = 'buy';

sendRequest(instrument, type);

Response Examples

{
    "optionTokenId": "0x1769611959806549332523790152232844486013328925062407377440073165073022976",
    "instrument": "BTC-10JUL24-57500-P",
    "buyOrSell": "buy",
    "vaultType": "sVault"
}

GET A list of Instruments by optionTokenId

GET /v1/market/instrumentsByOptionTokenId/{optionTokenId}

Fetch all composed instruments given an optionTokenId.

Path Parameters

Name
Type
Description

optionTokenId*

String(bytes)

ID of ERC-1155 option token

Query Examples

curl --request GET \
     --url https://api.moby.trade/v1/market/instrumentsByOptionTokenId/0x1769611959806549332523790152232844486013328925062407377440073165073022976 \
     --header 'accept: application/json' \
     --header 'content-type: application/json'
import axios from 'axios';

async function sendRequest(optionTokenId: string): Promise<void> {
  try {
    const response = await axios.get(`https://api.moby.trade/v1/market/instrumentsByOptionTokenId/${optionTokenId}`, {
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });
    console.log(response.data);
  } catch (error) {
    console.error('Error fetching instruments by option token ID:', error);
  }
}

const optionTokenId = '0x1769611959806549332523790152232844486013328925062407377440073165073022976';
sendRequest(optionTokenId);
import requests

def send_request(option_token_id):
    url = f'https://api.moby.trade/v1/market/instrumentsByOptionTokenId/{option_token_id}'
    headers = {
        'accept': 'application/json',
        'content-type': 'application/json'
    }
    try:
        response = requests.get(url, headers=headers)
        response.raise_for_status()
        print(response.json())
    except requests.exceptions.RequestException as e:
        print(f'Error fetching instruments by option token ID: {e}')

option_token_id = '0x1769611959806549332523790152232844486013328925062407377440073165073022976'
send_request(option_token_id)
async function sendRequest(optionTokenId) {
  const url = `https://api.moby.trade/v1/market/instrumentsByOptionTokenId/${optionTokenId}`;
  try {
    const response = await fetch(url, {
      method: 'GET',
      headers: {
        'accept': 'application/json',
        'content-type': 'application/json'
      }
    });
    if (!response.ok) {
      throw new Error(`Error fetching instruments by option token ID: ${response.statusText}`);
    }
    const data = await response.json();
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

const optionTokenId = '0x1769611959806549332523790152232844486013328925062407377440073165073022976';
sendRequest(optionTokenId);

Response Examples

{
    "optionTokenId": "0x1769611959806549332523790152232844486013328925062407377440073165073022976",
    "instruments": ["BTC-10JUL24-57500-P"],
    "isBuys": [true],
    "strategy": "BuyPut"
}

PreviousAccountNextTrade Scripts

Last updated 9 months ago

The concepts of optionId and optionTokenId may cause confusion as they are different. Please refer to for more details.

The concepts of optionId and optionTokenId may cause confusion as they are different. Please refer to for more details.

The concepts of optionId and optionTokenId may cause confusion as they are different. Please refer to for more details.

The concepts of optionId and optionTokenId may cause confusion as they are different. Please refer to for more details.

Appendix 2
Appendix 2
Appendix 2
Appendix 2