ABSecure is a Smart Asset-Backed Securities (ABS) Management System that helps financial institutions bundle loans into ABS, predict their performance, and facilitate trading. The system utilizes AI to assess loan risks, optimize securitization, and enable a secondary market for trading ABS.
- Loan Pool Formation – Group loans based on risk profiles.
- Tranche Creation – Split loan pools into Senior, Mezzanine, and Equity tranches.
- Generative AI-Based Risk Analysis – AI-generated reports for loan risk assessment.
- Market-Based Pricing – Real-time pricing of ABS securities.
- Portfolio Management – Optimize investor portfolios using ABS.
- Secondary Market Trading – Enable buying & selling of ABS.
- Audit & Compliance – Secure tracking of all transactions.
- Backend: FastAPI (Python)
- Database: MongoDB
- Frontend: React.js / Vue.js
- AI: Generative AI (GeminiAI-based) for risk reporting & scenario analysis
- Deployment: AWS / GCP / Render(Future plan)
- Version Control: GitHub
ABSecure/
│── backend
│ │── app/
│ │ │── config/
│ │ │ ├── database.py # MongoDB connection setup
│ │ │
│ │ │── ml/
│ │ │ │── risk_model.py # ML model
│ │ │ │── loan_risk_model.pkl # pickle file
| | | |__ analysis.py # Script for generating analysis
│ │ │
│ │ │── models/
│ │ │ ├── loan.py # Loan schema using Pydantic
│ │ │ ├── pool.py # Loan Pool schema
│ │ │
│ │ │── routes/
│ │ │ ├── loan_routes.py # Loan API endpoints
│ │ │ ├── pool_routes.py # Loan Pool API endpoints
│ │ │
│ │ │── services/
│ │ │ ├── pool_service.py # Loan pooling logic
│ │ │
│ │ │── main.py # FastAPI entry point
│ │── requirements.txt # Dependencies
│ │── .env # Environment variables (MongoDB URI)
│ |── .gitignore # Ignore unnecessary files
│ │
│ │
│── frontend/
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Core pages and views
│ │ ├── context/ # Global state management using React Context API
│ │ ├── hooks/ # Custom React hooks
│ │ ├── lib/ # Utility functions and helpers
│ │ ├── App.js # Root component
│ │ ├── main.jsx # Entry point for React app
│ ├── public/ # Static assets
│ ├── package.json # Frontend dependencies
│ ├── vite.config.js # Vite configuration for fast development
| |
│ │── database/ # Database configuration
│ │── docs/ # Documentation and guides
│ │── docker-compose.yml
│ │── LICENSE
│ │── README.md
| |__ .gitignore # Ignore unnecessary files
The ABSecure system leverages the Financial Risk for Loan Approval dataset from Kaggle. This dataset provides a rich set of financial, credit, and demographic details on loan applicants and is crucial for:
-
Assessing Loan Risk:
Predicting a RiskScore for each loan using a machine learning (Random Forest) model that integrates multiple financial metrics and is used in tranching of loans. Risk scores are calculated using a proper ML algorithm with flo as:- -
Loan Pooling & Tranche Allocation:
Grouping loans based on dynamic criteria chosen by the user—such as duration, creditworthiness, liquidity, and debt metrics—to create investment tranches.
For example:- Pooling by Duration: If a user selects the pooling option Duration with the suboption Short-Term, the system filters the dataset to include only loans with a duration of 12 months or less.
- Pooling by Creditworthiness: If a user opts for pooling by Creditworthiness with the suboption Excellent, then only loans that satisfy the defined excellent criteria (e.g., meeting specified thresholds for CreditScore, LengthOfCreditHistory, and other relevant metrics) are grouped together.
A flow diagram showing tranche allocation and loan pooling pipeline:-
-
Applicant Info:
• ApplicationDate, Age, EmploymentStatus, EducationLevel, Experience, MaritalStatus, NumberOfDependents -
Financial Data:
• AnnualIncome, MonthlyIncome, SavingsAccountBalance, CheckingAccountBalance, NetWorth -
Credit & Debt Metrics:
• CreditScore, LengthOfCreditHistory, NumberOfOpenCreditLines, NumberOfCreditInquiries, DebtToIncomeRatio, TotalDebtToIncomeRatio, BankruptcyHistory, PreviousLoanDefaults, PaymentHistory, CreditCardUtilizationRate -
Loan Details:
• LoanAmount, LoanDuration, LoanPurpose, BaseInterestRate, InterestRate, MonthlyLoanPayment -
Target Variable(IN ML):
• RiskScore
This dataset underpins our machine learning model, which calculates a RiskScore that informs our dynamic pooling logic and subsequent ABS tranche creation.
- Python 3.8+
- Node.js 16+
- MongoDB (local or cloud instance)
- Git
git clone https://github.com/tushargoyal22/ABSecure.git
cd ABSecure
python -m venv venv
source venv/bin/activate # For macOS/Linux
venv\Scripts\activate # For Windows
pip install -r backend/requirements.txt
If not already included in requirements.txt
, install them manually:
pip install fastapi uvicorn
Create a .env
file in the backend/config
directory and add:
MONGO_URI="your_mongodb_connection_string"
uvicorn backend.main:app --reload
- This starts the FastAPI server on
http://127.0.0.1:8000
- You can access API docs at
http://127.0.0.1:8000/docs
Ensure you're inside the project root folder. Then, navigate to the frontend directory:
cd frontend
Run the following command to install all necessary dependencies listed in package.json
:
npm install
Copy the provided .env.example
file and rename it as .env to configure your environment variables:
cp .env.example .env
npm run dev
- This will launch the Vite development server.
- By default, the app will be available at
http://localhost:5173/
.
Ensure MongoDB is running and update the connection string in backend/main.py
.
The database is designed to manage investors, tranches, and loan data in the ABSecure platform :
- Start the backend:
uvicorn backend.main:app --reload
- Start the frontend:
npm run dev
The seed.py
script populates the database by importing financial loan data from a JSON file into MongoDB.
Before running the script, ensure you have:
- Python 3.x installed
- Required dependencies (install using):
pip install -r requirements.txt
- A running MongoDB Atlas or Local MongoDB instance
- A valid JSON file containing loan data
The loan dataset is required. You can download the original CSV from Kaggle:
🔗 Financial Risk for Loan Approval Dataset
If you haven't already, convert the CSV to JSON manually and store it as:
data/financial_risk_data.json
Set up environment variables in .env
before running the script:
MONGO_URI=your_mongodb_connection_string
JSON_FILE_PATH=data/financial_risk_data.json
## 3️⃣ Running the Script
Execute the script using:
```bash
python backend/seed.py
- Loads loan data from the JSON file
- Inserts only new records into MongoDB (avoiding duplicates)
- Prints a sample of 5 records from the database for testing
- MongoDB connection issues?
- Ensure your MongoDB Atlas cluster is active.
- Check that your MONGO_URI in
.env
is correct. - Make sure your IP is whitelisted in MongoDB Atlas.
This detects macroeconomic spikes and sends email alerts when significant changes occur.
cd backend
python -m venv venv
source venv/bin/activate # For Mac/Linux
venv\Scripts\activate # For Windows
pip install -r requirements.txt
Create a .env
file in the backend
directory with the following:
MONGO_URI=mongodb://localhost:27017/your_db
SECRET_KEY=your_secret_key
SMTP_SENDER[email protected]
SMTP_RECEIVER[email protected]
SMTP_APP_PASSWORD=your_app_password
SPIKE_THRESHOLD_PERCENT=0.1
uvicorn app.main:app --reload
celery -A app.services.celery_worker worker --loglevel=info
celery -A app.services.celery_worker beat --loglevel=info
curl -X POST "http://localhost:8000/trigger-cpi-check"
If a spike is detected, an email alert will be sent, and logs will appear in the terminal.
Tranche data is aggregated to generate an AI-powered securitization report, guiding investors on risk metrics. The backend pipeline for same:
The user authentication flow illustrates the authentication process:
The user flow illustrates the key interactions with ABSecure’s functionalities: