aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* api: share the user directory row with clients Kostya2026-10-124-9/+13
| | | | | | | | | | | The row GET /api/users and /api/sync send for each user was a record private to UsersServlet, so a client had nothing to deserialize it into. Move it to the api module as UserSummaryDTO. Make TestServer public as well, so client modules can test against a real embedded server.
* ui-fx: move the JavaFX UI into a module that sees only the api Kostya2026-10-1173-20/+57
| | | | | | | | | | | | | | | | | | | | | | | Exercise 3 asks for a new desktop client that reuses the Exercise 2 screens, and the course asks that clients depend on the DTO contract, never on the engine. ui-desktop mixed both: its views and controllers only talk to the api interfaces, but AppView and AppState each had a convenience constructor that built a ServiceEngine, which tied every UI class to the service module. Move the screens, controllers, components, FXML, skins and fonts into a new ui-fx module that depends on api alone. Packages are unchanged, so FXML controller names and resource paths keep working as they are. ui-desktop keeps only the Exercise 2 app: Launcher, App, which now builds the ServiceEngine and passes its contexts in, and ServiceEngine itself. The Exercise 3 client can then reuse ui-fx with remote contexts and never put the engine on its classpath. The build proves the split: ui-fx compiles with nothing but api visible. Tests move with the code they cover. AppStateTest drives the real engine, so it stays in ui-desktop.
* server: add versioned sync endpoint for polling clients Kostya2026-10-116-6/+157
| | | | | | | | | | | | | | | | | | | | | The spec has clients pull updates every half second or so, by fetching everything, only changes, or something in between. Take the middle road: the engine keeps a version that moves on every change, and GET /api/sync?since={version} answers {"changed": false} when nothing has happened, which is almost every poll. Otherwise it returns a snapshot of the event summaries, the user directory and the caller's account, with the version to send next time. A client looking at one event refetches its details from /api/events/{name} only when the version moves. The lock filter bumps the version after every state-changing request, still inside the write lock, so a reader can never pick up new data under an old version. CORS preflights now take the read lock, since they change nothing. A session that times out also bumps the version, so other users see that user go offline. The user directory rows move into a helper that /api/users and the snapshot share.
* server: serialize engine access with one read/write lock Kostya2026-10-112-0/+102
| | | | | | | | | | | | | | | | | | | | | | | | The engine was written for a single-threaded desktop app: users, events and ledgers live in plain lists, and a balance update is a read followed by a write. Tomcat runs each request on its own thread, so once clients poll while others trade, a read can iterate a list mid-insert and fail with a 500, and two deposits can both read the same old balance and lose one update. Every server-side call into the engine arrives through /api/*, so put one ReentrantReadWriteLock in a filter there. GETs, which is all the polling, share the read lock and still run in parallel. Everything else takes the write lock and changes the market alone, which also makes check-then-act steps like opening an event or claiming a username atomic. Writes are short in-memory operations, so one lock is enough. Per-event locks are the next step if trading volume ever needs them. The test runs writers depositing into one account while others poll three endpoints and log new users in. Without the filter it fails with 500s; with it, every request succeeds and the balance and ledger count match the number of deposits.
* server: add account, deposit and user directory endpoints Kostya2026-10-115-0/+202
| | | | | | | | | | | | | | | | | | | | | | | Give each logged-in user their own account view and a view of everyone else, as the spec asks: - GET /api/user/account returns the caller's balance, blocked flag and every ledger row (trades, fees, payouts, deposits). - POST /api/user/deposit (form field "amount") tops the account up through AccountContext.deposit, so its validation and DEPOSIT ledger entry are the same as in the engine. Bad amounts get 400. - GET /api/users lists every account with its name, balance and whether it makes any market, the three facts the spec requires about other users, plus whether it is logged in right now, which the login registry already knows. Accounts outlive their sessions, so the list includes users who are currently logged out. A test drives two clients through a whole market: one deposits, uploads and opens an event, the other deposits and buys, the first resolves it, and the winner's balance rises by exactly one per winning share.
* server: add event and order endpoints Kostya2026-10-115-2/+354
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Expose the market to logged-in clients: - GET /api/events lists every event, GET /api/events/{name} returns one event's details, order books, trades and participants. - POST /api/events/{name}/open and /resolve (form field "option") open and settle an event. The engine's openEvent does not know who is asking, so the servlet checks the caller is the event's Market Maker and answers 403 otherwise, for both actions. - POST /api/orders places a buy or sell order as the logged-in user, never as a name the client sends. Events are addressed by their URL-encoded name, which is their identity in v3. Request input is checked before it reaches the engine. The engine treats any side other than SELL as a buy, takes any quantity, and Event.getOption throws on an unknown key, so all of these would have turned client mistakes into wrong trades or 500 errors. Above all, settling on an unknown winning option would close the event and pay nobody. The servlets reject these as 400s. Login is checked inside each servlet through Sessions.requireUser rather than in a second filter: the order of annotation-registered filters is unspecified, and an auth filter running before CorsFilter would send 401s without CORS headers, which browsers report as network errors.
* server: accept event file uploads held entirely in memory Kostya2026-10-103-1/+226
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add POST /api/upload: a logged-in user sends a Schema v3 file as a multipart part, its events join the market for everyone, and the uploader becomes their Market Maker. It uses the Servlet API's own multipart support, as the spec asks, and hands the part's stream to the v3 loader, so validation errors (bad XML, broken Exercise 1 rules, a name already in the market) come back as 400 with their reason. As in Exercise 1, a file whose name does not end in .xml is refused before it is read, since a request need not come from our client. The spec warns that the grading server cannot write files, and Tomcat writes any multipart part larger than @MultipartConfig's fileSizeThreshold to a temp file. That threshold defaults to 0, so a plain upload servlet always touches the disk. Cap uploads at 1 MB and put the threshold above the whole request limit, so every upload stays in memory. Bigger files get 413, requests without a session 401, and non-multipart bodies 400. Tomcat deletes spooled parts once the request ends, so comparing the files before and after an upload cannot catch spooling. The test instead watches the webapp's temp directory for any file being created while a near-limit upload runs. It fails if the threshold is set back to 0.
* server: add username login and logout endpoints Kostya2026-10-0910-48/+319
| | | | | | | | | | | | | | | | | | | | | | The spec asks for a login by unique name only, with no passwords or sign-up, and an error that lets the user try again if the name exists. Add POST /api/login (form field "username") and POST /api/logout. Sessions maps each name, ignoring case, to the one HTTP session holding it. A second session asking for a held name gets 409 NAME_TAKEN, and a blank name gets 400. When a session ends, by logout or by Tomcat timing it out after a client quits without logging out, an HttpSessionListener frees the name. The account itself (ledger, Market Maker roles) stays, and logging in with that name again resumes it rather than locking the user out for the life of the server. New accounts start with a zero balance and are funded through deposits. Json gives every endpoint the same response shape, with errors as {"error": CODE, "message": text} built from a failed Result. Tomcat setup for the tests moves into a shared TestServer helper, whose clients each keep their own cookie jar and so act as separate users.
* catalog: make Loader a stream-based strategy Kostya2026-10-098-85/+62
| | | | | | | | | | | | | | | | | | | | | | | | Loader was tied to the disk: load(Path) did its own file checks and opening, so the v3 loader, which reads HTTP uploads, could not implement it, and the server had to hand its catalog a stub loader that refused everything. Reduce Loader to a single strategy method, load(InputStream, source, owner). The v1, v2 and v3 loaders are now interchangeable implementations, picked by wiring: v1 for the console, v2 for the desktop, v3 for the server. The owner is the uploading user; v1 and v2 ignore it because their files name their own Market Makers. Opening a file by path is now LocalCatalogContext.loadEvents' job, with the same INVALID_PATH, FILE_NOT_FOUND and NOT_XML errors as before. The server catalog uses the v3 loader directly. A path load there passes no uploader, which v3 refuses, so nothing reaches the server's market except an upload. Drop Loader.seed, which every loader implemented by throwing and nothing called.
* server: add Tomcat webapp module with shared engine and CORS Kostya2026-10-099-1/+397
| | | | | | | | | | | | | | | | | | | | | | | | | | | Exercise 3 moves the market behind a Tomcat server that the desktop and browser clients share. Add a server module, registered in the build scripts, holding the pieces every later endpoint builds on: - ServerEngine wires one in-memory market (repositories, ledger, trading pipeline, v3 upload loader) and lives in the servlet context for the webapp's lifetime. Its catalog refuses path-based loading, so events can only arrive through uploaded streams and the server never reads or writes files. - EngineBootstrap builds that engine when the webapp deploys. - CorsFilter answers preflights and echoes the caller's Origin with Allow-Credentials, which the browser client needs to send its session cookie from another origin. With usernames as the only login, echoing any origin exposes nothing a page couldn't get by logging in itself. - /api/health reports that the engine is up. Vendor tomcat-juli 10.1.26 next to the other Tomcat jars. It ships in Tomcat's bin/ rather than lib/, and embedded Tomcat cannot start without it. A test deploys the module into embedded Tomcat, so annotation scanning, the health check and CORS are checked against a real container.
* account: let users deposit cash into their account Kostya2026-10-094-3/+96
| | | | | | | | | | | | | | | | 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.
* catalog: add cumulative v3 XML loader and event mapper Kostya2026-10-086-0/+383
| | | | | | | | | | | | | | | | | | | | | | 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/.
* catalog: add v3 XML validator for cumulative uploads Kostya2026-10-082-0/+306
| | | | | | | | | | | | | | | | 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.
* tests: cover the ex-2 loader, order book trading and desktop state2.0Kostya2026-09-108-11/+1430
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* ui-desktop: build the JavaFX market UI on top of the serviceKostya2026-09-0966-13/+6430
| | | | | | | | | | | | | | | | | | | | Replace the placeholder hello-world window with a working desktop client for the guess market. ServiceEngine wires the in-memory repositories, XML loader, risk, matching, fulfillment and settlement contexts together, and AppState exposes their results as observable JavaFX state for the views to bind to. The FXML views have an events tab and a users tab. The events tab lists events with mechanism and commission filters, and shows each event's price chart, order book ladder, trade history and participants. The users tab shows each user's ledger and positions, and lets them place buy and sell orders. Dialogs cover loading an XML file (in a background task), creating an event and resolving one. Bundle a CSS theme and Nerd Font faces so the UI looks the same on every machine. Teach build.sh to copy each module's src/main/resources into its class output, since FXML, CSS and fonts are loaded from the classpath at runtime.
* service: add sell orders, event lifecycle and order book matchingKostya2026-09-0710-104/+853
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Carry the order side from the context through risk, the trading mechanisms, fulfillment and settlement, so users can sell shares as well as buy them. The order book now matches priced limit orders from named users, rests any unfilled remainder, and prevents self-trades. In a binary market with minting enabled, a buy can also match a bid on the other option to mint a new YES/NO pair, and a sell can match an ask there to merge a pair back into the pool. LMSR gains a sell that refunds the cost difference from the pool. Add createEvent and openEvent to the catalog. Events start as DRAFT and only take the market maker's subsidy when they are opened, which fails if the market maker can't cover it. Add LocalAccountContext to expose user ledgers. Tighten the risk checks: reject orders from blocked accounts, on events that aren't ACTIVE, and at prices outside (0, d). Sells need enough unreserved shares; buys need enough balance to cover commission and cash already committed to resting bids. Settlement now cancels resting orders, pays out on shares still held rather than shares ever bought, sends order book commission to the market maker, and returns unused LMSR subsidy. Events also track per-user cash flow, so the event detail can list participants with their holdings, fees and P&L next to the order books.
* service: add ex-2 XML loader and carry order side through matchingKostya2026-09-069-8/+391
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Ex-2 documents declare users and their market-maker assignments next to the events, and the loader has to reject files that are schema-valid but logically inconsistent, which the v1 loader has no notion of. Add XMLLoaderV2, which checks the extension, unmarshals the document, runs it through XMLValidatorV2 and only then replaces the event and user repositories, so a rejected file leaves the previous catalog intact. The validator enforces unique positive event ids, non-empty names and descriptions, commission within 0..90 with a known type, at least two distinct options, a positive LMSR b or order-book d with non-negative initial inventory, unique user names, positive initial cash, and exactly one existing event per market-maker reference. Let EventMapperV2 take the resolved market maker's name so it lands on the domain event. Give Order a side and the placing user, and Trade the seller, so an order book can match a buyer against a seller. Keep the previous constructors, defaulting to a BUY with no user or seller, so existing LMSR call sites stay unchanged. Route LocalMatchingEngine through the mechanism's placeOrder with side, user and limit price instead of buy(), and have cancelOrder take the order to cancel. Also add an isBlocked query to User and Ledger for accounts that went negative.
* api: extend contexts and DTOs for order books and event creationKostya2026-09-069-3/+100
| | | | | | | | | | | | | | | | | | | | | | The desktop UI needs to create events, trade on both sides of an order book, and show who is participating in an event, none of which the api module could express so far. Add AccountContext for looking up ledger accounts by owner, and give CatalogContext an openEvent operation plus createEvent, taking either a CreateEventRequest or its fields spelled out. createEvent defaults to a "Not implemented" error so existing implementations keep compiling until they support it. Let GuessMarketContext.placeOrder take an explicit side, keeping the old signature as a default method that places a BUY so current callers are unaffected. Add OrderBookDTO and BookOrderDTO to describe per-option books with best bid, best ask and spread, and ParticipantDTO for a user's position, fees and P&L in an event. Carry the order books and participants on EventDetailDTO and the market maker's name on EventSummaryDTO.
* ex-2: add invalid-input fixtures and wire ui-desktop to the serviceKostya2026-09-0614-3/+510
| | | | | | | | | | | | | | | | | | | | | The ex-2 loader has to reject documents that are schema-valid but logically broken, and so far only error-2.xml and error-3.xml exercised that path. Add one fixture per validation rule under test-data/ex-2/invalid, each a copy of small.xml with a single defect described in a leading comment: a non-.xml extension, a duplicate event id, commission outside 0..90 on either side, a duplicate user name, zero or negative initial cash, a market maker referencing an unknown event, and an event with no market maker or with two. Teach LedgerMapper to map individual LedgerEntry records to LedgerEntryDTO, renaming id to seq and time to at and rendering the timestamp through InstantOptions.humanize, so callers can show a ledger history rather than only the account summary. Make ui-desktop depend on api and service in the build tooling and in its Eclipse classpath, since the desktop UI now talks to the service layer directly, and put lib/openjfx on java.library.path for the test run so tests touching JavaFX can load its native libraries.
* catalog: add generated v3 JAXB binding and ex-2 test dataKostya2026-09-0613-0/+1026
| | | | | | | | | | | | | | | | | | | | The ex-2 schema describes a nested Guess-Market/GM-events document in which every event carries its pricing mechanism inline, as either a GM-LMSR element holding the liquidity parameter b or a GM-order-book element holding the allow-mint, initial and d attributes, instead of naming a mechanism and passing its parameters separately. Add the xjc-generated classes for that schema under catalog.model.v3, along with the fixtures the loader will be tested against: small.xml with two events, one per mechanism, multiple.xml with four, and two negative cases -- error-2.xml, where a market maker is funded with zero initial cash, and error-3.xml, where a market maker points at event id 12, which no event declares -- so the cross-reference and funding checks have something to reject. The binding covers the GM-events subtree only. The GM-users half of the document and the per-event id element are not bound yet, so nothing reads these classes so far.
* openjfx: ship native libraries so the desktop UI can launch on WindowsKostya2026-08-2364-4/+8
| | | | | | | | | | | | | | | | lib/openjfx held only the JavaFX API jars, with no Prism/Glass native libraries backing them. At startup JavaFX tried the d3d then sw rendering pipelines and both failed to load, since NativeLibLoader had no native code to find, crashing before any window opened. Bump the jars to 25.0.4 to match the target JDK and add the matching native DLLs alongside them. Drop the web/media/swt/swing jars and their natives (including the 92MB jfxwebkit.dll) since ui-desktop never references those modules. Update package.sh to also stage *.dll files when copying runtime libs into build/dist, and point java.library.path at lib/openjfx in the generated run-*.bat so the natives are found at launch.
* Merge branch 'master' of localhost:/srv/git/guess-marketKostya2026-08-230-0/+0
|\
| * api: move AccountDTO into model.ledger as LedgerDTOKostya2026-08-231-3/+2
| | | | | | | | | | | | Relocate the account record out of the api package into model.ledger, alongside LedgerEntryDTO, and rename it to LedgerDTO so the ledger DTOs live together under one package.
* | model: relocate market DTOs out of the flat api packageKostya2026-08-2316-78/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Add MapStruct LedgerMapper and wire annotation processing into build.shKostya2026-08-203-2/+117
|/ | | | | build.sh now passes -processorpath/-s so MapStruct's generated impl compiles alongside hand-written sources.
* Move CommissionTiming and MechanismType into model.event packageKostya2026-08-2017-25/+26
| | | | | Groups them with the other event-domain enums instead of the general api package, and updates all call sites accordingly.
* Add MapStruct jars to service moduleKostya2026-08-203-0/+2
| | | | | | lib/*/*.jar is auto-globbed onto the build classpath, so this makes mapstruct available for future DTO<->domain mappers without any build script changes.
* Add dotfiles to .gitignoreKostya2026-08-201-0/+2
|
* Add JaCoCo coverage reporting to test.shKostya2026-08-204-2/+20
| | | | | | Vendor jacocoagent.jar/jacococli.jar under lib/jacoco/ (excluded from the shipped classpath), attach the agent during test runs, and generate an HTML+XML report into build/coverage after tests pass.
* Simplify .gitignore1.0Kostya2026-08-181-6/+0
|
* Break down purchase receipts by cost/commission, harden XML validation and ↵Kostya2026-08-1818-76/+608
| | | | | | | | | 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.
* Wire event ledger movements, show winning market by name, seed LMSR subsidyKostya2026-08-1812-22/+64
| | | | | | | | | | | | | - Event ledger now grows on purchase and shrinks on payout, mirroring the exact amounts moved on the buyer's ledger (it previously had a Ledger object that nothing ever wrote to). - Settlement and event-detail views now show the winning market's display name instead of its raw key; event details are viewable for settled events too (the picker previously excluded anything not ACTIVE). - LMSR events seed their ledger with a SUBSIDY entry for the market maker's worst-case loss (b * ln(outcomes)), reusing the existing cost() function rather than recomputing the formula.
* Fix menu wording and reprint prompt on retryKostya2026-08-184-4/+5
| | | | | | Rename "option"/"but order" wording to "market"/"buy order", add a blank line before the command prompt, and reprint the prompt text on readInt() retries instead of leaving the user without context.
* Harden console path input against crashesKostya2026-08-184-8/+20
| | | | | | | | | Menu.start() runs command.execute() with no surrounding try/catch, so an unchecked InvalidPathException from Path.of() on bad user input crashed the whole console loop. Centralize path parsing in InputProcessor.readPath(), which now validates and reprompts instead of throwing, and strips a surrounding pair of quotes so pasted/quoted paths still work.
* Add XML schema validation, split build scripts by module, rename ↵Kostya2026-08-1828-199/+573
| | | | | | | | | BuyMenuCommand to PlaceOrderMenuCommand Introduces XMLValidatorV1 and deserializer/adapter classes for events, ledgers, markets, users, and trading mechanisms. Replaces the monolithic build.bat/run.sh scripts with per-module tools (_util.sh, build.sh, package.sh, test.sh) that compile in dependency order.
* Replace order matching with risk/matching/fulfillment/settlement pipelineKostya2026-08-1784-2200/+2133
| | | | | | | | | Move XML loading infrastructure and models under service/catalog, and split order execution into a real pipeline: RiskEngine checks the order, MatchingEngine matches it, FulfillmentContext books the resulting trades, and SettlementContext resolves winning markets. GuessMarketContext.buyShares becomes placeOrder(price, quantity), and TradingMechanism.buy now returns matched trades directly instead of a single TradeExecution.
* Split DTOs into api/model, extract order matching into service/matchingKostya2026-08-1639-297/+227
| | | | | | | 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.
* Rename Option/Account to Market/Ledger, add Result-based error handlingKostya2026-08-1638-250/+477
| | | | | | Split GuessMarketContext into a separate CatalogContext for read-only event listing, wrap fallible operations in Result<T> instead of throwing, and wire load/save of events and users through a JSON Wrapper.
* Implement LMSR and order-book trading logic, wire MarketContext facade and ↵Kostya2026-08-1529-114/+600
| | | | | | | | | | | 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.
* Switch TradingMechanism quantities to int, add yes/no and select promptsKostya2026-08-144-6/+35
| | | | | | | | | TradingMechanism's q/quantity params move from long/long[] to int/int[] to match the rest of the domain (Trade.quantity, Option counts, etc. are already int). Add InputProcessor.readYesNo and readSelect for upcoming menu commands that need a confirm prompt or a pick-from-list prompt.
* Collapse console I/O interfaces into InputProcessor, drop unneeded atomicsKostya2026-08-1413-120/+63
| | | | | | | | | | | InputProvider/OutputProvider each had one implementation and no test exercised the seam, so fold Console{Input,Output}Provider straight into InputProcessor and update Menu/MenuCommand call sites accordingly. Account and Event both use AtomicInteger for a ledger/trade id counter that's only ever touched next to a plain, non-thread-safe ArrayList add in the same method - the atomic bought no real thread-safety. Swapped both to plain int with ++.
* Implement in-memory repositories, XML load validation, and menu exit/list ↵Kostya2026-08-1421-61/+359
| | | | | | | | | | | | | | commands - Add generic Repository<T> interface; EventRepository/UserRepository extend it - Implement InMemoryEventRepository/InMemoryUserRepository backed by ArrayList - Rename XMLLoader to XMLLoaderV1, add LoadValidator and mapper/v2 package - Add OrderBookTradingMechanism - Add User(String, int) convenience constructor - Add ListEventsMenuCommand and ExitMenuCommand, isExit() on MenuCommand - Menu now sizes selection range by max command index and exits on isExit() - LoadFileMenuCommand reports validation issues on failed loads - Untrack test-data/ and config.properties from .gitignore
* Move mapper/provider infra into v1 packages, add repository write methodsKostya2026-08-149-18/+83
| | | | | Correct Mapper's generic parameter order to <TModel, TDomain> and stub addEvent/addUser on the Event/User repositories.
* Move IO providers into io package, add InputProcessor, implement menu loop ↵Kostya2026-08-149-24/+116
| | | | | | | and file load command Wires InputProcessor into the console menu's selection loop and the load-file command's prompt handling, replacing the unimplemented stub.
* Wire buyShares and menu commands, replace factory interfaces with DIKostya2026-08-1421-64/+211
| | | | | | | | Implement LocalGuessMarketContext.buyShares/loadEvents via a new TradingOperation and Loader, backed by in-memory repositories. Replace the ConsoleInputProviderFactory/ConsoleOutputProviderFactory pattern with picocontainer-injected providers, and drive the menu from a list of MenuCommand implementations instead of a hardcoded printout.
* Add ledgered credit/debit to Account and trade recording to EventKostya2026-08-146-26/+67
| | | | | | | Drops AccountType (accounts no longer need to self-identify), gives Account credit()/debit() that append LedgerEntry rows, adds Event.recordTrade()/tradeVolumeOf()/getCommission(), and implements LocalGuessMarketContext.listEvents() via the repository.
* Implement LMSR mechanism and Event/Account accessors, wire EventMapperV1Kostya2026-08-144-2/+176
| | | | | | Adds LmsrTradingMechanism, exposes Event/Account getters plus Event.toEventSummary() for DTO conversion, and implements EventMapperV1.toDomain() to build Event from the legacy XML model.
* Wire EventRepository into LocalGuessMarketContext, add mapper/provider infra ↵Kostya2026-08-148-5/+49
| | | | | | | and tests Removes the placeholder Mapper interface in favor of concrete mapper/provider implementations, fixes Menu.stop() to no-op instead of throwing.
* Add legacy XML model bindings, mapper infra, and normalize account balanceKostya2026-08-1328-4/+2277
| | | | | Rename repositories package to repository, add MarketAction domain type, and round Account.initialBalance through BigDecimalOptions.toMoney.
* Add domain model, repositories, and trading mechanism interfaces to service ↵Kostya2026-08-1311-0/+197
| | | | | | | module Introduces Account/Event/Trade/User/Option/LedgerEntry domain types plus EventRepository/UserRepository and TradingMechanism abstractions.