📊 Data · Transparency

Data Methodology

How Dalil Finance sources, updates, and displays financial market data for Morocco and global markets.

Open the Dashboard →

How Dalil Thinks About Data Quality

Dalil is an independent project and everything on the site is built around a simple principle: the reader should always know where a number came from and how stale it might be. That principle drives the pipeline described below - the source hierarchy, the validation rules, the way missing data is handled, and the way conflicts between feeds are resolved.

Source Hierarchy

Not all sources carry equal weight. For any given metric, Dalil follows a declared priority order and prefers the highest-priority source that is currently available.

If a higher-priority source is missing but a lower one is available, the lower source is shown with its provenance label intact. Sources are never silently substituted.

Update Process and Caching

Dalil runs on Cloudflare Workers at the edge. When a user opens the dashboard, the browser requests data from the Dalil API, which in turn fetches from upstream providers, caches the response in Cloudflare KV, and returns consolidated JSON to the frontend. The cache TTL per asset class is declared on the Data Sources page. Multiple users benefit from the same cached call, which reduces both upstream cost and rate-limit consumption.

Financial filings (used by the stock pages for IAM, ATW, BCP) are ingested on a separate automated schedule. When a new annual (RFA) or half-year (RFS) report appears on the AMMC, the parser extracts revenue, net income, EPS, and ROE from the consolidated statements and writes the result into a Supabase table. The stock page reads from that table at render time.

Validation and Parsing Rules

Every fundamental metric extracted from a filing goes through a chain of validation rules before it is displayed:

Handling Missing or Ambiguous Data

When a metric is genuinely unavailable - because the parser could not extract it reliably, because the filing is not yet published, or because the upstream provider is down - Dalil hides the field instead of showing a placeholder or a dash. This matters on company pages: if ROE is not reliably extractable from a given year's filing, the ROE row simply does not render for that year. No "N/A", no "-", no fabricated estimate.

The one exception is reserved for dashboard live prices, where a short "loading" state is acceptable because the fetch completes within a few seconds and the surrounding context makes it obvious.

Ambiguous metrics - for example, a bank that discloses a ratio without saying whether it is calculated on group or social accounts - are treated conservatively: if the interpretation is not unambiguous, the parser leaves the field empty rather than guessing.

Dedup and Conflict Resolution

The filings ingest pipeline uses a delete-then-insert pattern keyed by ticker and period. When a new half-year report arrives for the same period as a previously parsed version (for example, a restatement), the older row is replaced cleanly. This prevents two competing values for the same period from ever sitting in the database simultaneously.

For live market data, when two upstream providers disagree, the higher tier in the source hierarchy wins. Where neither provider is clearly authoritative (for example, conflicting crypto prices across exchanges), the dashboard displays the value from the declared primary source and does not blend or average.

Data Sources

Dalil Finance aggregates data from multiple specialised providers to ensure the broadest possible coverage of Moroccan and global financial markets.

Casablanca Stock Exchange (CSE)

Moroccan stock market data - including MASI, MASI20, and individual stock prices - is sourced via Drahmi, a Morocco-focused financial data provider. Data reflects official CSE prices and is updated during trading hours (Monday to Friday, 09:30–15:30 Morocco time). Prices are delayed: the upstream feed lags the exchange, and Dalil additionally caches Casablanca data for up to 60 minutes, so a displayed quote may be up to about 90 minutes old.

Foreign Exchange Rates

Dirham exchange rates against 20 currencies are sourced from Open Exchange Rates and cached for 4 hours - a rate shown may be up to about 4 hours old. Rates are mid-market reference rates and do not represent buying or selling rates available at banks or exchange bureaux. The USD/MAD rate is used as the base for all cross-currency conversions displayed on the platform.

Precious Metals

Gold, silver, platinum, and palladium spot prices are sourced from Metals.Dev using their free tier, updated every 8 hours. Prices are displayed in USD per troy ounce and converted to MAD per gram using the latest available USD/MAD rate. The troy ounce to gram conversion factor used is 31.1035.

Energy and Agricultural Commodities

Brent crude oil, WTI crude, natural gas, wheat, corn, coffee, cocoa, and soybean prices are sourced from Twelve Data and cached for 8 hours - a price shown may be up to about 8 hours old.

Global Indices

Major global stock market indices including the Dow Jones, S&P 500, NASDAQ, FTSE 100, DAX, CAC 40, Nikkei 225, and others are sourced from Yahoo Finance (Twelve Data backup) and cached for 30 minutes; with the upstream delay, a value may be up to about an hour old. Index values represent the most recent quote delivered by the provider during trading hours for each respective exchange.

Government Bond Yields

US Treasury yields (2Y, 5Y, 10Y, 30Y) use the DGS series from the Federal Reserve Economic Data (FRED) database and are updated daily. European and Asian government yields use OECD series, accessed where available through FRED.

Moroccan treasury yields (3M, 6M, 1Y, 2Y, 5Y, 10Y) are displayed when available from upstream providers. When provider data is unavailable, the dashboard may fall back to previously cached or estimated reference values, labeled as "fallback" in the data source attribution. These fallback values are approximate and should not be used for trading, valuation, or investment decisions.

Cryptocurrency

Cryptocurrency prices are sourced from Binance and CoinGecko (Luzia backup) and cached for 15 minutes - a price may be up to about 15 minutes old. Prices are denominated in USDT and converted to MAD using the latest available USD/MAD rate. Cryptocurrency markets are highly volatile - prices may change significantly between updates.

Financial News

Market news is aggregated from RSS feeds including Hespress Économie, Medias24, Reuters Africa, and Reuters Business. News items are refreshed every 30 minutes. Dalil Finance does not produce or edit news content - all articles link to the original source publication.

MAD Price Conversions

All MAD price conversions displayed on the platform use the latest available USD/MAD reference rate from Open Exchange Rates, which may itself be up to about 4 hours old. Gold and silver prices in MAD per gram are calculated as: (USD spot price per troy ounce ÷ 31.1035) × USD/MAD rate. Cryptocurrency MAD prices are calculated as: USD price × USD/MAD rate.

Update Frequency Summary

CSE stocks and MASI update during trading hours (09:30-15:30 Casablanca time, UTC+1) and may be up to about 90 minutes old including caching. FX rates may be up to about 4 hours old. Precious metals, energy, and agricultural commodities may be up to about 8 hours old. Global indices may be up to about an hour old. Bond yields are daily values. Cryptocurrency prices may be up to about 15 minutes old. News refreshes roughly every 30 minutes.

Disclaimers

All data on Dalil Finance is provided for informational purposes only. Prices are delayed and may not reflect real-time market conditions. Dalil Finance is not a licensed financial adviser and nothing on this platform constitutes investment advice. Users should verify prices with their broker or bank before making any financial decision.