Ignore:
Timestamp:
09/16/26 23:37:15 (13 days ago)
Author:
Stefan <trsunovstefan@…>
Branches:
main
Children:
8b447ef
Parents:
df05838
Message:

add reserved_quantity and modify the phases, add v_03.png and v_03.xml for P1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/P3-UseCaseModel/UseCaseModelAIUsage.md

    rdf05838 r9577c79  
    5555duplicate registration, wrong password). The results are documented per use case
    5656on the `UseCaseXXXXImplementation` pages.
     57
     58### Session 3 — 2026-09-16
     59
     60Driven by the design review logged in full in
     61[ERModelAIUsage](../P1-ConceptualModel/ERModelAIUsage.md#session-3--2026-09-16):
     62placing a sell order checked `holdings.quantity` directly, with no way to
     63record that part of a position was already promised to another, unsettled
     64order.
     65
     66**What changed:**
     67
     68- [UseCase0005](UseCase0005.md) — the scenario now reserves the crypto
     69  (`holdings.reserved_quantity`) before removing it from the position, checks
     70  `quantity - reserved_quantity` rather than raw `quantity`, and adds a
     71  worked example and a note on why the reserve and settle steps stay inside
     72  one transaction rather than two (only market orders are implemented, and
     73  splitting into two commits would risk an order stuck `open` with no cancel
     74  use case to recover it).
     75- [UseCase0004](UseCase0004.md) — no change to the balance logic, but the
     76  order insert now goes through `status='open'` before a final
     77  `UPDATE ... SET status='executed'`, matching the sell side, so `Orders`
     78  genuinely has the lifecycle [ERModel](../P1-ConceptualModel/ERModel.md)
     79  describes for it rather than a status column that is only ever written
     80  once.
     81- [UseCase0006](UseCase0006.md) — the `v_portfolio` reference and its query
     82  gained `reserved_quantity`/`available_quantity`, since the portfolio screen
     83  is where a Trader would actually see the new field.
     84- The use-case importance table and UC0005's one-line description in
     85  [UseCaseModel](UseCaseModel.md) were reworded to mention the reservation.
     86
     87Every changed scenario's SQL was re-run against the live database, including a
     88two-concurrent-sells test that reproduces the exact bug being fixed: see
     89[UseCase0005Implementation](../P4-Prototype/UseCase0005Implementation.md).
     90
     91**What I decided:** to keep this a revision of the existing UC0004/UC0005
     92pages rather than a new use case (e.g. "cancel order") — `cancelled` remains
     93an unused status, same as before, since nothing in the prototype produces it
     94and inventing a cancel flow was not what the review asked for.
Note: See TracChangeset for help on using the changeset viewer.