Changes between Initial Version and Version 1 of Use-Case


Ignore:
Timestamp:
08/07/26 11:25:27 (9 days ago)
Author:
231285
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Use-Case

    v1 v1  
     1= Use-case model =
     2
     3== Actors / Roles ==
     4
     5'''Visitor''' – Anyone using EduBerza without an account, who can look at public market
     6information, create an account, and log in.
     7
     8'''Trader''' – A registered, logged-in user who deposits virtual funds, places market buy and
     9sell orders, follows the value of their portfolio, and keeps a watchlist of assets they want to
     10monitor.
     11
     12'''Market Simulator''' – An external automated system (the bot in `bots/`) that writes simulated
     13trades and candles into the database so prices move without a connection to a real exchange.
     14
     15== Use-Cases ==
     16
     17=== Visitor ===
     18
     19 * [wiki:UseCase0001 UC0001] – '''Register new account''' – Visitor creates an account with a
     20   unique username and e-mail; the password is stored as a SHA-256 hash.
     21 * [wiki:UseCase0002 UC0002] – '''Log in''' – Visitor authenticates with username and password so
     22   the system treats every following action as a Trader.
     23
     24=== Trader ===
     25
     26 * [wiki:UseCase0003 UC0003] – '''Deposit virtual funds''' – Trader tops up their virtual cash
     27   balance; the user row and the ledger are written in one transaction.
     28 * [wiki:UseCase0004 UC0004] – '''Place market BUY order''' – Trader buys a crypto asset at the
     29   current market price, which debits cash and upserts the holding at a running weighted-average
     30   price.
     31 * [wiki:UseCase0005 UC0005] – '''Place market SELL order''' – Trader sells part or all of a
     32   holding at the current market price, which credits cash and preserves the cost basis.
     33 * [wiki:UseCase0006 UC0006] – '''View portfolio and transaction history''' – Trader inspects
     34   current holdings, unrealised P/L, cash balances and the most recent ledger entries.
     35 * [wiki:UseCase0007 UC0007] – '''Manage watchlist''' – Trader lists, adds and removes crypto
     36   assets on a personal watchlist, where adding an asset already on the list is a no-op.
     37
     38=== Market Simulator ===
     39
     40The Market Simulator initiates no use case of its own. It participates in
     41[wiki:UseCase0004 UC0004] and [wiki:UseCase0005 UC0005] indirectly, by keeping
     42`project.market_trades` populated so that `project.v_latest_prices` returns a current price for
     43every active market.
     44
     45== Use-case model diagram ==
     46
     47{{{#!comment
     48The diagram is optional for P3. Attach the exported image to this wiki page as
     49use_case_diagram.png and then replace this comment with:
     50
     51[[Image(use_case_diagram.png)]]
     52}}}
     53
     54== Detailed Use-Cases ==
     55
     56The following use-cases are documented in detail, with SQL tested against the P2 database:
     57
     58 * [wiki:UseCase0001 UseCase0001] – Visitor registers a new account
     59 * [wiki:UseCase0002 UseCase0002] – Visitor logs in
     60 * [wiki:UseCase0003 UseCase0003] – Trader deposits virtual funds
     61 * [wiki:UseCase0004 UseCase0004] – Trader places a market BUY order
     62 * [wiki:UseCase0005 UseCase0005] – Trader places a market SELL order
     63 * [wiki:UseCase0006 UseCase0006] – Trader views portfolio and transaction history
     64 * [wiki:UseCase0007 UseCase0007] – Trader manages a watchlist
     65
     66== Realization details on selection of the most important use cases ==
     67
     68This is a solo project, so '''at least 3 use cases''' are required. '''7 use cases''' are
     69documented, for a safety margin. All seven are implemented in the P4 prototype; see `server/`
     70for the Go source and [wiki:PrototypeImplementation] for the documented runs.
     71
     72||=Use case=||=Importance=||=Why it was selected=||
     73||[wiki:UseCase0001 UC0001 – Register]||High||Nothing else works without it; demonstrates `INSERT` with a uniqueness check.||
     74||[wiki:UseCase0002 UC0002 – Log in]||High||Authenticates every Trader action; demonstrates `SELECT` with parameter binding.||
     75||[wiki:UseCase0003 UC0003 – Deposit]||High||Shows a multi-row transaction: `UPDATE users` plus `INSERT INTO transactions`.||
     76||[wiki:UseCase0004 UC0004 – Buy]||Very high||Core of the exchange: `INSERT orders`, `UPDATE users`, upsert `holdings`, ledger entry, market trade.||
     77||[wiki:UseCase0005 UC0005 – Sell]||Very high||Dual of Buy; demonstrates row-level `FOR UPDATE` locking and cost-basis bookkeeping.||
     78||[wiki:UseCase0006 UC0006 – Portfolio]||High||Demonstrates joins over `holdings`, `markets` and `crypto`, and the `v_portfolio` view.||
     79||[wiki:UseCase0007 UC0007 – Watchlist]||Medium||Demonstrates N–M relation handling and `ON CONFLICT` upsert semantics.||