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 PyPI version Downloads 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.1.tar.gz (19.3 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.1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aml_analytics-1.0.1.tar.gz
  • Upload date:
  • Size: 19.3 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.1.tar.gz
Algorithm Hash digest
SHA256 5d54693752e83e4870ec2b066d96609ce486de86f42db57959a9e907cf825407
MD5 92b7550267cda65970c35cbdc32a68e4
BLAKE2b-256 b93254e204130c18d526fac737ba4f6c49552130471161c124b93abd2fb25158

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aml_analytics-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 17.4 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6d84309cfa1818050ed3231da2ac5ebc6a17ba90b2d144aa533ff29ca45c1b3e
MD5 45309ef2e82e7935ea8d5542285b722a
BLAKE2b-256 3097f3334edb27008560a3e2fa2892bbac7bee897dc61ab7ec1ed2ddf2090c66

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