Methodology & Data Quality Hub
Deterministic mathematical formulations, data integrity guarantees, and friction models governing Dragonfly.co.
Live Data Provenance & Quality Audit
Session: 2026-11-04 (Asia/Dhaka)Deterministic Mathematical Formulations
Zero Black-Box Logic • Fully Reproducible1. Discrete Kalman Velocity Filter
State SpaceEstimates true underlying trend velocity while separating transient microstructure liquidity noise from persistent institutional order flow.
x_k = A * x_(k-1) + w_k, w_k ~ N(0, Q)
z_k = H * x_k + v_k, v_k ~ N(0, R)
Velocity = x_k[1] (Dhaka points per trading session)
Prevents premature whip-saws during low-volume choppy sessions without introducing the lag of traditional 200-session moving averages.
2. Wilder's Smoothed RSI (14 Sessions)
MomentumCalculates relative price momentum using J. Welles Wilder's exponential smoothing method rather than simple arithmetic averaging.
RS = SmoothedAvgGain / SmoothedAvgLoss
RSI = 100 - (100 / (1 + RS))
SmoothedAvg = (PrevAvg * 13 + Current) / 14
Bounded strictly between 0 and 100. Values above 70 indicate elevated buying pressure; below 30 indicates oversold conditions.
3. Chaikin Money Flow (CMF 20 Sessions)
Volume FlowMeasures the accumulation/distribution volume over 20 trading sessions to verify whether price expansions have genuine volume sponsorship.
CLV = ((Close - Low) - (High - Close)) / (High - Low)
CMF_20 = SUM(CLV * Volume, 20) / SUM(Volume, 20)
If High == Low (e.g. floor price locked), CLV is deterministically defined as 0.0 to prevent division by zero.
4. FIFO Cost Basis & Realized P&L
AccountingPortfolio management strictly executes First-In, First-Out lot balancing with accurate tracking for partial sells and brokerage commissions.
Buy Cost = Shares * Price + Commission
Net Proceeds = SoldShares * Price - Commission
Realized P&L = Net Proceeds - (FIFO Matched Cost)
Includes dedicated ledger handling for cash deposits, cash withdrawals, and dividend distributions.
5. Max Adverse Excursion & Drawdown
RiskEvaluates the maximum intra-trade drawdown experienced by an open position or strategy backtest before target achievement or exit.
MAE = (EntryPrice - LowestLowDuringTrade) / EntryPrice
MaxDrawdown = (PeakPortfolioValue - Trough) / Peak
Institutional backtests display honest no-trade periods, worst-case drawdown, and liquidity-adjusted capital capacity.
6. 52-Week Corridor Normalization
ValuationDetermines where current price trades relative to the rolling 52-week (approx. 240 trading sessions) high and low corridor.
CorridorPos = (LTP - Low_52W) / (High_52W - Low_52W) * 100%
Bounded: [0%, 100%]
Positions > 80% indicate proximity to annual highs; < 20% indicate proximity to annual lows or floor price support.
Market Friction & Regulatory Disclosures
Bangladesh Securities and Exchange Commission (BSEC) Context0.40% Brokerage Commission Friction
All strategy backtests, paper trades, and portfolio transaction ledgers deduct a default 0.40% commission on every buy and sell. Many retail platforms display inflated theoretical profits by ignoring broker commissions and exchange fees; Dragonfly.co enforces friction realism.
Floor Price & Circuit Breaker Disclosures
During regulatory floor price interventions, stocks hitting lower circuit limits may have zero executable buy orders for consecutive weeks. Our platform explicitly tags "Circuit Locked" symbols and flags that theoretical stop-losses cannot execute in liquidity-frozen markets.
Language Precision: "Unusual Activity"
In compliance with regulatory standards, our anomaly detection module uses the objective term "Unusual Activity & Statistical Outliers" rather than speculative operator claims. Every flagged anomaly specifies its mathematical z-score threshold.
Canonical Timezone Standard (Asia/Dhaka)
All daily sessions, EOD batch imports, and news announcements are indexed strictly in canonical ISO 8601 Asia/Dhaka (+06:00). This eliminates UTC offset shifts and weekend trading misclassifications across DSE Sunday–Thursday sessions.
Settlement-Aware Holding Periods & Depository Cycles (CDBL)
Unlike Western exchanges supporting margin day-trading, Bangladesh law and Central Depository Bangladesh Ltd (CDBL) mandate strict dematerialized share delivery prior to sell authorization. Under DSE clearing rules:
- Regular Equities (Classes A, B, N): Require T+2 business trading days before shares become sell-available in your BO account.
- Non-Compliant (Class Z): Enforces T+3 business trading days settlement cycle with heightened default risk.
- Alternative Trading Board (ATB): Unlisted debt and venture securities enforce T+4 business trading days.
- Cash Settlement Delay: Sale proceeds undergo clearing; cash withdrawal to bank accounts (BEFTN/NPSB) clears T+2 (or T+4 for ATB) after sell execution.
- Trading Calendar Exclusions: Fridays, Saturdays, and statutory exchange holidays are strictly excluded from settlement countdowns.
Separation of Legal Settlement from Investment Horizons:
Automated Data Sanitization Pipeline Rules
Continuous Ingestion Audit| Validation Check | Condition | Enforcement Action | Status |
|---|---|---|---|
| Zero Close Sanitization | CLOSEP == 0.0 | Replaced with NULL (prevent zero-division) | Active (854 resolved) |
| Duplicate Prevention | (stock_id, date) duplicate | Rejected by database unique index | Active (100% blocked) |
| OHLC Range Coherence | Low > High or Close < 0 | Row quarantine into import_logs | Active |
| Session Gaps | Missing trading days in calendar | Automated backfill catch-up runner | Active |
| Connection Resilience | MySQL unreachable / rate limited | Instant fallback to local SQLite WAL | Active |