| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Exercise 3 replaces the fixed initial cash of Exercise 2 with accounts
that users top up themselves. Add AccountContext.deposit, which credits
a DEPOSIT entry through LedgerContext so it carries a timestamp and a
running balance like every other ledger movement, and return the
updated account.
The amount crosses the api boundary as a string, like all money values.
Reject anything that is not a positive number with at most two decimal
places instead of rounding it, so a user is never credited a different
amount than they asked for. A deposit can bring a negative account back
above zero, which lifts the block.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Exercise 3 uploads arrive over HTTP and must never be written to the
server's disk, so load Schema v3 straight from an InputStream. Each
valid file is appended to the market rather than replacing it, and the
uploading user becomes the Market Maker of every event in it.
With no id in v3, the mapper keys events by their trimmed name, so the
repository's case-insensitive lookup finds them by name. Display ids
continue from the current market size.
The whole file is validated and mapped before anything is added, so a
rejected upload leaves the market as it was. Loading is synchronized
so two concurrent uploads cannot both pass the name-collision check.
DTDs and external entities are disabled on the parser, since the input
is untrusted and an XXE payload could otherwise read server files.
Check the loader against the course's Exercise 3 sample files, kept
with their schema under test-data/ex-3/.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Schema v3 drops event ids and users, and uploads now add to a live
market instead of replacing it. Validate a v3 document against the
Exercise 1 rules (commission 0-90%, positive b and d, non-negative
initial inventory, a known trading method), require exactly two
options per event, and treat the event name as its identity: reject
names that repeat within the file or collide with an event already in
the repository, ignoring case and surrounding whitespace.
The validator works on the unmarshalled object graph only and never
touches the repository beyond reading it, so a rejected upload leaves
the market untouched.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add tests for the behaviour introduced in the last few commits, so
later changes to matching, settlement or the UI state can't quietly
break it.
On the service side, Ex2LoaderTest loads the ex-2 fixtures and checks
that every invalid file is rejected for its own reason, including
events with no market maker or two of them, and v1 files. The order
book tests cover buys and sells that match or rest in the ladder,
self-trade prevention, cash and shares reserved by resting orders,
price bounds, risk rejections, and resolution cancelling resting
orders and paying the holders. A simulation checks that LMSR
settlement conserves money.
LedgerMapperTest used to pin the unmapped seq and at fields to their
defaults. Now that the mapper fills them from the entry id and time,
assert the real values and add a case for a null time.
On the desktop side, AppStateTest drives the real ServiceEngine through
loading, event creation, LMSR and order book trading, and checks that
the observable state updates. Smaller tests check chart timestamps,
money and probability formatting, and that every animation settles on
its final frame, which is what the UI shows when animations are off.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move AccountDTO/MarketDTO/MarketStateDTO/PurchaseReceiptDTO/TradeRowDTO
out of the catch-all api package into model.market (and LedgerDTO into
model.ledger), matching the existing model.event convention so DTOs
live next to the domain they describe rather than in the interface
package. Relocate LedgerMapper from mapper.v2 to infrastructure.adapter
to match the module's established package layout, and update all call
sites and imports accordingly.
Also register the ui-desktop module in the build tooling: add it to
MODULES, add openjfx to the shipped runtime libs, and generalize
package.sh so each executable module (ui-console, ui-desktop) gets its
own Main-Class/Class-Path manifest and run script instead of
special-casing ui-console. Fold long Class-Path manifest lines at 72
bytes per the JAR spec, since adding ui-desktop's dependencies pushed
the line past the limit.
|
| |
|
|
|
| |
build.sh now passes -processorpath/-s so MapStruct's generated impl
compiles alongside hand-written sources.
|
| |
|
|
|
| |
Groups them with the other event-domain enums instead of the general
api package, and updates all call sites accordingly.
|
| |
|
|
|
|
|
|
|
| |
state I/O
Adds a full pre-load validation pass for GM XML seeds (ids, names,
options, commission, LMSR liquidity), replaces IO.print with
System.out, and surfaces detailed error messages across load/save
commands instead of generic failures.
|
| |
|
|
|
|
|
| |
Moves Event/Ledger DTOs out of the flat api package into
api/model/{event,ledger}, and moves LocalCatalogContext and order
matching logic into dedicated service/catalog and service/matching
packages, replacing TradingOperation/TradingOperationImpl.
|
| |
|
|
|
|
|
|
|
|
|
| |
new menu commands
Fill in the previously stubbed cost/pricing math for both trading
mechanisms, and give OrderBookTradingMechanism an actual matching engine
with resting bid/ask books. Fold EventRepository/UserRepository access
into a single MarketContext used by LocalGuessMarketContext, and move the
repository package under infrastructure. Add Buy/EventDetails/LoadState/
SaveState/SettleEvent console commands and wire them into App/Menu.
|
|
|
and tests
Removes the placeholder Mapper interface in favor of concrete mapper/provider
implementations, fixes Menu.stop() to no-op instead of throwing.
|