Ignore:
Timestamp:
09/24/26 17:43:19 (5 days ago)
Author:
Stefan <trsunovstefan@…>
Branches:
main
Children:
0cee8ec
Parents:
a531b45
Message:

Wiki docs, phase 6 and phase 7 added

File:
1 edited

Legend:

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

    ra531b45 ref1c1c7  
    1010
    11111. Trader chooses "Place market BUY order".
    12 2. System lists the available markets with their latest price:
     122. System lists the active markets, numbered, with their latest price:
    1313
    1414   ```sql
    15    SELECT m.id, c.symbol, m.quote_currency, COALESCE(lp.price, 0)
     15   SELECT m.id, c.id, c.symbol, m.quote_currency,
     16          COALESCE(lp.price, 0) AS price
    1617     FROM project.markets m
    1718     JOIN project.crypto  c  ON c.id = m.crypto_id
    … …  
    2021    ORDER BY c.symbol;
    2122   ```
    22 3. Trader enters a market symbol, e.g. `ETH`.
    23 4. System resolves the market and looks up the latest price:
     233. Trader picks the market by its number in the listed markets, e.g. `2` (BTC).
     244. System takes the chosen row's market id and crypto id from the list (no lookup by
     25   symbol) and looks up the latest price:
    2426
    2527   ```sql
    26    SELECT m.id, c.id AS crypto_id, c.symbol, m.quote_currency
    27      FROM project.markets m
    28      JOIN project.crypto c ON c.id = m.crypto_id
    29     WHERE upper(c.symbol) = upper($1) AND m.is_active = true;
    30 
    31    SELECT price FROM project.v_latest_prices WHERE market_id = $2;
     28   SELECT price FROM project.v_latest_prices WHERE market_id = $1;
    3229   ```
    33305. Trader enters a quantity.
    … …  
    9188If `available_balance < notional`, the entire transaction rolls back and system shows "Insufficient funds: need X, have Y."
    9289
    93 ### Alternate flow 4a — market not found
     90### Alternate flow 3a — number not in the list
    9491
    95 If the entered symbol does not match any active market, system shows "market X not found" and returns to the authenticated menu without opening a transaction.
     92If the entered number is not one of the listed market numbers, system shows "Invalid choice, enter a number from 1 to N." and returns to the authenticated menu without opening a transaction.
Note: See TracChangeset for help on using the changeset viewer.