Changeset ef1c1c7 for docs/P3-UseCaseModel/UseCase0005.md
- Timestamp:
- 09/24/26 17:43:19 (6 days ago)
- Branches:
- main
- Children:
- 0cee8ec
- Parents:
- a531b45
- File:
-
- 1 edited
-
docs/P3-UseCaseModel/UseCase0005.md (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
docs/P3-UseCaseModel/UseCase0005.md
ra531b45 ref1c1c7 26 26 27 27 1. Trader chooses "Place market SELL order". 28 2. System lists markets (same SQL as UC0004 step 2). 29 3. Trader enters market symbol and quantity. 30 4. System resolves the market and looks up the latest price (same SQL as UC0004 step 4). 28 2. System lists, numbered, the Trader's holdings that still have a quantity free to 29 sell (not reserved by an open sell order), with the quantity held, the free 30 quantity and the latest price: 31 32 ```sql 33 SELECT m.id, c.id, c.symbol, m.quote_currency, 34 h.quantity, h.quantity - h.reserved_quantity AS free, 35 COALESCE(lp.price, 0) AS price 36 FROM project.holdings h 37 JOIN project.crypto c ON c.id = h.crypto_id 38 JOIN project.markets m ON m.crypto_id = c.id AND m.is_active = true 39 LEFT JOIN project.v_latest_prices lp ON lp.market_id = m.id 40 WHERE h.user_id = $1 41 AND h.quantity - h.reserved_quantity > 0 42 ORDER BY c.symbol; 43 ``` 44 3. Trader picks the holding by its number in the listed holdings, e.g. `2` (ETH), and 45 enters the quantity. 46 4. System takes the chosen row's market id and crypto id from the list (no lookup by 47 symbol) and looks up the latest price: 48 49 ```sql 50 SELECT price FROM project.v_latest_prices WHERE market_id = $1; 51 ``` 31 52 5. System opens a transaction: 32 53
Note:
See TracChangeset
for help on using the changeset viewer.
