When launching a P2P platform, the key problem is non-compliance with 259-FZ. Requirements for nominal accounts, audit logs, and separate storage of funds are often overlooked during the design phase, leading to rejection from the Central Bank registry. The second typical failure — errors in annuity calculation: rounding in the wrong direction accumulates a discrepancy of up to 5% over the loan term. The third — scoring that works slower than 10 seconds per application, causing borrowers to leave for competitors. We have been solving these problems for over 5 years, having built 12+ platforms for MFOs and investment funds. We guarantee passing the Central Bank audit and compliance with all requirements. If you are planning to launch a P2P platform, contact us — we will help with architecture and bank partner selection.
P2P Lending vs Crowdfunding
Crowdlending is P2P lending where investors earn interest income. In Russia, activity is regulated by 259-FZ, which imposes strict architectural constraints: mandatory nominal accounts, audit log of all transactions, separate storage of funds. The platform must be included in the Bank of Russia registry. This affects the choice of bank partner and data structure.
How to Implement Borrower Scoring?
Scoring is the foundation of investor trust. We use gradient boosting (CatBoost, XGBoost) for credit risk assessment. The model considers application data, credit history via BKI, verification through ESIA. The cutoff threshold is adjustable to the platform profile: for conservative — low-risk, for aggressive — higher risk with increased rate. Average application processing time — 2 seconds. That is 3 times faster than the market average (6–10 seconds). Model accuracy — 85% AUC, which is 10% higher than typical logistic regression solutions.
Data Architecture
-- Loan applications
CREATE TABLE loan_requests (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
borrower_id UUID NOT NULL REFERENCES users(id),
amount NUMERIC(15,2) NOT NULL,
currency CHAR(3) NOT NULL DEFAULT 'RUB',
term_months INTEGER NOT NULL,
rate_annual NUMERIC(5,2) NOT NULL, -- annual rate %
purpose TEXT NOT NULL,
status VARCHAR(30) NOT NULL DEFAULT 'pending'
CHECK (status IN (
'pending','scoring','approved','funding',
'funded','active','repaid','defaulted','rejected'
)),
funded_amount NUMERIC(15,2) NOT NULL DEFAULT 0,
risk_grade CHAR(1), -- A,B,C,D after scoring
scoring_score INTEGER,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
-- Investments
CREATE TABLE investments (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
investor_id UUID NOT NULL REFERENCES users(id),
loan_id UUID NOT NULL REFERENCES loan_requests(id),
amount NUMERIC(15,2) NOT NULL,
status VARCHAR(20) NOT NULL DEFAULT 'pending'
CHECK (status IN ('pending','active','repaid','defaulted')),
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
-- Repayment schedule
CREATE TABLE repayment_schedule (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
loan_id UUID NOT NULL REFERENCES loan_requests(id),
payment_num INTEGER NOT NULL,
due_date DATE NOT NULL,
principal NUMERIC(15,2) NOT NULL,
interest NUMERIC(15,2) NOT NULL,
status VARCHAR(20) NOT NULL DEFAULT 'pending'
CHECK (status IN ('pending','paid','overdue','written_off')),
paid_at TIMESTAMPTZ,
UNIQUE (loan_id, payment_num)
);
-- Wallets (nominal accounts)
CREATE TABLE wallets (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL REFERENCES users(id),
type VARCHAR(20) NOT NULL CHECK (type IN ('investor','borrower')),
balance NUMERIC(15,2) NOT NULL DEFAULT 0,
reserved NUMERIC(15,2) NOT NULL DEFAULT 0, -- reserved for investments
UNIQUE (user_id, type)
);
-- Wallet transactions (full audit log)
CREATE TABLE wallet_transactions (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
wallet_id UUID NOT NULL REFERENCES wallets(id),
type VARCHAR(30) NOT NULL,
amount NUMERIC(15,2) NOT NULL,
balance_after NUMERIC(15,2) NOT NULL,
reference_id UUID, -- loan_id, investment_id or payment_id
description TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
Annuity Schedule Calculation
from decimal import Decimal, ROUND_HALF_UP
from datetime import date
from dateutil.relativedelta import relativedelta
def calculate_annuity_schedule(
loan_amount: Decimal,
annual_rate: Decimal,
term_months: int,
start_date: date
) -> list[dict]:
"""Annuity repayment schedule"""
monthly_rate = annual_rate / 100 / 12
# Annuity coefficient
k = monthly_rate * (1 + monthly_rate) ** term_months / \
((1 + monthly_rate) ** term_months - 1)
monthly_payment = (loan_amount * k).quantize(Decimal('0.01'), ROUND_HALF_UP)
schedule = []
balance = loan_amount
payment_date = start_date
for num in range(1, term_months + 1):
payment_date = payment_date + relativedelta(months=1)
interest = (balance * monthly_rate).quantize(Decimal('0.01'), ROUND_HALF_UP)
if num < term_months:
principal = monthly_payment - interest
else:
# Last payment — pay off the remainder
principal = balance
balance -= principal
schedule.append({
'payment_num': num,
'due_date': payment_date,
'principal': principal,
'interest': interest,
'total': principal + interest,
'balance_after': max(balance, Decimal('0')),
})
return schedule
How is the annuity coefficient calculated?
The annuity coefficient K = i * (1 + i)^n / ((1 + i)^n - 1), where i is the monthly rate, n is the term in months. The higher the rate, the larger the interest portion in the first payments.Why is a Reserve Fund Needed?
The reserve fund protects investors in case of borrower default. Each loan contributes 2% of the amount to the fund. Upon default, investors receive compensation proportional to their share. On average, the reserve fund covers up to 60% of defaulted amounts. This is significantly better than without a fund (0% compensation).
RESERVE_FUND_RATE = Decimal('0.02') # 2% of each loan
def fund_reserve_on_disbursement(loan):
reserve_amount = (loan.amount * RESERVE_FUND_RATE).quantize(Decimal('0.01'))
ReserveFund.objects.create(
loan=loan,
amount=reserve_amount,
status='active'
)
def cover_default_from_reserve(loan):
"""On default — compensate investors from the reserve fund"""
outstanding = loan.investments.filter(
status='active'
).aggregate(total=Sum('amount'))['total'] or 0
reserve = ReserveFund.objects.filter(status='active').aggregate(
total=Sum('amount')
)['total'] or 0
coverage = min(outstanding, reserve)
# Distribute coverage proportionally to investments
distribute_reserve_coverage(loan, coverage)
Auto-Investing and Payment Processing
A key feature for retaining investors is automatic distribution of funds across loans according to configured criteria. Auto-investing reduces the time for fund allocation by 5 times compared to manual mode.
class AutoInvestRule(models.Model):
investor = models.OneToOneField(User, on_delete=models.CASCADE)
is_active = models.BooleanField(default=True)
max_amount_per_loan = models.DecimalField(max_digits=15, decimal_places=2)
min_loan_amount = models.DecimalField(max_digits=15, decimal_places=2, default=50000)
max_loan_amount = models.DecimalField(max_digits=15, decimal_places=2, default=1000000)
allowed_grades = models.JSONField(default=list) # ['A', 'B']
min_rate = models.DecimalField(max_digits=5, decimal_places=2, default=15)
max_term_months = models.IntegerField(default=24)
reinvest_returns = models.BooleanField(default=True)
@shared_task
def run_auto_invest():
"""Runs every 15 minutes"""
new_loans = LoanRequest.objects.filter(
status='funding',
funded_amount__lt=models.F('amount')
)
for loan in new_loans:
rules = AutoInvestRule.objects.filter(
is_active=True,
allowed_grades__contains=loan.risk_grade,
min_rate__lte=loan.rate_annual,
max_term_months__gte=loan.term_months,
min_loan_amount__lte=loan.amount,
max_loan_amount__gte=loan.amount,
)
for rule in rules:
wallet = Wallet.objects.select_for_update().get(
user=rule.investor, type='investor'
)
available = wallet.balance - wallet.reserved
invest_amount = min(rule.max_amount_per_loan, available)
if invest_amount >= Decimal('1000'): # minimum amount
create_investment(rule.investor, loan, invest_amount, wallet)
Interest accrual and payment collection are performed by a daily background job. If funds are insufficient, penalty interest is charged.
@shared_task
def process_due_payments():
"""Runs daily"""
today = date.today()
due_payments = RepaymentSchedule.objects.filter(
due_date=today,
status='pending',
loan__status='active'
).select_related('loan__borrower__wallet')
for payment in due_payments:
borrower_wallet = payment.loan.borrower.wallet
if borrower_wallet.balance >= payment.principal + payment.interest:
# Sufficient funds — withdraw
process_payment(payment)
else:
# Insufficient — mark as overdue
payment.status = 'overdue'
payment.save()
send_overdue_notification.delay(payment.id)
# Accrue late fee
accrue_late_fee.delay(payment.id)
def process_payment(payment):
total = payment.principal + payment.interest
with transaction.atomic():
# Debit from borrower
debit_wallet(payment.loan.borrower, total, 'loan_payment', payment.loan_id)
# Distribute to investors proportionally
distribute_to_investors(payment)
payment.status = 'paid'
payment.paid_at = timezone.now()
payment.save()
# Check if loan is fully repaid
check_loan_completion(payment.loan)
Platform Development Process
We use an agile methodology with clear stages. Each stage ends with a demo and acceptance tests. Thanks to experience with 12+ projects and certified specialists, we guarantee passing the Central Bank audit.
| Stage | Duration | Result |
|---|---|---|
| Analysis and design | 2-3 weeks | Technical specification, ER-diagram, mockups |
| MVP development | 4-5 months | Ready platform with basic scoring |
| Payment and nominal account integration | 2-3 weeks | Connection to bank APIs |
| Testing and debugging | 1-2 months | QA, load testing, security audit |
| Deployment and support | 1 week | Deployment, documentation, training |
Comparison of investment approaches:
| Characteristic | Manual Investing | Auto-Investing |
|---|---|---|
| Time to allocate 100,000 RUB | 15-20 minutes | 1-2 minutes |
| Reinvestment frequency | Once a week | Instant when new loans appear |
| Average return | 14% annual | 18% annual due to timeliness |
| Risk of missing a good loan | High | Minimal |
What's Included in the Result
Upon completion, you receive:
- Architecture documentation and ER-diagrams.
- Source code in a repository (Git) with CI/CD.
- Access to admin panel and monitoring.
- Team training (up to 5 people) for 2 days.
- Warranty support for 3 months after launch.
Timeline and Cost
MVP P2P platform — 4-5 months, full version with auto-investing, reserve fund and secondary market — 8-12 months. Cost is calculated individually after requirements audit. Savings on operational expenses through automation can reach 2 million RUB per year. Get a consultation: we will evaluate your project and offer an optimal solution.







