Skip to main content

Open-source Python toolkit for AML detection and financial crime analytics — transaction graph analysis, anomaly scoring, SAR pattern matching, and SQL helpers for BSA/FinCEN compliance.

Project description

aml-analytics

Tests Python 3.8+ License: MIT

Open-source Python toolkit for AML detection and financial crime analytics — transaction graph analysis, anomaly scoring, SAR pattern matching, and SQL helpers for BSA/FinCEN compliance.

Built by a financial crimes analytics practitioner for compliance teams and data professionals working in anti-money laundering programs at financial institutions.


Why this exists

Smaller financial institutions often lack the analytics infrastructure to detect sophisticated money laundering patterns. This toolkit provides open, reusable building blocks — grounded in FATF typologies and FinCEN advisories — that any compliance or data team can use to strengthen their AML detection program.


AML typologies covered

Typology Module Reference
Structuring (smurfing) aml/patterns.py FinCEN Advisory FIN-2014-A005
Layering aml/graph.py FATF Typologies Report 2006
Rapid fund movement aml/velocity.py FATF Guidance on AML/CFT 2012
Network-based laundering aml/graph.py FinCEN Advisory FIN-2022-A001
Anomalous transaction behavior aml/anomaly.py FATF Risk-Based Approach 2014

Modules

Module Description
aml/synthetic.py Synthetic AML transaction generator with labeled scenarios
aml/graph.py Transaction network analysis — structuring rings, layering chains, centrality scoring
aml/velocity.py Rolling-window velocity checks for burst activity detection
aml/patterns.py Rules engine implementing FATF and FinCEN typologies
aml/anomaly.py Unsupervised anomaly scoring using Isolation Forest and LOF
aml/sql/ Oracle and PostgreSQL query templates for AML detection

Quick start

from aml.synthetic import generate_transactions
from aml.graph import build_network, detect_structuring, detect_layering

# Generate synthetic transaction data
txns = generate_transactions(n=1000)

# Build a transaction network
G = build_network(txns)

# Detect structuring rings
rings = detect_structuring(G, threshold=9000)

# Detect layering chains
chains = detect_layering(G, min_hops=3)

print(f"Structuring alerts: {len(rings)}")
print(f"Layering alerts:    {len(chains)}")

Installation

pip install aml-analytics

Or install from source:

git clone https://github.com/Bhavesh0205/aml-analytics.git
cd aml-analytics
pip install -e ".[dev]"

Demo notebooks

Notebook Description
notebooks/01_graph_analysis.ipynb Transaction network analysis and layering detection
notebooks/02_anomaly_detection.ipynb Unsupervised anomaly scoring on transaction data
notebooks/03_sar_patterns.ipynb FATF typology rules and SAR pattern matching
notebooks/04_end_to_end_pipeline.ipynb Full AML detection pipeline from raw transactions to alerts

Who this is for

  • Compliance analysts who want to explore analytics-driven AML detection
  • Data engineers building transaction monitoring pipelines at financial institutions
  • Researchers studying financial crime detection methodology
  • FinTech developers building AML capabilities into financial products

Disclaimer

This toolkit is built entirely on synthetic data and public regulatory guidance (FATF, FinCEN). It does not contain any proprietary data, internal model logic, or confidential information from any financial institution. It is intended for educational and research purposes and does not constitute legal or compliance advice.


Citation

If you use this toolkit in your research or work, please cite it as:

@software{aml_analytics,
  author  = {Bhavesh Awalkar},
  title   = {aml-analytics: Open-source toolkit for AML detection and financial crime analytics},
  year    = {2024},
  url     = {https://github.com/Bhavesh0205/aml-analytics},
  license = {MIT}
}

Contributing

Contributions are welcome — especially new typology rules, additional SQL patterns, or improvements to the anomaly scoring module. Please read CONTRIBUTING.md before submitting a pull request.


License

MIT — see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aml_analytics-1.0.0.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aml_analytics-1.0.0-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file aml_analytics-1.0.0.tar.gz.

File metadata

  • Download URL: aml_analytics-1.0.0.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.2

File hashes

Hashes for aml_analytics-1.0.0.tar.gz
Algorithm Hash digest
SHA256 cdd0252150bc4d2cb9588d562cd949e0f4e262359aad7474843cf0e11be1d919
MD5 8f6f74cdd61a3c1fe9c2c6baafa2d221
BLAKE2b-256 18f96fd81d36c75e9d32c8bb91bae1720aff847d941fa995c30da35d56f09049

See more details on using hashes here.

File details

Details for the file aml_analytics-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: aml_analytics-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.2

File hashes

Hashes for aml_analytics-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d271281c98834d4ac2cd5eff14d8b3eb1bbfeb895e892d87f139345fc1ade8a1
MD5 c14270f1c775f24d9fd263ad5dbe4303
BLAKE2b-256 37ce5fda6e128f52f1dc997dfe498974685f1430dd8c6a262a245bac0d653c2b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page