From 20a4e20e91bd42c5f73cfb17fe0f44094d355338 Mon Sep 17 00:00:00 2001 From: laurentbarontini Date: Thu, 14 May 2026 14:31:23 +0200 Subject: [PATCH] Bug pnl fee --- modules/purchase_trade/docs/business/INDEX.md | 4 +- .../docs/business/valuation-pnl-mtm.en.md | 132 ++++++++++++++++++ .../docs/business/valuation-pnl-mtm.md | 102 +++++++++++--- .../docs_source/business/INDEX.md | 3 +- .../business/valuation-pnl-mtm.en.md | 95 +++++++++++++ .../docs_source/business/valuation-pnl-mtm.md | 78 ++++++++--- modules/purchase_trade/tests/test_module.py | 97 +++++++++++++ modules/purchase_trade/valuation.py | 128 ++++++++++++++++- 8 files changed, 603 insertions(+), 36 deletions(-) create mode 100644 modules/purchase_trade/docs/business/valuation-pnl-mtm.en.md create mode 100644 modules/purchase_trade/docs_source/business/valuation-pnl-mtm.en.md diff --git a/modules/purchase_trade/docs/business/INDEX.md b/modules/purchase_trade/docs/business/INDEX.md index 8764737..0b6f923 100644 --- a/modules/purchase_trade/docs/business/INDEX.md +++ b/modules/purchase_trade/docs/business/INDEX.md @@ -19,7 +19,7 @@ Statut: `migration partielle`
  • Fees, freight, lots effectifs, % rate: fees.md
  • -
  • Valuation, PnL, MTM, derivatives: valuation-pnl-mtm.md +
  • Valuation, PnL, MTM, derivatives: FR / EN
  • Factures provisoires/finales, padding: invoicing.md
  • @@ -78,6 +78,8 @@ Statut: `migration partielle`
  • BR-PT-VAL-003: MTM hors fees.
  • +
  • BR-PT-VAL-004: snapshot courant PnL et identite economique. +
  • BR-PT-INV-001: padding facture provisoire vente.
  • BR-PT-ACC-001: Validate facture client attribue le numero. diff --git a/modules/purchase_trade/docs/business/valuation-pnl-mtm.en.md b/modules/purchase_trade/docs/business/valuation-pnl-mtm.en.md new file mode 100644 index 0000000..795c213 --- /dev/null +++ b/modules/purchase_trade/docs/business/valuation-pnl-mtm.en.md @@ -0,0 +1,132 @@ + + +# Valuation, PnL, MTM + +Status: `partial migration` + +Language: `en`
    +Mirror page: [valuation-pnl-mtm.md](valuation-pnl-mtm.md) + +## BR-PT-VAL-001 - Valuation covers purchase, sale, and sale-first flows + +Source: `BR-PT-004`, `BR-PT-006`, `BR-PT-011` + +### Consultant Rule + +PnL must exist for purchases and for sales, even when a sale is not yet matched +to a purchase. + +### Developer Notes + + + +## BR-PT-VAL-002 - Valuation references + +Source: `BR-PT-005` + +### Consultant Rule + +The PnL reference must describe the nature of the valued line: purchase or sale, +open or physical. + +### Developer Notes + + + +## BR-PT-VAL-003 - MTM excludes fees + +Source: `BR-PT-007` + +### Consultant Rule + +Mark-to-market applies to prices and derivatives, not to fees. + +### Developer Notes + + + +## BR-PT-VAL-004 - Current snapshot and economic identity + +Source: session `2026-05-14` + +### Consultant Rule + +`valuation_valuation_line` represents the latest known PnL image. +It is not a history table. + + + +### Developer Notes + + diff --git a/modules/purchase_trade/docs/business/valuation-pnl-mtm.md b/modules/purchase_trade/docs/business/valuation-pnl-mtm.md index 4e9e446..65c4dcf 100644 --- a/modules/purchase_trade/docs/business/valuation-pnl-mtm.md +++ b/modules/purchase_trade/docs/business/valuation-pnl-mtm.md @@ -4,39 +4,42 @@ Statut: `migration partielle` +Langue: `fr`
    +Page miroir: [valuation-pnl-mtm.en.md](valuation-pnl-mtm.en.md) + ## BR-PT-VAL-001 - La valuation couvre achat, vente et sale-first Source: `BR-PT-004`, `BR-PT-006`, `BR-PT-011` -### Regle consultant +### Règle consultant -Le PnL doit exister pour les achats et pour les ventes, meme quand une vente -n'est pas encore matchee a un achat. +Le PnL doit exister pour les achats et pour les ventes, même quand une vente +n'est pas encore matchée à un achat. -### Notes developpeur +### Notes développeur -## BR-PT-VAL-002 - References de valuation +## BR-PT-VAL-002 - Références de valuation Source: `BR-PT-005` -### Regle consultant +### Règle consultant -La reference de PnL doit decrire la nature de la ligne valorisee: achat ou +La référence de PnL doit décrire la nature de la ligne valorisée: achat ou vente, ouverte ou physique. -### Notes developpeur +### Notes développeur