Yala is a decentralized Bitcoin-backed stablecoin lending protocol that allows users to obtain stablecoin loans using BTC as collateral. The protocol features advanced risk management and a flexible liquidation system.
-
Bitcoin-Backed Loans
- Use BTC as collateral
- Borrow stablecoins against BTC
- Flexible loan terms
-
Risk Management
- Dynamic LTV ratios
- Multi-stage liquidation process
- Real-time risk monitoring
-
Protocol Parameters
- Initial LTV: Up to 80%
- Liquidation Threshold: 90%
- Repayment Window: 5 days
- Minimum Collateral: 0.1 BTC
- Type: Random Forest Classifier
- Features:
- Price momentum indicators
- Volatility metrics
- Volume indicators
- Technical analysis signals
- Target Variables:
- Risk level (Low/Medium/High)
- Price direction prediction
- Volatility regime classification
- Type: Gradient Boosting Regressor
- Features:
- Historical volatility patterns
- Market regime indicators
- Trading volume metrics
- Predictions:
- Forward-looking volatility
- Risk regime transitions
- Market stress indicators
python MLModel.py train --data-path data/bitcoin_history.csv
python MLModel.py predict --input-data current_market.csv
python RiskVisualization.py
Generates the following plots:
- Price and volatility trends
- Drawdown analysis
- Return distribution
- Recovery patterns
- Interest rate model
- Volatility regimes
- Clone the repository:
git clone https://github.com/yalaorg/BitcoinRisk.git
cd BitcoinRisk
- Install dependencies:
pip install -r requirements.txt
-
Data Collection
- Bitcoin price feeds
- Market indicators
- Volume analysis
-
Risk Analysis
- Volatility calculation
- Machine learning predictions
- Market regime detection
-
Protocol Actions
- LTV adjustments
- Interest rate updates
- Liquidation triggers
Stage | LTV Threshold | Action | Time Window |
---|---|---|---|
Warning | 80% | Notification | Immediate |
Margin Call | 85% | Partial Liquidation | 5 days |
Liquidation | 90% | Full Liquidation | Immediate |
POST /api/v1/predict/risk
{
"timestamp": "2024-01-16T10:00:00",
"btc_price": 90000.0,
"collateral": 1.5,
"loan_amount": 60000
}
{
"risk_level": "medium",
"recommended_ltv": 0.75,
"liquidation_price": 67500.0,
"warnings": []
}
GET /api/v1/model/info
Dev - @vickyfu09
- Bitcoin price data from Yahoo Finance