<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Emmanuel Robert on Medium]]></title>
        <description><![CDATA[Stories by Emmanuel Robert on Medium]]></description>
        <link>https://medium.com/@emmanuelrobert2233?source=rss-049e09b466f8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ANHAxQJcOaQQ5gco4BLfIg.png</url>
            <title>Stories by Emmanuel Robert on Medium</title>
            <link>https://medium.com/@emmanuelrobert2233?source=rss-049e09b466f8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 14:41:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@emmanuelrobert2233/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Moving Beyond Manual Spreadsheet Tweaks: Building a Python Sensitivity Analysis for a Solid…]]></title>
            <link>https://medium.com/@emmanuelrobert2233/moving-beyond-manual-spreadsheet-tweaks-building-a-python-sensitivity-analysis-for-a-solid-8f3b1af99d5e?source=rss-049e09b466f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f3b1af99d5e</guid>
            <category><![CDATA[python-libraries]]></category>
            <category><![CDATA[financial-modeling]]></category>
            <category><![CDATA[excel]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Emmanuel Robert]]></dc:creator>
            <pubDate>Tue, 01 Dec 2026 21:22:02 GMT</pubDate>
            <atom:updated>2026-12-01T21:22:02.092Z</atom:updated>
            <content:encoded><![CDATA[<h3>Moving Beyond Manual Spreadsheet Tweaks: Building a Python Sensitivity Analysis for a Solid Minerals Export Feasibility Model</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*566Iku32AWaQNo7psB7m2A.png" /></figure><p>Excel is an effective starting point for financial modelling. It provides a structured way to build a 12-month Profit &amp; Loss (P&amp;L) statement, track production volumes, account for operating costs and establish a baseline financial position.</p><p>The challenge becomes more apparent when the analysis moves beyond a single set of assumptions. Questions about how commodity prices, exchange rates and operating costs interact can quickly lead to repetitive manual adjustments across multiple spreadsheet cells. When several variables need to be tested at once, maintaining consistency and tracking results becomes increasingly cumbersome.</p><p>I encountered this while working on a 12-month financial feasibility model for a solid minerals export operation (03_12M_PnL_Model). Rather than continue adjusting spreadsheet inputs manually, I wanted a more reproducible way to examine how changes in gold prices and the USD/NGN exchange rate could affect profitability.</p><p>I used Python, alongside openpyxl, pandas, matplotlib and seaborn, to replicate the Excel model’s calculations and automate the sensitivity analysis.</p><p>The Python implementation first reproduced the Excel baseline EBITDA of <strong>$7,307,903.41</strong>. After validating the baseline, I evaluated 25 combinations of gold prices and exchange rates, exported the results to CSV and generated a heatmap to make each scenario’s financial impact easier to interpret.</p><h3>1. Understanding the Business Model and Its Financial Assumptions</h3><p>The model covers four mineral streams: gold, local lead, international lead and lithium. These revenue streams do not all operate in the same currency.</p><p>Gold revenue and its associated cost are denominated directly in USD, while the other mineral streams and operating expenses are calculated in Nigerian Naira (NGN). This distinction matters because changes in the exchange rate affect how the Naira-denominated figures translate into the model’s USD reporting currency. The baseline assumptions are as follows:</p><p><strong>Gold — USD-denominated revenue and costs</strong></p><ul><li>Annual production volume: 660 kg</li><li>Base selling price: $115,000/kg</li><li>Unit cost of goods sold (COGS): $103,700/kg</li></ul><p>Gold is priced directly in USD, so its revenue and COGS are calculated without first converting from Naira.</p><h4><strong>Naira-denominated mineral streams and operating expenses</strong></h4><p>The remaining production volumes and their associated financial assumptions are:</p><ul><li>Local lead: 78 tonnes</li><li>International lead: 267 tonnes</li><li>Lithium: 270 tonnes</li><li>Monthly operating expenses: ₦30,000,000</li><li>Annualised operating expenses: ₦360,000,000</li></ul><p>These items are calculated in NGN and then converted into USD using the applicable exchange rate. The base-case exchange rate is 1,400 NGN/USD.</p><h4><strong>Export pricing and markup assumptions</strong></h4><p>The model also applies different pricing approaches across the mineral streams:</p><ul><li>Local lead has a selling price of ₦2,500,000/tonne, against a COGS of ₦2,205,000/tonne.</li><li>International lead has a COGS of ₦2,205,000/tonne, with its export selling price calculated using a 1.115x multiplier.</li><li>Lithium has a COGS of ₦1,905,000/tonne, also using a 1.115x multiplier for export pricing.</li></ul><p>The multiplier represents an 11.5% markup over COGS.</p><p>With these assumptions, the model needs to account for two distinct exposures: changes in the USD-denominated gold margin and changes in the USD value of Naira-denominated revenue, costs and overheads.</p><p>The objective of the sensitivity analysis was to examine how these variables interact and what their combined effect could mean for 12-month EBITDA.</p><h3>2. Reproducing and Validating the Excel Model in Python</h3><p>Before introducing alternative scenarios, I wanted to establish that the Python implementation returned the same baseline result as the original Excel model.</p><p>This was an important step. A sensitivity analysis is only useful if its underlying calculation is consistent with the financial model it is intended to represent. Automating an incorrect calculation would simply make errors easier to reproduce.</p><p>I used openpyxl to read the existing Excel workbook. With load_workbook(…, data_only=True), the script retrieves cached cell values rather than formula expressions.</p><p>The relevant production volumes are stored in rows 6–9, across columns 2–13, representing the model’s 12 months. A helper function, get_12months_volumes(), aggregates these values to provide the annual volumes required by the calculation.</p><p>I then implemented calc_ebitda(volumes, gold_price_usd, fx_rate) to reproduce the spreadsheet’s revenue, COGS and operating expense calculations.</p><pre>def calc_ebitda(volumes, gold_price_usd, fx_rate):<br>    gold_kg = volumes[&quot;gold_kg&quot;]<br>    lead_local_t = volumes[&quot;lead_local_t&quot;]<br>    lead_intl_t = volumes[&quot;lead_intl_t&quot;]<br>    lithium_t = volumes[&quot;lithium_t&quot;]<br><br>    # Gold (USD)<br>    gold_rev_usd = gold_kg * gold_price_usd<br>    gold_cogs_usd = gold_kg * 103_700<br><br>    # Local &amp; International Lead, Lithium (NGN)<br>    lead_local_cogs_ngn = lead_local_t * 2_205_000<br>    lead_local_rev_ngn = lead_local_t * 2_500_000<br><br>    lead_intl_cogs_ngn = lead_intl_t * 2_205_000<br>    lead_intl_rev_ngn = lead_intl_cogs_ngn * 1.115<br><br>    lith_cogs_ngn = lithium_t * 1_905_000<br>    lith_rev_ngn = lith_cogs_ngn * 1.115<br><br>    ngn_rev = lead_local_rev_ngn + lead_intl_rev_ngn + lith_rev_ngn<br>    ngn_cogs = lead_local_cogs_ngn + lead_intl_cogs_ngn + lith_cogs_ngn<br><br>    # Convert NGN items to USD and compute 12M EBITDA<br>    total_rev_usd = gold_rev_usd + (ngn_rev / fx_rate)<br>    total_cogs_usd = gold_cogs_usd + (ngn_cogs / fx_rate)<br>    annual_opex_usd = (30_000_000 * 12) / fx_rate<br>    return total_rev_usd - total_cogs_usd - annual_opex_usd</pre><p>The function separates the calculations by currency. Gold revenue and COGS are calculated directly in USD, while the other mineral streams are first calculated in NGN. The resulting Naira revenue, COGS and annual operating expenses are then converted into USD using the exchange rate supplied to the function.</p><p>Finally, EBITDA is calculated by subtracting total COGS and annual operating expenses from total revenue.</p><p>Using the base-case inputs of $115,000/kg for gold and 1,400 NGN/USD for the exchange rate, the Python function returns:</p><p><strong>12-month EBITDA: $7,307,903.41</strong></p><p>This matches the baseline result in the Excel P&amp;L model. That agreement gave me a consistent starting point for testing alternative assumptions.</p><h3>3. Automating the 25-Scenario Sensitivity Analysis</h3><p>After validating the baseline calculation, I examined how profitability changes when gold prices and exchange rates move away from their base-case values.</p><p>I selected five gold price assumptions and five exchange rate assumptions.</p><p><strong>Gold price scenarios (USD/kg):</strong></p><ul><li>$100,000/kg, $107,500/kg, $115,000/kg, $122,500/kg, $130,000/kg</li></ul><p><strong>Exchange rate scenarios (NGN/USD):</strong></p><ul><li>1,200 , 1,325 , 1,400 , 1,475 , 1,550</li></ul><p>Combining the two ranges produces 25 scenarios. Rather than recalculate each combination manually, I used nested Python loops to pass every gold price and exchange rate pairing to calc_ebitda().</p><p>For each scenario, the script records four values:</p><ul><li>fx_rate: the exchange rate being tested.</li><li>gold_price_usd: the assumed gold selling price.</li><li>ebitda_usd: the resulting 12-month EBITDA.</li><li>diff_from_base_usd: the absolute difference between scenario EBITDA and the validated baseline.</li></ul><p>The resulting dataset is exported to:</p><p>data/ebitda_sensitivity.csv</p><p>I also used pandas to reshape the scenario data into a matrix and seaborn to generate a heatmap showing how EBITDA responds to changes in the two variables.</p><p>The heatmap is centred around the $7.31 million baseline and saved as:</p><p>assets/ebitda_sensitivity_heatmap.png</p><p>The visual makes it easier to compare scenarios, identify where profitability improves or weakens, and see where the model moves into negative EBITDA territory without having to interpret 25 separate calculations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PXKwoJSe7eM2XEuTEXfwmA.png" /></figure><p>Figure 1: 12-Month EBITDA Sensitivity Heatmap (USD Millions) generated with Seaborn, illustrating how profitability shifts across 25 gold price and exchange rate scenarios.</p><h3>4. What the Sensitivity Analysis Revealed</h3><p>The 25 scenarios show how exposed the model is to changes in gold prices and the exchange rate. Two observations stood out: across the tested range, gold price movements have a considerably larger effect on EBITDA, while exchange rate movements produce a much smaller net change.</p><p><strong>1. Gold price is the dominant profitability driver</strong></p><p>At a constant exchange rate of 1,400 NGN/USD, increasing the gold price from $115,000/kg to $122,500/kg adds $4,950,000.00 to 12-month EBITDA.</p><p>The calculation is straightforward:</p><p>660 kg × $7,500 = $4,950,000</p><p>This raises EBITDA from $7,307,903.41 to $12,257,903.41.</p><p>At $130,000/kg, EBITDA increases to $17,207,903.41, an improvement of $9,900,000.00 over the base case.</p><p>The result illustrates how strongly the project’s profitability responds to gold prices. Given the production volume in the model, even relatively moderate price movements translate into substantial changes in annual EBITDA.</p><p><strong>2. Exchange rate movements have a smaller net impact</strong></p><p>Holding the gold price constant at $115,000/kg, I examined how changes in the exchange rate affect the Naira-denominated components of the model.</p><p>At 1,550 NGN/USD, 12-month EBITDA increases by $14,525.48, reaching $7,322,428.89.</p><p>At 1,200 NGN/USD, EBITDA decreases by $25,016.10, falling to $7,282,887.31.</p><p>These movements are considerably smaller than those produced by the tested gold price scenarios.</p><p>The exchange rate affects the USD translation of both Naira-denominated revenue and costs. Its net effect therefore depends on the difference between those components, rather than on revenue or costs in isolation.</p><p>Within the tested assumptions, the resulting change in EBITDA is relatively limited.</p><p><strong>3. A clear downside threshold emerges at $100,000/kg gold</strong></p><p>The most important downside result appears at the lowest gold price tested. At $100,000/kg, 12-month EBITDA becomes negative across all five exchange rate scenarios.</p><p>The results range from:</p><ul><li>-$2,617,112.69 at 1,200 NGN/USD</li><li>-$2,577,571.11 at 1,550 NGN/USD</li></ul><p>Although the exchange rate changes, the model remains loss-making throughout this gold price range.</p><p>This is an important distinction for decision-makers. Under the assumptions used in this model, exchange rate movements do not compensate for the reduction in gold revenue at $100,000/kg.</p><p>The results point to gold price exposure as the more significant profitability risk within the tested scenarios. Managing gold procurement margins and exposure to commodity price movements deserves considerably more attention than relying on short-term FX movements to protect the project’s profitability.</p><h3>5. Final Thoughts</h3><p>This exercise was a practical example of extending an existing Excel financial model with Python rather than replacing the spreadsheet.</p><p>Excel provided the original financial structure and baseline assumptions. Python made it possible to reproduce the calculations, validate the baseline and evaluate multiple combinations of gold prices and exchange rates without repeatedly changing spreadsheet inputs.</p><p>The CSV export provides a reusable scenario dataset, while the heatmap makes the results easier to communicate and interpret.</p><p>More importantly, the analysis helped distinguish between two sources of financial exposure that might otherwise be discussed together: commodity price risk and currency translation risk. Across the scenarios tested, gold price movements had a much larger influence on EBITDA than exchange rate movements.</p><p>The model is based on defined assumptions and a limited set of scenarios, so its results should be interpreted within those boundaries. This is a sensitivity analysis, not a probability-weighted forecast of future profitability.</p><p>For me, the value of the exercise was not just automating 25 calculations. It was making the financial model easier to test, validate and explain.</p><h3>Explore the Code</h3><p>The Python script, exported sensitivity dataset and supporting project documentation are available in the GitHub repository:</p><p><a href="https://github.com/Robert-Analytics/solid-minerals-export-feasibility">https://github.com/Robert-Analytics/solid-minerals-export-feasibility</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f3b1af99d5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Engineering an Institutional FX Volatility Engine for the Naira: How a 15.55-Sigma]]></title>
            <link>https://medium.com/@emmanuelrobert2233/engineering-an-institutional-fx-volatility-engine-for-the-naira-how-a-15-55-sigma-4fa081a89c6d?source=rss-049e09b466f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fa081a89c6d</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[financial-analysis]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Emmanuel Robert]]></dc:creator>
            <pubDate>Thu, 04 Jun 2026 19:12:50 GMT</pubDate>
            <atom:updated>2026-06-04T19:12:50.413Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8EYcy088YkF8Rwr9_-oHLg.png" /></figure><h3>Engineering an Institutional FX Volatility Engine for the Naira: How a 15.55-Sigma Event Gets Hidden in Your Monthly Report</h3><p><strong>Python · BigQuery SQL · Power BI · Emerging Market Risk Analytics</strong></p><p>Abstract <br>The architecture and results of an automated FX Volatility Analytics Engine designed to examine daily USD/NGN exchange rate behavior from 2022 to 2026 are described in this article. The system detected a 15.55 standard-deviation shock on the day of Nigeria’s June 2023 currency peg removal using log return mathematics, BigQuery SQL window functions, and a Power BI risk dashboard. Standard monthly aggregation reduced this event to an average Z-score of 3.89, effectively removing it from view. This article discusses the dashboard architecture, the quantitative approach, the entire data engineering pipeline, and the implications of risk management for corporate treasury and fintech operations in emerging markets.</p><p><em>GitHub has the complete project code. It takes about twelve minutes to read.</em></p><h3>The Problem With Averages</h3><p>In financial risk management, averages lie. If you stand with one foot in a fire and the other in a bucket of ice, your average temperature is fine. In reality, you are in severe distress. For businesses operating in emerging markets, relying on monthly average exchange rates is the corporate equivalent of this trap and the consequences are not abstract.<br>Consider a company holding $1,000,000 USD equivalent in Naira-denominated payables. Their finance team monitors a standard monthly reporting dashboard. The dashboard shows exchange rate averages, smoothed trend lines, and quarterly variance summaries. On most months, this is adequate. But on June 14, 2023, the Central Bank of Nigeria removed the Naira’s peg to the US Dollar, shifting to a managed float. The official rate moved from approximately ₦471 to over ₦750 per dollar within days.</p><p>A monthly dashboard would register this as an elevated average for June. What it would not show is that the shock occurred on a single day, that the daily log return on that date represented a 15.55-standard-deviation event, and that any hedging strategy calibrated to monthly averages would have been catastrophically mis-sized for what actually happened.</p><p>That gap between what the data shows and what the data hides is the problem this project was built to solve.</p><h3>Project Overview</h3><p><strong>Objective — </strong>Detect daily FX tail-risk anomalies invisible to monthly aggregation<br><strong>Data Source — </strong>Central Bank of Nigeria official daily USD/NGN rates, 2022–2026<br><strong>Pipeline — </strong>Python (extraction, cleaning) → BigQuery (quantitative modeling) → Power BI (risk dashboard)<br><strong>Primary Metric — </strong>30-day rolling annualized volatility and daily Z-score anomaly detection<br><strong>Key Finding — </strong>15.55σ shock on peg removal date; smoothed to 3.89 average in monthly view<br><strong>Business Application — </strong>Corporate treasury hedging, fintech pricing risk, early warning trigger systems</p><h3>Why This Problem Matters Commercially</h3><p>Multinational supply chains that import industrial equipment, electronics, and pharmaceuticals into Nigeria set their prices months in advance depending on anticipated currency rates. The margin consumed by the FX fluctuation comes straight from operational profit when a structural currency shock happens without warning mechanisms. A single-day 37% depreciation, about what the June 2023 deregulation generated, represents a margin destruction event that no smoothed monthly report would have identified beforehand for a company with ₦500 million in monthly USD-denominated import requirements.<br>Fintech businesses are exposed in a different way. Remittance services managing corridor risk, lending platforms pricing loans in USD-equivalent terms, and payment processors holding float in Naira all require detailed, daily volatility intelligence. In this context, monthly aggregated risk models are not only inaccurate but also risky from an operational standpoint.</p><h3>Architecture: The Reasons for the Pipeline’s Design</h3><p>The design purposefully keeps computation and visualization apart. This is a decision about scalability and performance rather than aesthetics. The rendering and interaction layer is called Power BI. It is best suited for visual aggregation, cross-highlighting, and filtering. For vectorized rolling statistical computations involving thousands of daily records, it is not optimal. Slow, memory-intensive reports that deteriorate with user interaction are produced when rolling standard deviations and Z-score computations are performed inside Power BI using DAX measures. BigQuery is a columnar analytical warehouse that has been specifically tailored to the window function mathematics needed for this project. The Power BI model receives pre-computed, indexed results when the computational logic is transferred to SQL views. These results are fast, clean, and scalable to any date range expansion without requiring dashboard modification.</p><p>The entire data flow functions as follows:<br><strong>Stage 1: Extraction and Cleaning (Python)</strong> This step involves ingesting CBN daily rate data, standardizing date fields to ISO 8601 format, handling non-trading days, and normalizing percentage changes. The Google Cloud BigQuery Python client is used to load the cleaned dataset into BigQuery.<br><strong>Stage 2: Quantitative Modeling (BigQuery SQL) </strong>BigQuery SQL Quantitative Modeling Log returns, rolling standard deviations, annualized volatility, and Z-scores are all calculated using SQL views. There is no need to modify the dashboard because these views automatically update as new data is loaded.<br><strong>Stage 3: Semantic Layer and Visualization (Power BI)</strong> Power BI connects to the BigQuery views. The dashboard is structured in three functional layers: an executive KPI scorecard, a time series trend layer for regime tracking, and a heatmap matrix for rapid monthly anomaly isolation.</p><h3>The Method of Quantitative Analysis</h3><p><strong>Why Percentages Fail<br></strong>Standard percentage changes are arithmetically asymmetric. A 50% drop followed by a 50% gain does not return an asset to its original price, it leaves you at 75% of your starting value. This asymmetry distorts tracking for compounding financial time series.<br>To eliminate this bias and map out precise volatility boundaries, the engine transforms raw exchange rates using three core mathematical frameworks before sending them to the visual layer:</p><p>1. <strong>Continuous Daily Log Returns</strong> (Symmetric and additive across time horizons): Log Return = ln(P_t / P_t-1)</p><p><strong>2. 30-Day Rolling Annualized Volatility</strong> (Standardized scaling for standard deviation):σ_annual = σ_30d × √252</p><p><strong>3. Dynamic Z-Score Anomalies</strong> (Measuring real-time historical mean deviations):Z = (R_t — μ_30) / σ_30</p><pre>```<br>-- FX Volatility Engine: Daily Log Returns, Rolling Annualized Volatility,<br>-- and Z-Score Anomaly Detection<br>WITH ReturnMetrics AS (<br>    SELECT<br>        trade_date,<br>        close_price,<br>        LOG(close_price / LAG(close_price)<br>            OVER (ORDER BY trade_date)) AS log_return<br>    FROM `trading-data-analyst.naira_volatility.usd_ngn_cleaned`<br>),<br>VolatilityStats AS (<br>    SELECT<br>        trade_date,<br>        log_return,<br>        STDDEV(log_return) OVER (<br>            ORDER BY trade_date<br>            ROWS BETWEEN 29 PRECEDING AND CURRENT ROW<br>        ) * SQRT(252) AS vol_annualized_30d,<br>        AVG(log_return) OVER (<br>            ORDER BY trade_date<br>            ROWS BETWEEN 29 PRECEDING AND CURRENT ROW<br>        ) AS rolling_mean_30d<br>    FROM ReturnMetrics<br>)<br>SELECT<br>    trade_date,<br>    log_return,<br>    vol_annualized_30d,<br>    rolling_mean_30d,<br>    (log_return - rolling_mean_30d)<br>    / NULLIF(vol_annualized_30d, 0) AS vol_z_score<br>FROM VolatilityStats<br>ORDER BY trade_date;<br></pre><p>This approach bridges financial theory with practical implementation, allowing the analysis to move beyond simple exchange-rate movements and toward a quantitative assessment of volatility, risk, and anomaly detection in the Nigerian foreign exchange market.</p><p><strong>Three implementation decisions in this query are worth explaining explicitly.<br></strong>The ROWS BETWEEN 29 PRECEDING AND CURRENT ROW frame uses a 30-day lookback rather than a calendar month. This produces a consistent observation count regardless of month length and avoids the artificial discontinuity that occurs when a calendar-based window resets on the first of each month — exactly the kind of smoothing artifact this project is designed to detect.<br>The SQRT(252) annualization factor applies the standard financial convention of 252 trading days per year. This converts daily standard deviation into an annualized figure comparable to industry-standard volatility metrics like those published by the CBOE or used in options pricing models.<br>The NULLIF(vol_annualized_30d, 0) guard handles the pegged regime period from 2022 to early 2023, during which the Naira&#39;s managed band produced near-zero standard deviations. Without this guard, the Z-score calculation would produce a division-by-zero error precisely during the period of greatest regime contrast which is analytically important to preserve.</p><h3>The Dashboard Architecture</h3><p>The Power BI report is structured around three distinct user workflows rather than a single general-purpose view.</p><figure><img alt="A scorecard showing 19.3% average annualized volatility and 15.55 peak Z-score, with the June 2023 spike visible in the trend timeline." src="https://cdn-images-1.medium.com/max/774/1*Vh6Kv87Q95aW9sxDRYQ3PA.png" /><figcaption>(A scorecard showing 19.3% average annualized volatility and 15.55 peak Z-score, with the June 2023 spike visible in the trend timeline)</figcaption></figure><p><strong>Scorecard Layer</strong> sits at the top of the report and displays five executive KPIs: current 30-day annualized volatility, peak historical Z-score, the date on which peak Z-score occurred, the 2022–2026 baseline average volatility, and the current regime classification (Low / Elevated / High / Extreme) derived from conditional Z-score thresholds.<br><strong>Trend Timeline</strong> occupies the central section and plots the 30-day rolling annualized volatility as a continuous time series, with a secondary axis showing the USD/NGN rate itself. This dual-axis view makes the relationship between price level and volatility regime immediately readable — the June 2023 peg removal appears as a simultaneous spike on both axes.<br><strong>Heatmap Matrix</strong> at the bottom of the report displays monthly average Z-scores in a year × month grid with conditional formatting. Green cells indicate normal volatility periods. Yellow cells indicate elevated readings above 2.0 standard deviations. Red cells indicate extreme readings above 3.0 standard deviations. This layer is designed for risk officers who need to identify clusters of anomalous months without scrolling through time series data.</p><h3>The Central Finding: What Monthly Reporting Hides</h3><p>The volatility statistic itself is not this engine’s most important output. It is an illustration of what aggregation ruins. The USD/NGN pair maintained a baseline average annualized volatility of 19.3% for the entire 2022–2026 analysis period. By emerging market norms, this statistic alone is hardly noteworthy. Nigerian foreign exchange has a history of volatility, and 19.3% would not raise red flags in a typical risk assessment. The distribution of that volatility is what the baseline average hides. With a daily Z-score of 15.55 for the June 2023 peg removal, the log return on that one day was 15.55 standard deviations higher than the rolling 30-day mean. This reading does not exist in a properly distributed system according to any standard statistical paradigm. About once every 740 days, three-sigma occurrences take place. About once every 3.5 million days, five-sigma occurrences take place. A 15.55-sigma reading indicates that the underlying distribution assumption has completely failed, not that it is a statistical oddity.</p><p>This is not a flaw in the model. It is the model working correctly. The Z-score system is not designed to predict Black Swan events, it is designed to flag them in real time so that risk responses can be triggered.</p><p>When this data is combined, the critical comparison takes place. The value for June 2023 is 3.89 when the daily records are condensed into a monthly average Z-score. The remaining trading days of the month dilute the disastrous 15.55 daily shock, resulting in a reading that a risk manager may consider elevated but would not necessarily treat as necessitating immediate action. A structural breach in the market is visible in the daily view. An odd month is displayed in the monthly view. Acting on the monthly view in the context of the daily reality would result in an order of magnitude under-hedging because these are not the same risk signal.</p><h3>Methodological Limitations</h3><p>Any quantitative model presented without its limitations is marketing, not analysis. Three constraints on this methodology deserve explicit acknowledgment.<br><strong>The normality assumption:</strong> Because Z-scores are computed in relation to a rolling mean and standard deviation, it is implicitly assumed that log returns have a normal distribution. FX returns from emerging markets have noticeable fat tails, especially around structural policy changes. This characteristic is technically represented by kurtosis values that are significantly higher than 3.0. The application of a normal distribution framework to a non-normal return series contributes to the 15.55-sigma reading. This means that the exact sigma figure should not be understood as a probability statement in the same way that it would be for a truly normal series, but it does not invalidate the finding a reading that extreme is anomalous under any fair distributional assumption.<br><strong>The 30-day lookback window: </strong>Although a 30-day rolling window is a sensible option, it is not the best one in theory. A 30-day window will be slow to recalibrate for a currency that underwent an instantaneous transition to high-volatility free float after eighteen months under a nearly zero-volatility pegged regime. Z-scores are inflated during the transition because the rolling standard deviation is still partially linked to the low-volatility pegged period for the first thirty trading days following the peg removal. Although a reduced frame (10 or 14 days) would result in noisier data during stable periods, it would recalibrate more quickly.<br><strong>Data source constraints.</strong> This analysis uses official CBN published rates, which represent the formal interbank market. Nigeria maintained a parallel (black market) rate throughout this period that diverged significantly from the official rate by as much as 60% at certain points. An analysis of the official rate alone understates the true economic exchange rate experienced by individuals and informal sector businesses. The parallel market spread analysis noted in the future roadmap is not optional for a complete picture, it is methodologically necessary.</p><h3>Risk Management Implications</h3><p>The findings suggest two specific operational changes for corporate treasury and fintech risk functions.</p><p><strong>Replace monthly aggregated dashboards with daily rolling metric monitoring:</strong> The evidence in this project demonstrates quantitatively that monthly aggregation can reduce a 15.55 sigma event to a 3.89 average a reduction in apparent severity of 75%. No risk management framework calibrated to monthly data can respond appropriately to daily structural breaks. The infrastructure cost of daily data pipelines has fallen to near zero with cloud warehousing, the operational argument for monthly reporting is no longer valid.<br><strong>Implement Z-score-based automated triggers rather than absolute rate thresholds:</strong> Most FX hedging triggers are set as absolute rate levels-hedge when USD/NGN exceeds ₦800, for example. Absolute thresholds do not account for the prevailing volatility regime. A move to ₦800 from ₦780 during a high-volatility period carries different risk implications than the same move during a low-volatility period. Z-score thresholds are volatility adjusted by construction. A trigger set at Z-score ≥ 2.0 activates precisely when a move is statistically anomalous relative to recent market behavior regardless of the absolute rate level.</p><h3>Engineering Challenges Worth Documenting</h3><p>Two infrastructure challenges in this project reflect real production data engineering problems.</p><p><strong>Version control for binary BI files.</strong> Power BI’s .pbix file format is a binary archive. Git tracks binary files by storing each version in full rather than tracking diffs, which means repository size grows rapidly with each dashboard change. More critically, simultaneous edits to a .pbix file produce merge conflicts that cannot be resolved through standard text-based diff tools. The resolution is a strict workflow discipline: one active branch per dashboard file at a time, with explicit file-locking when the file is open in Power BI Desktop. This is not a limitation unique to this project it is a production constraint that any BI team working with Git needs to architect around explicitly.<br><strong>Git divergence between local analysis and remote documentation.</strong> During development, the analytical SQL logic in the local BigQuery environment and the documentation in the remote repository diverged across several iterations. Resolving this required interactive git rebase to reconstruct a clean commit history before merging. <br>The lesson is architectural: SQL views that form the analytical backbone of a BI project should be version-controlled with the same discipline as application code. A .sql file committed to the repository at each iteration would have prevented the divergence entirely.</p><h3>Conclusion</h3><p>The June 2023 CBN policy change affected more than just the value of the Naira. A whole class of risk models that were reported through monthly aggregate and adjusted to a managed-float regime were invalidated. A 15.55-sigma event turns into a 3.89 monthly average, and a risk manager depending on the monthly view has no foundation for the response that the daily view requires. The volatility engine described here illustrates precisely how that invalidation occurs with precise statistics.<br>The methodological argument is straightforward. Granular, daily risk monitoring is not a luxury for organizations with Naira exposure, it is the minimum viable infrastructure for operating in a post-deregulation emerging market. The tools to build it are accessible, the costs are negligible relative to the FX exposure they protect against, and the evidence for their necessity is now in the data.</p><p><em>The complete codebase for this project including the Python ingestion scripts, BigQuery SQL views, and Power BI file is available on GitHub at [</em><a href="https://github.com/Robert-Analytics/naira-volatility-analysis"><em>repository link</em></a><em>]. If you are working on similar problems in emerging market data analytics or financial risk infrastructure, I would welcome the connection.</em></p><p><em>Emmanuel Robert — Data &amp; Financial Analytics | </em><a href="https://www.linkedin.com/in/robert-analytics/"><em>LinkedIn </em></a><em>| </em><a href="https://github.com/Robert-Analytics"><em>GitHub</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fa081a89c6d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>