> For the complete documentation index, see [llms.txt](https://promethium.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://promethium.gitbook.io/docs/promethium-features/refinancing.md).

# Refinancing

The feature is in development

#### 🔹 **Refinancing: The Basics**

At its core, refinancing involves moving a debt position from one lending protocol to another to take advantage of better interest rates. Promethium's refinancing feature automates this process, constantly monitoring rates across various lending protocols and moving positions to ensure users always get the best deal.

#### 🔹 **The Architecture of** Promethium's **Refinancing Feature**

Promethium's refinancing feature is built on a robust architecture that includes a loans vault, a backend, and various loan protocols. The loans vault holds the user's debt positions, the backend monitors rates and calculates the optimal protocol for each position, and the loan protocols are the platforms where the debt positions are held.

#### 🔹 **Step-by-Step Refinancing Algorithm**

Promethium's refinancing algorithm is a complex process that ensures the optimal movement of debt positions. Here's how it works:

1. **Rate Retrieval**: The backend retrieves the current interest rates from all supported lending protocols.
2. **Optimal Protocol Calculation**: The backend calculates which protocol offers the best rate for each debt position.
3. **Matrix Transfer**: The backend transfers the optimal distribution matrix to the loans vault.
4. **Debt Position Movement**: The loans vault initiates the movement of the debt position. It takes a flash loan, repays the debt in the old protocol, withdraws the collateral, transfers it to the new protocol, takes a new loan, and finally, repays the flash loan.

At the end of this process, the debt position has been moved to a new protocol offering a better interest rate, all without the user having to lift a finger.

## **Conclusion**

Promethium's refinancing feature offers a powerful, automated solution for managing debt positions in the DeFi space. By continuously monitoring rates and moving positions to take advantage of the best deals, Promethium ensures that users' debt positions are always optimized for maximum benefit.

With its robust architecture and sophisticated refinancing algorithm, Promethium takes the hassle out of refinancing, making it a valuable tool for any DeFi user.
