Skip to main content

Loan Risk with Liquidity Constraints

Calculate loan risk metrics with market liquidity constraints for large positions.

POST /loan_risk_low_liquidity

Overview

The Loan Risk Low Liquidity endpoint performs risk assessment for loans while accounting for market liquidity constraints. This is particularly important for large positions that cannot be liquidated instantly without significant market impact. The endpoint supports multiple risk modeling approaches including Geometric Brownian Motion (GBM) and GARCH (Generalized Autoregressive Conditional Heteroskedasticity).

Input Parameters

Required Parameters

ParameterTypeDescription
typestringThe methodology to perform the loan risk assessment.
paramsobjectThe parameters to be used in the loan risk methodology.

Type Values

ValueDescription
GBMPerform a Monte Carlo simulation using Geometric Brownian Motion.
GARCHPerform a Monte Carlo simulation using GARCH model for volatility forecasting.

Standard Parameters (Common to All Methods)

ParameterTypeRequiredDescriptionExample
collateral_weightsobjectYesDictionary of collateral asset symbols mapping to respective weights.{'BTC': 1.0}
loan_weightsobjectYesDictionary of loan asset symbols mapping to respective weights.{'USDC': 1.0}
NnumberYesInitial collateral ratio threshold.1.7
MnumberYesMargin call threshold.1.47
LnumberYesLiquidation threshold (CCR).1.3
RnumberYesRecovery threshold.1.7
model_lookbacknumberYesDays of historical data for model fitting.90
volume_lookbacknumberYesDays of volume data for liquidity analysis.5
marketsarrayYesArray of trading pairs for volume aggregation.[["BTC", "USDT", "binance"], ["BTC", "USD", "coinbase"]]
participation_rationumberYesMax fraction of daily volume for liquidation (0 < value ≤ 1).0.1
loan_durationnumberYesLoan duration in days.30
mc_top_upnumberYesMargin call top-up frequency in hours.24
loan_valuenumberYesLoan value in USD.10000000
mc_iternumberYesNumber of Monte Carlo iterations.1000

Optional Parameters

ParameterTypeRequiredDescriptionDefaultExample
analysis_datestringNoEnd date for analysis (format: "MM-DD-YYYY").Current date"01-30-2023"
volatility_shocknumberNoVolatility multiplier for stress testing.01.5

Markets Parameter Format

The markets parameter specifies which trading pairs to aggregate volume from:

markets: [[base, quote, exchange], ...]
ElementDescriptionExamples
baseBase asset symbol"BTC", "ETH", "SOL"
quoteQuote asset symbol"USDT", "USD", "USDC"
exchangeExchange name (lowercase)"binance", "coinbase", "kraken"

Response

The response includes three main sections:

  • Arguments: The processed input parameters
  • Risk engine version: The software version
  • Output: The risk assessment results

Standard Output

FieldTypeDescription
PrMarginCallnumberProbability of at least one margin call
PrLiquidationnumberProbability of liquidation
PrUnderwaternumberProbability of underwater position
PrCloseoutnumberProbability of closeout
AvgMarginCallnumberAverage margin call amount
AvgLiquidationnumberAverage liquidation amount
WorstCaseCCRnumberWorst case collateral coverage ratio
Collateral VolatilitynumberAnnualized volatility of collateral
Loan VolatilitynumberAnnualized volatility of loan
Collateral/Loan CorrelationnumberCorrelation between collateral and loan
Volume Summary (per Million)objectDaily volume statistics
Maximum Market Daily LiquidationnumberMax liquidation capacity in USD

Volume Summary Object

The Volume Summary provides statistics on the aggregated daily trading volume across all specified markets over the volume_lookback period.

FieldDescription
MeanAverage daily volume across the lookback period
MinimumLowest single-day volume observed
25% Quantile25th percentile - 75% of days had higher volume
Median50th percentile - typical daily volume
75% Quantile75th percentile - 25% of days had higher volume
MaximumHighest single-day volume observed

Examples

GBM Example

Request

POST /loan_risk_low_liquidity
{
"type": "GBM",
"params": {
"collateral_weights": {
"BTC": 1.0
},
"loan_weights": {
"USDC": 1.0
},
"N": 1.7,
"M": 1.47,
"L": 1.3,
"R": 1.7,
"model_lookback": 90,
"volume_lookback": 5,
"markets": [
["BTC", "USDT", "binance"],
["BTC", "USD", "coinbase"]
],
"participation_ratio": 0.1,
"loan_duration": 30,
"mc_top_up": 24,
"loan_value": 10000000,
"mc_iter": 1000
}
}

Response

{
"Arguments": {
"L": 1.3,
"M": 1.47,
"N": 1.7,
"R": 1.7,
"analysis_date": "12-22-2025",
"collateral_weights": {
"BTC": 1.0
},
"loan_duration": 30,
"loan_value": 10000000,
"loan_weights": {
"USDC": 1.0
},
"markets": [
["BTC", "USDT", "binance"],
["BTC", "USD", "coinbase"]
],
"mc_iter": 1000,
"mc_top_up": 24,
"model_lookback": 90,
"participation_ratio": 0.1,
"type": "GBM",
"volume_lookback": 5,
"volatility_shock": 0
},
"Output": {
"AvgLiquidation": 1245678.32,
"AvgMarginCall": 2345678.45,
"Collateral Volatility": 0.0423,
"Collateral/Loan Correlation": 0.0012,
"Loan Volatility": 0.0002,
"Maximum Market Daily Liquidation": 24001200,
"PrCloseout": 0.002,
"PrLiquidation": 0.125,
"PrMarginCall": 0.345,
"PrUnderwater": 0.001,
"Volume Summary (per Million)": {
"Mean": 245.123,
"Minimum": 180.456,
"25% Quantile": 210.789,
"Median": 240.012,
"75% Quantile": 275.345,
"Maximum": 320.678
},
"WorstCaseCCR": 0.95
},
"Risk engine version": "1.6.0"
}

GARCH Example

Request

POST /loan_risk_low_liquidity
{
"type": "GARCH",
"params": {
"collateral_weights": {
"ETH": 1.0
},
"loan_weights": {
"USDC": 1.0
},
"N": 1.7,
"M": 1.47,
"L": 1.3,
"R": 1.7,
"model_lookback": 100,
"volume_lookback": 5,
"markets": [
["ETH", "USDT", "binance"],
["ETH", "USD", "coinbase"]
],
"participation_ratio": 0.1,
"loan_duration": 30,
"mc_top_up": 24,
"loan_value": 5000000,
"mc_iter": 1000
}
}

Response

{
"Arguments": {
"L": 1.3,
"M": 1.47,
"N": 1.7,
"R": 1.7,
"analysis_date": "12-22-2025",
"collateral_weights": {
"ETH": 1.0
},
"loan_duration": 30,
"loan_value": 5000000,
"loan_weights": {
"USDC": 1.0
},
"markets": [
["ETH", "USDT", "binance"],
["ETH", "USD", "coinbase"]
],
"mc_iter": 1000,
"mc_top_up": 24,
"model_lookback": 100,
"participation_ratio": 0.1,
"type": "GARCH",
"volume_lookback": 5,
"volatility_shock": 0
},
"Output": {
"AvgLiquidation": 845678.32,
"AvgMarginCall": 1345678.45,
"Collateral Volatility": 0.0523,
"Collateral/Loan Correlation": 0.0015,
"Loan Volatility": 0.0001,
"Maximum Market Daily Liquidation": 18001200,
"PrCloseout": 0.001,
"PrLiquidation": 0.105,
"PrMarginCall": 0.325,
"PrUnderwater": 0.0005,
"Volume Summary (per Million)": {
"Mean": 185.123,
"Minimum": 150.456,
"25% Quantile": 170.789,
"Median": 180.012,
"75% Quantile": 195.345,
"Maximum": 220.678
},
"WorstCaseCCR": 0.97
},
"Risk engine version": "1.6.0"
}

Understanding Volume-Constrained Results

The low liquidity model penalizes large positions relative to available market liquidity:

  • Median daily volume: Calculated from the markets parameter across the volume_lookback period
  • Max daily liquidation: Calculated as Median volume × participation_ratio
  • Liquidity constraint: Daily liquidations are capped at the max daily liquidation value
  • Higher liquidation risk: Large positions that require multiple days to liquidate face increased risk during adverse price movements

Comparing Standard vs Low Liquidity Models

ScenarioStandard ModelLow Liquidity Model
$10M loan, liquid marketPrLiq: 0.05PrLiq: 0.05
$100M loan, liquid marketPrLiq: 0.05PrLiq: 0.15
$100M loan, illiquid marketPrLiq: 0.05PrLiq: 0.35
POST/loan_risk_low_liquidity
curl -X POST "https://api.bitpulse.io/loan_risk_low_liquidity" \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "type": "GBM",
    "params": {
      "collateral_weights": {
        "BTC": 1.0
      },
      "loan_weights": {
        "USDC": 1.0
      },
      "N": 1.7,
      "M": 1.47,
      "L": 1.3,
      "R": 1.7,
      "model_lookback": 90.0,
      "volume_lookback": 5,
      "markets": [
        ["BTC", "USDT", "binance"],
        ["BTC", "USD", "coinbase"]
      ],
      "participation_ratio": 0.1,
      "loan_duration": 30.0,
      "mc_top_up": 24.0,
      "loan_value": 10000000,
      "mc_iter": 1000
    }
  }'