Writing

Data Engineering, Data Science, Quantitative Analytics and Islamic Finance

In-depth writing on data engineering, quantitative finance, Islamic capital markets, and building production data systems in financial services.

26 posts

Shariah-Compliant Algorithmic Trading Formula Sheet

A complete reference sheet adapting the eight core algorithmic trading metrics — Sharpe Ratio, VaR, CVaR, Sortino Ratio, Expectancy, MAE, Drawdown, and Calmar Ratio — for Shariah-compliant portfolios. Every formula is reworked to eliminate riba-based inputs, incorporate purification adjustments, and reflect Islamic risk principles. Full Python implementation with computed outputs.

Read

Building a Centralised ICD-10-CM Dataset: Daily Extraction from CMS

ICD-10-CM contains over 72,000 diagnostic codes spread across 22 chapters and ~2,100 blocks. This post walks through extracting the full code set from the CMS official release into a structured, queryable JSON dataset — refreshed automatically every night via GitHub Actions.

Read

Towards a Modern Takaful Data Platform

A practitioner's perspective on cloud-native architecture, AI activation, and the future of Islamic insurance data infrastructure.

Read

Building the Quant Stack from Zero to One

A complete blueprint for designing and deploying a systematic trading system: data pipeline, backtesting framework, execution infrastructure, signal layer, and the monetisation of trading flow. Written for practitioners building the full stack, not just running notebooks.

Read

What Breaks If This Data Is Wrong

A single diagnostic question cuts through every data governance framework, every data quality initiative, and every ownership debate. What would break if this data was wrong? The answer tells you whether a piece of data is critical, and whether your organisation actually governs it.

Read

Building a Shariah Equity Screener for the S&P 500

How we built a systematic Shariah compliance screener for US equities, what the AAOIFI thresholds actually mean, how they differ from SC Malaysia's approach, and why 0 compliant out of 310 was a useful debugging signal rather than a theological statement.

Read

Monte Carlo Simulation on Malaysian Shariah Equities: A Practitioner's Guide

Applying Monte Carlo simulation to the FTSE Bursa Malaysia Hijrah Shariah Index and its constituents from GBM path generation and VaR estimation to portfolio stress testing and takaful reserve adequacy. Full Python implementation with interactive charts.

Read

Machine Learning, Herding, and Permissible Trading Signals in Islamic Equities

Herding behavior when investors abandon their own analysis to follow the crowd is measurable, predictable, and more structurally pronounced in Islamic equity markets due to a smaller eligible universe and homogeneous investor base. Neural networks and sentiment analysis detect it earlier than classical regression. Here's the full framework, the code, and a complete backtested scenario.

Read

Beyond Normal: Cornish-Fisher Expansion and Tail Risk in Islamic Equity Portfolios

Standard VaR assumes normally distributed returns. Islamic equity portfolios structurally screened, lower-leverage, sector-concentrated have return distributions that are decidedly non-normal. The Cornish-Fisher expansion within a four-moment framework gives you a more honest picture of tail risk. Here's the mathematics, a full Python implementation, and what it reveals about Islamic equity indices under market stress.

Read

Breaking CAPM: How Maqasid Al-Shariah Rewires the Asset Pricing Model

The Capital Asset Pricing Model has a foundational riba problem its risk-free rate is built on interest. The Maqasid al-Shariah Compliance Asset Pricing Model replaces that foundation with Islamic wealth distribution logic and investor sentiment. Here's the mathematics, the implications, and a Python implementation.

Read

Shariah-Compliant Portfolio Optimization: When Fuzzy Logic Meets Islamic Finance

Classical portfolio theory assumes probabilistic risk but Shariah compliance introduces hard binary constraints that break standard optimizers. A genetic algorithm approach using fuzzy semi-spreads offers a principled alternative. Here's why it matters, and how it works.

Read

The 33% Problem: How Quantitative Shariah Screening Shapes Malaysian Portfolio Performance

Shariah screening applies hard binary thresholds 33% on debt ratios, 33% on cash and receivables, 5% on haram revenue. These aren't soft guidelines. They're algorithmic cutoffs that restructure the investable universe and statistically reshape portfolio yield and volatility. Here's the data, the code, and what it means for fund managers.

Read

CERN Is Building the Opposite of GPT And It Might Be More Important

While the AI industry races to make models bigger, CERN is burning microscopic neural networks directly into silicon to filter 40,000 exabytes of particle collision data per year in under 50 nanoseconds. The lessons reach far beyond physics.

Read

Data Governance Is Not a Project. It's a Practice.

Most data governance initiatives fail not because of bad technology, but because they're treated as a one-time implementation rather than an ongoing discipline. Here's what actually works in a regulated financial services environment.

Read

Implementing SCD Type 2 in Pure Polars

Slowly changing dimensions are a solved problem but most implementations lean on Spark or SQL. Here's how to do it cleanly in Polars with about 60 lines of Python.

Read