
A CDP (Collateralized Debt Position) database is a structured repository that organizes all on-chain data related to collateralized debt positions. CDPs are comparable to mortgage loans: you deposit assets as collateral to borrow stablecoins or take out loans, and if your collateral falls below a certain threshold, your position may be liquidated.
On the blockchain, a CDP database consolidates scattered contract event data—such as collateral deposits, loans, repayments, price updates, and liquidation records—into accessible tables and views. This aggregation enables risk management and research. In its early stages, MakerDAO referred to these as CDPs before rebranding them as Vaults (Source: MakerDAO Docs, 2026-01).
The key value of a CDP database lies in making risk and position information transparent and accessible. Developers use it for backtesting strategies, researchers analyze liquidation cycles, and investors assess collateralization safety margins and set alerts accordingly.
During market volatility, determining whether liquidations will be triggered or which positions are most vulnerable requires precise, real-time data on positions and prices. The CDP database aggregates this critical information into a unified, queryable layer so all stakeholders can rely on a consistent factual foundation.
A CDP database typically integrates data from three sources: blockchain nodes, oracle price feeds, and protocol governance parameters. It subscribes to contract events, recording each instance of “position opening,” “collateral increase,” “stablecoin minting,” “repayment,” and “liquidation,” all serialized by block time.
The database then computes derived metrics such as the collateralization ratio (collateral value/debt), safety margin (current collateralization minus liquidation threshold), and archives price snapshots and governance parameters for historical replay and audit purposes.
Core fields commonly found in a CDP database include:
These fields enable comprehensive risk calculations and historical analysis, moving beyond fragmented, point-in-time queries.
Assessing liquidation risk centers on calculating collateralization ratios and safety margins, and forecasting the impact of price volatility. The collateralization ratio is computed as (collateral amount × price) / debt balance. If this ratio drops below the protocol’s liquidation threshold, liquidation is triggered.
For example, Liquity sets a minimum collateralization ratio at 150% (Source: Liquity Docs, 2026-01). After each price update, the CDP database recalculates every position’s ratio and determines the remaining safety margin. If the margin is too low, alerts can be triggered or strategies automatically adjust by adding collateral or repaying debt.
The CDP database links oracle price updates directly to position records by subscribing to relevant oracle events. Oracles serve as external data sources providing fair market prices—such as ETH/USD rates written on-chain.
Protocol parameters like stability fees, liquidation penalties, and collateral discounts are sourced from governance contracts or configuration files. When these parameters change, the database snapshots the new values to ensure that backtesting uses historically accurate rules for risk and return calculations (Source: MakerDAO Governance Portal, 2026-01).
CDP database structures and logic vary between protocols. MakerDAO (now using the term “Vault”) supports multiple collateral types and diverse liquidation mechanisms; its fee parameters are governance-controlled, resulting in a richer data structure. Liquity emphasizes governance-minimized operations with a fixed minimum collateralization ratio (150%) and processes liquidations through its Stability Pool—fields are simpler but require more precise tracking of time-sequenced price and position snapshots (Source: Liquity Docs, 2026-01).
Accordingly, when integrating with MakerDAO, a CDP database focuses on multi-collateral support and fee parameter snapshots. For Liquity integration, emphasis is placed on managing liquidation queues, Trove state transitions, and Stability Pool fund flows.
In research scenarios, the CDP database supports analyses such as mapping collateralization ratio distributions, identifying clusters of high-risk positions, analyzing liquidation trigger ranges, and backtesting strategies like dynamic collateral adjustment or diversification.
In trading practice, risk signals from the CDP database can be combined with market monitoring. For instance, by tracking stablecoin and collateral asset price movements in Gate’s markets and announcements, traders can set safety margin-based alerts using the CDP database to mitigate the risk of forced liquidation during sharp price swings. All actions must consider capital safety and smart contract risks; this is not investment advice.
Step 1: Select Protocols & Networks. Identify which protocols (e.g., MakerDAO, Liquity) and blockchains (e.g., Ethereum mainnet) to monitor; list relevant contract addresses and event types.
Step 2: Connect Nodes & Capture Events. Run or rent blockchain nodes; subscribe to contract events; persist raw data from activities like opening positions, adding collateral, repaying loans, or liquidation.
Step 3: Integrate Oracles & Parameters. Connect to oracle price updates; periodically fetch governance parameters; version snapshot them to ensure reproducible backtesting.
Step 4: Compute Metrics & Modeling. Generate derived fields such as collateralization ratio, safety margin, and potential liquidation bands; serialize by block time for visualization and alerting.
Step 5: Risk Control & Alerts. Set thresholds and rules (e.g., “alert when collateralization ratio nears liquidation line”), record each alert’s trigger conditions for auditability and ongoing improvement.
CDP databases transform fragmented on-chain position and price data into actionable risk management and research insights. The foundation lies in accurate event capture, price and parameter snapshots, and continuous computation of key metrics like collateralization ratio and safety margin. Field structures and business logic vary by protocol—custom modeling is essential. By combining the CDP database with trading observations (such as tracking relevant asset prices or announcements on Gate), users can identify liquidation risks more proactively. However, no strategy or alert system eliminates inherent market or contract risks—users must independently assess capital safety and diversify accordingly.
The liquidation price is determined by three factors: the value of the collateral asset, total debt amount, and the required liquidation ratio. When falling asset prices push the collateralization ratio below the minimum threshold, liquidation is automatically triggered by the system. The CDP database enables real-time monitoring of this critical point so you can assess your exposure in advance and avoid sudden liquidations.
The CDP database logs real-time data for all active positions—including collateral types, amounts, and debt size. By filtering for high-value positions and monitoring their fluctuations, you can identify whale movements and potential risk signals in the market. This is especially useful for gauging market sentiment and forecasting potential liquidation waves.
Supported collateral types vary by DeFi protocol—MakerDAO primarily accepts ETH and stablecoins while Liquity focuses on ETH only. The CDP database maintains comprehensive records of all accepted collaterals per protocol along with their associated risk parameters. You can query specific collateral lists via platforms like Gate according to the protocol in use.
The stability fee functions like an interest rate—it directly increases the cost of holding a CDP. The database tracks both historical changes and current levels of stability fees so you can evaluate borrowing profitability over time. Higher fees accelerate debt growth within your position, requiring more frequent monitoring or adjustments.
High-risk positions typically exhibit low collateralization ratios, volatile underlying assets, or are close to their liquidation threshold. With filtering tools in the CDP database, you can sort by collateralization ratio or asset type to quickly pinpoint these exposures. Such positions often trigger liquidations first during volatile markets—serving as early warning indicators of major market shifts.


