Diffusal

Reference

Symbol formats, error codes, and data types for the Diffusal API

Symbol Format

Diffusal uses a consistent symbol format for option identification:

Format: UNDERLYING-STRIKE-TYPE-EXPIRY[-SHORT]

ComponentDescriptionExample
UNDERLYINGAsset ticker (uppercase)BTC, ETH, SHIB
STRIKEPrice with underscore decimal82000, 3550_5, 0_00001234
TYPEC (call) or P (put)C, P
EXPIRYUnix timestamp (seconds)1736409600
SHORTOptional suffix for short positions-SHORT

Expiry Time

All options expire at 08:00 UTC (4:00 PM Singapore/HKT). The expiry is encoded as a Unix timestamp in the symbol.

Time Zone Reference:

Time ZoneExpiry Time
UTC08:00
Singapore/HKT16:00 (4:00 PM)
London (GMT)08:00
New York (EST)03:00
New York (EDT)04:00
Tokyo (JST)17:00

Strike Format Rules

RuleInputOutput
Underscore as decimal separator3550.53550_5
Strip trailing zeros3550.503550_5
Keep leading zero for values less than 10.50_5
Whole numbers: no underscore82000.082000

Examples by Price Range

Large Cap Assets (BTC, ETH)

AssetStrike ($)Symbol
BTC82,000BTC-82000-C-1736409600
BTC100,000.50BTC-100000_5-C-1736409600
ETH3,550ETH-3550-P-1736409600
ETH3,550.50ETH-3550_5-C-1736409600
ETH3,550.05ETH-3550_05-C-1736409600

Mid Cap Assets (SOL, AVAX)

AssetStrike ($)Symbol
SOL123SOL-123-C-1736409600
SOL123.45SOL-123_45-C-1736409600
SOL123.456SOL-123_456-P-1736409600
AVAX45.50AVAX-45_5-C-1736409600

Small Cap Assets (DOGE, MATIC)

AssetStrike ($)Symbol
DOGE0.35DOGE-0_35-C-1736409600
DOGE0.355DOGE-0_355-P-1736409600
MATIC1.25MATIC-1_25-C-1736409600

Micro Cap / Memecoins (SHIB, PEPE)

AssetStrike ($)Symbol
SHIB0.00001234SHIB-0_00001234-C-1736409600
SHIB0.0000123SHIB-0_0000123-P-1736409600
PEPE0.00000089PEPE-0_00000089-C-1736409600

Edge Cases

Trailing Zero Handling

Input ValueIncorrectCorrect
3550.503550_503550_5
3550.003550_003550
100.10100_10100_1
0.5000_5000_5

Precision Examples

Decimal PlacesExample StrikeSymbol Strike
0 (whole)8200082000
13550.53550_5
2123.45123_45
345.12545_125
50.000350_00035
80.000012340_00001234

Short Position Examples

PositionSymbol
Long BTC callBTC-82000-C-1736409600
Short BTC callBTC-82000-C-1736409600-SHORT
Long ETH putETH-3550_5-P-1736409600
Short ETH putETH-3550_5-P-1736409600-SHORT

User-Facing Symbol Format

For human-readable display and external integrations, use the user-facing format:

Format: UNDERLYING-DDMMMYY-STRIKE-TYPE

ComponentDescriptionExample
UNDERLYINGAsset ticker (uppercase)BTC, ETH, SHIB
DDMMMYYExpiry date09JAN26, 28MAR25
STRIKEPrice with underscore decimal82000, 3550_5, 0_00001234
TYPEC (call) or P (put)C, P

Examples:

Diffusal (Internal)User-Facing
BTC-82000-C-1736409600BTC-09JAN26-82000-C
ETH-3550_5-P-1743148800ETH-28MAR25-3550_5-P
SHIB-0_00001234-C-1736409600SHIB-09JAN26-0_00001234-C

Use the Symbol Translate API to convert between formats.


Error Codes

Error Response Format

All API errors return a consistent JSON structure:

{
  "error": "error_code",
  "message": "Human-readable description",
  "details": {}
}

Error Codes Reference

Error CodeHTTP StatusDescription
not_found404Resource not found (series, pair, portfolio, etc.)
unauthorized401Authentication required or invalid
auth_error401Authentication flow error
validation_error400Invalid input parameters
rate_limited429Too many requests
indexer_error500Failed to fetch data from indexer
chain_error500Failed to read from blockchain
cache_update_error500Internal cache synchronization failed

Error Examples

Not Found (404)

{
  "error": "not_found",
  "message": "Series not found: 0x123abc..."
}

Validation Error (400)

{
  "error": "validation_error",
  "message": "Must be a valid bytes32 hex",
  "details": {
    "field": "pairId"
  }
}

Rate Limited (429)

{
  "error": "rate_limited",
  "message": "Too many requests",
  "details": {
    "limit": 50,
    "resetAt": 1700000000000
  }
}

Rate Limits

Endpoint CategoryUnauthenticatedAuthenticated
Market Data (/markets/*)60/min300/min
Helpers (/helpers/*)100/min300/min
Account (/account/*)120/min
Auth (/api/auth/*)10/min20/min

Data Types

Numeric Precision

WAD Format (18 Decimals)

Most numeric values use WAD format — 18 decimal fixed-point representation returned as strings.

ValueWAD Representation
1.0"1000000000000000000"
100.5"100500000000000000000"
0.001"1000000000000000"

Used for: Prices, Greeks, volatility, margin amounts, position sizes

USDC Format (6 Decimals)

Collateral and fee amounts use USDC's native 6-decimal precision.

ValueUSDC Representation
$1.00"1000000"
$100.50"100500000"
$0.01"10000"

Used for: Deposits, withdrawals, fees, equity

Field Precision Reference

This section clarifies which numeric format each API field uses.

Ticker Response (GET /markets/ticker/:symbol)

FieldFormatDecimalsExample RawHuman Value
markPriceWAD18"1050000000000000000"1.05
indexPriceWAD18"95000000000000000000000"95,000
bestBidWAD18"1000000000000000000"1.0
bestAskWAD18"1100000000000000000"1.1
deltaWAD18"550000000000000000"0.55
gammaWAD18"1000000000000000"0.001
vegaWAD18"50000000000000000000"50.0
thetaWAD18"-10000000000000000"-0.01
rhoWAD18"5000000000000000"0.005
ivWAD18"800000000000000000"0.80 (80%)
volume24hWAD18"1000000000000000000000"1,000

Portfolio Response (GET /account/portfolios/:id)

FieldFormatDecimalsNotes
depositUSDC6Raw USDC deposited
equityUSDC6Deposit + unrealized PnL
unrealizedPnlUSDC6Mark-to-market PnL
initialMarginWAD18IM requirement
maintenanceMarginWAD1880% of IM
maxWithdrawUSDC6Maximum withdrawable
healthRatioWAD18Equity / MM ratio

Position Response (GET /account/portfolios/:id/positions)

FieldFormatDecimalsNotes
optionBalanceWAD18Signed: negative = short
premiumBalanceUSDC6Deferred premium
entryPriceWAD18Average entry price
markPriceWAD18Current mark price
notionalWAD18abs(balance) × spot
unrealizedPnlWAD18Position PnL
deltaWAD18Position delta
gammaWAD18Position gamma
vegaWAD18Position vega
thetaWAD18Position theta

Order Book Response (GET /markets/orderbook/:symbol)

FieldFormatDecimals
priceWAD18
sizeWAD18

Trade Response (GET /markets/trades/:symbol)

FieldFormatDecimals
priceWAD18
sizeWAD18

Collateral Response (GET /account/portfolios/:id/collateral)

FieldFormatDecimals
depositUSDC6
maxWithdrawUSDC6
lockedUSDC6

Fee Response (GET /account/fees)

FieldFormatDecimals
totalFeesPaidUSDC6
fees24hUSDC6
makerFeesUSDC6
takerFeesUSDC6
rebatesReceivedUSDC6

Common Data Structures

Market/Series Object

{
  seriesId: string,      // bytes32 hex
  symbol: string,        // "BTC-82000-C-1736409600"
  pairId: string,        // bytes32 hex
  pairSymbol: string,    // "BTC-USD"
  strike: string,        // WAD
  expiry: number,        // Unix seconds
  isCall: boolean,
  isSettled: boolean
}

Ticker Object

{
  symbol: string,
  seriesId: string,
  markPrice: string,     // WAD - Black-Scholes price
  indexPrice: string,    // WAD - Spot price
  bestBid: string | null,
  bestAsk: string | null,
  // Greeks (all WAD)
  delta: string,
  gamma: string,
  vega: string,
  theta: string,
  rho: string,
  iv: string,            // Implied volatility
  // 24h Stats
  volume24h: string,
  trades24h: number,
  priceChange24h: string,
  high24h: string | null,
  low24h: string | null,
  openInterest: string,
  lastTradeAt: number | null
}

Position Object

{
  seriesId: string,
  symbol: string,
  optionBalance: string,   // Signed WAD (negative = short)
  premiumBalance: string,  // USDC
  entryPrice: string | null,
  realizedPnl: string,
  markPrice: string,
  notional: string,        // balance x markPrice
  unrealizedPnl: string,
  // Greeks (all WAD)
  delta: string,
  gamma: string,
  vega: string,
  theta: string
}

Portfolio Object

{
  id: number,
  deposit: string,           // USDC
  equity: string,            // USDC
  unrealizedPnl: string,     // USDC
  initialMargin: string,     // WAD
  maintenanceMargin: string, // WAD
  maxWithdraw: string,       // USDC
  isHealthy: boolean,
  isLiquidatable: boolean,
  healthRatio: string,       // WAD (equity/MM)
  positionCount: number
}

Order Book Level

{
  price: string,      // WAD
  size: string,       // WAD
  orderCount: number
}

Trade Object

{
  id: string,
  price: string,      // WAD (premium)
  size: string,       // WAD
  side: "buy" | "sell",
  timestamp: number   // Unix seconds
}

Identifier Formats

TypeFormatExample
Series IDbytes32 hex0x1234...abcd (66 chars)
Pair IDbytes32 hex0xabcd...1234 (66 chars)
AddressEthereum address0x1234...5678 (42 chars)

Conversion Examples

WAD to Human-Readable

const wadValue = "3550500000000000000000"; // 3550.5 in WAD
const humanValue = Number(wadValue) / 1e18; // 3550.5

USDC to Human-Readable

const usdcValue = "100500000"; // $100.50 in USDC
const humanValue = Number(usdcValue) / 1e6; // 100.5

Tick to Price

// tick x 10^(18 - tickDecimals) = WAD price
const tick = 82000;
const tickDecimals = 2;
const wadPrice = tick * 10 ** (18 - tickDecimals);
// 82000 x 10^16 = 820000000000000000000 (82000 WAD)

Signed Values

Position balances use signed values:

BalanceMeaning
PositiveLong position
NegativeShort position
ZeroNo position

On this page