Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

datasynth-banking

KYC/AML banking transaction generator for synthetic data.

Overview

datasynth-banking provides comprehensive banking transaction simulation for:

  • Compliance testing and model training
  • AML/fraud detection system evaluation
  • KYC process simulation
  • Regulatory reporting testing

Features

FeatureDescription
Customer GenerationRetail, business, and trust customers with realistic KYC profiles
Account GenerationMultiple account types with proper feature sets
Transaction EnginePersona-based transaction generation with causal drivers
AML TypologiesStructuring, funnel accounts, layering, mule networks, and more
Ground Truth LabelsMulti-level labels for ML training
Spoofing ModeAdversarial transaction generation for robustness testing

Architecture

BankingOrchestrator (orchestration)
        |
Generators (customer, account, transaction, counterparty)
        |
Typologies (AML pattern injection)
        |
Labels (ground truth generation)
        |
Models (customer, account, transaction, KYC)

Module Structure

Models

ModelDescription
BankingCustomerRetail, Business, Trust customer types
BankAccountAccount with type, features, status
BankTransactionTransaction with direction, channel, category
KycProfileExpected activity envelope for compliance
CounterpartyPoolTransaction counterparty management
CaseNarrativeInvestigation and compliance narratives

KYC Profile

#![allow(unused)]
fn main() {
pub struct KycProfile {
    pub declared_purpose: String,
    pub turnover_band: TurnoverBand,
    pub transaction_frequency: TransactionFrequency,
    pub expected_categories: Vec<TransactionCategory>,
    pub source_of_funds: SourceOfFunds,
    pub source_of_wealth: SourceOfWealth,
    pub geographic_exposure: Vec<String>,
    pub cash_intensity: CashIntensity,
    pub beneficial_owner_complexity: OwnerComplexity,
    // Ground truth fields
    pub is_deceiving: bool,
    pub actual_turnover_band: Option<TurnoverBand>,
}
}

AML Typologies

TypologyDescription
StructuringTransactions below reporting thresholds ($10K)
Funnel AccountsMultiple small deposits, few large withdrawals
LayeringComplex transaction chains to obscure origin
Mule NetworksMoney mule payment chains
Round-TrippingCircular transaction patterns
Credit Card FraudFraudulent card transactions
Synthetic IdentityFake identity transactions
SpoofingAdversarial patterns for model testing

Labels

Label TypeDescription
Entity LabelsCustomer-level risk classifications
Relationship LabelsRelationship risk indicators
Transaction LabelsTransaction-level classifications
Narrative LabelsInvestigation case narratives

Usage Examples

Basic Generation

#![allow(unused)]
fn main() {
use synth_banking::{BankingOrchestrator, BankingConfig};

let config = BankingConfig::default();
let mut orchestrator = BankingOrchestrator::new(config, 12345);

// Generate customers and accounts
let customers = orchestrator.generate_customers();
let accounts = orchestrator.generate_accounts(&customers);

// Generate transaction stream
let transactions = orchestrator.generate_transactions(&accounts);
}

With AML Typologies

#![allow(unused)]
fn main() {
use synth_banking::{BankingConfig, TypologyConfig};

let config = BankingConfig {
    customer_count: 1000,
    typologies: TypologyConfig {
        structuring_rate: 0.02,   // 2% structuring patterns
        funnel_rate: 0.01,        // 1% funnel accounts
        mule_rate: 0.005,         // 0.5% mule networks
        ..Default::default()
    },
    ..Default::default()
};
}

Accessing Labels

#![allow(unused)]
fn main() {
let labels = orchestrator.generate_labels();

// Entity-level labels
for entity_label in &labels.entity_labels {
    println!("Customer {} risk: {:?}",
        entity_label.customer_id,
        entity_label.risk_tier
    );
}

// Transaction-level labels
for tx_label in &labels.transaction_labels {
    if tx_label.is_suspicious {
        println!("Suspicious: {} - {:?}",
            tx_label.transaction_id,
            tx_label.typology
        );
    }
}
}

Key Types

Customer Types

#![allow(unused)]
fn main() {
pub enum BankingCustomerType {
    Retail,     // Individual customers
    Business,   // Business accounts
    Trust,      // Trust/corporate entities
}
}

Risk Tiers

#![allow(unused)]
fn main() {
pub enum RiskTier {
    Low,
    Medium,
    High,
    Prohibited,
}
}

Transaction Categories

#![allow(unused)]
fn main() {
pub enum TransactionCategory {
    SalaryWages,
    BusinessPayment,
    Investment,
    RealEstate,
    Gambling,
    Cryptocurrency,
    CashDeposit,
    CashWithdrawal,
    WireTransfer,
    AtmWithdrawal,
    PosPayment,
    OnlinePayment,
    // ... more categories
}
}

AML Typologies

#![allow(unused)]
fn main() {
pub enum AmlTypology {
    Structuring,
    Funnel,
    Layering,
    Mule,
    RoundTripping,
    CreditCardFraud,
    SyntheticIdentity,
    None,
}
}

Export Files

FileDescription
banking_customers.csvCustomer profiles with KYC data
bank_accounts.csvAccount records with features
bank_transactions.csvTransaction records
kyc_profiles.csvExpected activity envelopes
counterparties.csvCounterparty pool
entity_risk_labels.csvEntity-level risk classifications
transaction_risk_labels.csvTransaction-level labels
aml_typology_labels.csvAML typology ground truth

See Also