Spaces:
Running
Running
| import os | |
| def write_f(path, content): | |
| os.makedirs(os.path.dirname(path), exist_ok=True) | |
| with open(path, 'w', encoding='utf-8') as f: | |
| f.write(content.strip() + '\n') | |
| # ================= MODULE: DEBT ================= | |
| debt_restructuring = ''' | |
| from dataclasses import dataclass, field | |
| from typing import List, Optional | |
| @dataclass | |
| class Debt: | |
| debt_id: str | |
| name: str | |
| outstanding_balance: float | |
| monthly_rate_pct: float | |
| monthly_payment: float | |
| months_remaining: int | |
| lender: str = "" | |
| is_secured: bool = False | |
| penalty_for_early_repayment: float = 0.0 | |
| class DebtRestructuringEngine: | |
| pass | |
| debt_engine = DebtRestructuringEngine() | |
| ''' | |
| # ================= MODULE: WORKING CAPITAL ================= | |
| working_capital = ''' | |
| from dataclasses import dataclass | |
| @dataclass | |
| class WorkingCapitalSnapshot: | |
| cash: float = 0.0 | |
| accounts_receivable: float = 0.0 | |
| inventory: float = 0.0 | |
| other_current_assets: float = 0.0 | |
| accounts_payable: float = 0.0 | |
| short_term_debt: float = 0.0 | |
| accrued_expenses: float = 0.0 | |
| monthly_revenue: float = 0.0 | |
| monthly_cogs: float = 0.0 | |
| monthly_purchases: float = 0.0 | |
| class WorkingCapitalOptimizer: | |
| pass | |
| wc_optimizer = WorkingCapitalOptimizer() | |
| ''' | |
| # ================= MODULE: FORENSIC ================= | |
| forensic_analyzer = ''' | |
| import math | |
| from collections import Counter | |
| from dataclasses import dataclass, field | |
| from typing import List, Optional | |
| @dataclass | |
| class Transaction: | |
| tx_id: str | |
| date: str | |
| amount: float | |
| payee: str | |
| payee_pin: str = "" | |
| payee_nssf: str = "" | |
| approved_by: str = "" | |
| paid_by: str = "" | |
| description: str = "" | |
| account_code: str = "" | |
| class ForensicAnalyzer: | |
| pass | |
| forensic_analyzer = ForensicAnalyzer() | |
| ''' | |
| # ================= MODULE: REPORTING ================= | |
| ifrs_reporting = ''' | |
| class IFRSReportingEngine: | |
| pass | |
| ifrs_engine = IFRSReportingEngine() | |
| ''' | |
| # ================= MODULE: REMITTANCES ================= | |
| remittances_corridor = ''' | |
| from dataclasses import dataclass, field | |
| from typing import List | |
| @dataclass | |
| class RemittanceCorridor: | |
| from_country: str | |
| from_currency: str | |
| to_country: str = "KE" | |
| to_currency: str = "KES" | |
| class RemittanceEngine: | |
| pass | |
| remittance_engine = RemittanceEngine() | |
| ''' | |
| # ================= MODULE: PENSIONS ================= | |
| pensions_retirement = ''' | |
| from dataclasses import dataclass | |
| @dataclass | |
| class RetirementProfile: | |
| current_age: int | |
| retirement_age: int = 60 | |
| current_monthly_salary: float = 0.0 | |
| monthly_nssf_contribution: float = 0.0 | |
| monthly_pension_contribution: float = 0.0 | |
| current_pension_savings: float = 0.0 | |
| expected_inflation_pct: float = 6.0 | |
| expected_investment_return_pct: float = 10.0 | |
| class PensionEngine: | |
| pass | |
| pension_engine = PensionEngine() | |
| ''' | |
| # ================= MODULE: ISLAMIC FINANCE ================= | |
| islamic_products = ''' | |
| class IslamicFinanceEngine: | |
| pass | |
| islamic_finance_engine = IslamicFinanceEngine() | |
| ''' | |
| # ================= MODULE: CONSUMER CREDIT ================= | |
| consumer_credit = ''' | |
| from dataclasses import dataclass, field | |
| from typing import List | |
| @dataclass | |
| class ConsumerCreditProfile: | |
| monthly_income: float | |
| monthly_fixed_expenses: float | |
| existing_monthly_debt_payments: float = 0.0 | |
| credit_score: int = 0 | |
| class ConsumerCreditEngine: | |
| pass | |
| consumer_credit_engine = ConsumerCreditEngine() | |
| ''' | |
| # ================= MODULE: CORPORATE FINANCE ================= | |
| corporate_ma = ''' | |
| class MAEngine: | |
| pass | |
| ma_engine = MAEngine() | |
| ''' | |
| # ================= MODULE: TREASURY INSTRUMENTS ================= | |
| treasury_instruments = ''' | |
| from dataclasses import dataclass, field | |
| from typing import List, Optional | |
| from datetime import date, timedelta | |
| import math | |
| @dataclass | |
| class TBillPosition: | |
| amount: float | |
| tenor_days: int | |
| yield_pct: float | |
| purchase_date: str | |
| maturity_date: str = "" | |
| @dataclass | |
| class MMFPosition: | |
| name: str | |
| amount: float | |
| annual_yield_pct: float | |
| management_fee_pct: float = 0.5 | |
| class TreasuryInstrumentsEngine: | |
| pass | |
| treasury_engine = TreasuryInstrumentsEngine() | |
| ''' | |
| write_f('senti/core/engines/debt/restructuring.py', debt_restructuring) | |
| write_f('senti/core/engines/working_capital/optimizer.py', working_capital) | |
| write_f('senti/core/engines/forensic/analyzer.py', forensic_analyzer) | |
| write_f('senti/core/engines/treasury/instruments.py', treasury_instruments) | |
| write_f('senti/core/engines/reporting/ifrs.py', ifrs_reporting) | |
| write_f('senti/core/engines/remittances/corridor.py', remittances_corridor) | |
| write_f('senti/core/engines/pensions/retirement.py', pensions_retirement) | |
| write_f('senti/core/engines/islamic_finance/products.py', islamic_products) | |
| write_f('senti/core/engines/consumer_credit/bnpl.py', consumer_credit) | |
| write_f('senti/core/engines/corporate_finance/ma.py', corporate_ma) | |
| print("Created all missing engine files.") | |