aboutsummaryrefslogtreecommitdiffstats
path: root/service/src
diff options
context:
space:
mode:
authorKostya <mail@sartin.in>2026-08-17 11:15:59 +0000
committerKostya <mail@sartin.in>2026-08-17 11:15:59 +0000
commit13a221ffaefc169d028c7eab6f21ac88052d1d40 (patch)
tree51e4fd676ba043de73e967b854be683c5836ef24 /service/src
parenteed9265be711432f40247f149c07f9e33511192a (diff)
downloadguess-market-13a221ffaefc169d028c7eab6f21ac88052d1d40.tar.gz
guess-market-13a221ffaefc169d028c7eab6f21ac88052d1d40.tar.xz
guess-market-13a221ffaefc169d028c7eab6f21ac88052d1d40.zip
Replace order matching with risk/matching/fulfillment/settlement pipeline
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.
Diffstat (limited to 'service/src')
-rw-r--r--service/src/main/java/market/guess/service/LocalGuessMarketContext.java53
-rw-r--r--service/src/main/java/market/guess/service/catalog/LocalCatalogContext.java21
-rw-r--r--service/src/main/java/market/guess/service/catalog/infrastructure/MarketContext.java (renamed from service/src/main/java/market/guess/service/infrastructure/MarketContext.java)8
-rw-r--r--service/src/main/java/market/guess/service/catalog/infrastructure/adapter/InstantTypeAdapter.java (renamed from service/src/main/java/market/guess/service/infrastructure/adapter/InstantTypeAdapter.java)2
-rw-r--r--service/src/main/java/market/guess/service/catalog/infrastructure/mapper/Mapper.java (renamed from service/src/main/java/market/guess/service/infrastructure/mapper/Mapper.java)2
-rw-r--r--service/src/main/java/market/guess/service/catalog/infrastructure/mapper/v1/EventMapperV1.java (renamed from service/src/main/java/market/guess/service/infrastructure/mapper/v1/EventMapperV1.java)9
-rw-r--r--service/src/main/java/market/guess/service/catalog/infrastructure/mapper/v2/EventMapperV2.java (renamed from service/src/main/java/market/guess/service/infrastructure/mapper/v2/EventMapperV2.java)10
-rw-r--r--service/src/main/java/market/guess/service/catalog/infrastructure/provider/Loader.java12
-rw-r--r--service/src/main/java/market/guess/service/catalog/infrastructure/provider/v1/XMLLoaderV1.java (renamed from service/src/main/java/market/guess/service/infrastructure/provider/v1/XMLLoaderV1.java)28
-rw-r--r--service/src/main/java/market/guess/service/catalog/infrastructure/repository/EventRepository.java (renamed from service/src/main/java/market/guess/service/infrastructure/repository/EventRepository.java)2
-rw-r--r--service/src/main/java/market/guess/service/catalog/infrastructure/repository/InMemoryEventRepository.java (renamed from service/src/main/java/market/guess/service/infrastructure/repository/InMemoryEventRepository.java)2
-rw-r--r--service/src/main/java/market/guess/service/catalog/infrastructure/repository/InMemoryUserRepository.java (renamed from service/src/main/java/market/guess/service/infrastructure/repository/InMemoryUserRepository.java)2
-rw-r--r--service/src/main/java/market/guess/service/catalog/infrastructure/repository/Repository.java (renamed from service/src/main/java/market/guess/service/infrastructure/repository/Repository.java)2
-rw-r--r--service/src/main/java/market/guess/service/catalog/infrastructure/repository/UserRepository.java (renamed from service/src/main/java/market/guess/service/infrastructure/repository/UserRepository.java)2
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v1/Comision.java (renamed from service/src/main/java/market/guess/service/model/v1/Comision.java)93
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v1/GMEvent.java173
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v1/GMEvents.java67
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v1/GMLMSR.java (renamed from service/src/main/java/market/guess/service/model/v1/GMLMSR.java)51
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v1/GMMethod.java (renamed from service/src/main/java/market/guess/service/model/v1/GMMethod.java)69
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v1/GMOptions.java67
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v1/GuessMarket.java (renamed from service/src/main/java/market/guess/service/model/v1/GuessMarket.java)69
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v1/ObjectFactory.java143
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v2/Commission.java (renamed from service/src/main/java/market/guess/service/model/v2/Commission.java)93
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v2/Event.java (renamed from service/src/main/java/market/guess/service/model/v2/Event.java)47
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v2/GMEvent.java161
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v2/GMEvents.java67
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v2/GMLMSR.java (renamed from service/src/main/java/market/guess/service/model/v2/GMLMSR.java)51
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v2/GMMarketMaker.java67
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v2/GMMethod.java81
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v2/GMOptions.java67
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v2/GMOrderBook.java90
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v2/GMUser.java96
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v2/GMUsers.java67
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v2/GuessMarket.java81
-rw-r--r--service/src/main/java/market/guess/service/catalog/model/v2/ObjectFactory.java200
-rw-r--r--service/src/main/java/market/guess/service/domain/Event.java32
-rw-r--r--service/src/main/java/market/guess/service/domain/Market.java13
-rw-r--r--service/src/main/java/market/guess/service/domain/MarketAction.java24
-rw-r--r--service/src/main/java/market/guess/service/domain/Order.java6
-rw-r--r--service/src/main/java/market/guess/service/domain/Settlement.java6
-rw-r--r--service/src/main/java/market/guess/service/domain/Trade.java8
-rw-r--r--service/src/main/java/market/guess/service/domain/User.java1
-rw-r--r--service/src/main/java/market/guess/service/fulfillment/FulfillmentContext.java10
-rw-r--r--service/src/main/java/market/guess/service/fulfillment/LocalFulfillmentContext.java51
-rw-r--r--service/src/main/java/market/guess/service/helpers/BigDecimalOptions.java (renamed from service/src/main/java/market/guess/service/domain/BigDecimalOptions.java)4
-rw-r--r--service/src/main/java/market/guess/service/helpers/InstantOptions.java16
-rw-r--r--service/src/main/java/market/guess/service/infrastructure/provider/Loader.java9
-rw-r--r--service/src/main/java/market/guess/service/ledger/Ledger.java3
-rw-r--r--service/src/main/java/market/guess/service/ledger/LedgerContext.java6
-rw-r--r--service/src/main/java/market/guess/service/matching/LocalMatchingEngine.java20
-rw-r--r--service/src/main/java/market/guess/service/matching/MatchingEngine.java11
-rw-r--r--service/src/main/java/market/guess/service/matching/OrderMatchingContext.java13
-rw-r--r--service/src/main/java/market/guess/service/mechanism/LmsrTradingMechanism.java34
-rw-r--r--service/src/main/java/market/guess/service/mechanism/OrderBookTradingMechanism.java14
-rw-r--r--service/src/main/java/market/guess/service/mechanism/TradingMechanism.java7
-rw-r--r--service/src/main/java/market/guess/service/model/v1/GMEvent.java215
-rw-r--r--service/src/main/java/market/guess/service/model/v1/GMEvents.java80
-rw-r--r--service/src/main/java/market/guess/service/model/v1/GMOptions.java80
-rw-r--r--service/src/main/java/market/guess/service/model/v1/ObjectFactory.java167
-rw-r--r--service/src/main/java/market/guess/service/model/v2/GMEvent.java201
-rw-r--r--service/src/main/java/market/guess/service/model/v2/GMEvents.java80
-rw-r--r--service/src/main/java/market/guess/service/model/v2/GMMarketMaker.java80
-rw-r--r--service/src/main/java/market/guess/service/model/v2/GMMethod.java98
-rw-r--r--service/src/main/java/market/guess/service/model/v2/GMOptions.java80
-rw-r--r--service/src/main/java/market/guess/service/model/v2/GMOrderBook.java111
-rw-r--r--service/src/main/java/market/guess/service/model/v2/GMUser.java118
-rw-r--r--service/src/main/java/market/guess/service/model/v2/GMUsers.java80
-rw-r--r--service/src/main/java/market/guess/service/model/v2/GuessMarket.java97
-rw-r--r--service/src/main/java/market/guess/service/model/v2/ObjectFactory.java231
-rw-r--r--service/src/main/java/market/guess/service/risk/LocalRiskEngine.java18
-rw-r--r--service/src/main/java/market/guess/service/risk/RiskEngine.java9
-rw-r--r--service/src/main/java/market/guess/service/settlement/LocalSettlementContext.java50
-rw-r--r--service/src/main/java/market/guess/service/settlement/SettlementContext.java8
73 files changed, 1995 insertions, 2151 deletions
diff --git a/service/src/main/java/market/guess/service/LocalGuessMarketContext.java b/service/src/main/java/market/guess/service/LocalGuessMarketContext.java
index 3feef6a..29e3f5c 100644
--- a/service/src/main/java/market/guess/service/LocalGuessMarketContext.java
+++ b/service/src/main/java/market/guess/service/LocalGuessMarketContext.java
@@ -1,26 +1,44 @@
1package market.guess.service; 1package market.guess.service;
2 2
3import java.math.BigDecimal;
4import java.time.Instant;
3import market.guess.api.GuessMarketContext; 5import market.guess.api.GuessMarketContext;
4import market.guess.api.PurchaseReceiptDTO; 6import market.guess.api.PurchaseReceiptDTO;
5import market.guess.api.Result; 7import market.guess.api.Result;
6import market.guess.api.TradeRowDTO; 8import market.guess.api.TradeRowDTO;
7import market.guess.model.event.EventDetailDTO; 9import market.guess.model.event.EventDetailDTO;
8import market.guess.service.infrastructure.MarketContext; 10import market.guess.service.catalog.infrastructure.MarketContext;
9import market.guess.service.matching.OrderMatchingContext; 11import market.guess.service.domain.Order;
12import market.guess.service.fulfillment.FulfillmentContext;
13import market.guess.service.helpers.InstantOptions;
14import market.guess.service.matching.MatchingEngine;
15import market.guess.service.risk.RiskEngine;
16import market.guess.service.settlement.SettlementContext;
10 17
11public final class LocalGuessMarketContext implements GuessMarketContext { 18public final class LocalGuessMarketContext implements GuessMarketContext {
12 private final OrderMatchingContext orderMatching;
13 private final MarketContext context; 19 private final MarketContext context;
20 private final RiskEngine risk;
21 private final MatchingEngine matching;
22 private final FulfillmentContext fulfillment;
23 private final SettlementContext settlement;
14 24
15 public LocalGuessMarketContext(MarketContext context, OrderMatchingContext orderMatching) { 25 public LocalGuessMarketContext(
26 MarketContext context,
27 RiskEngine risk,
28 MatchingEngine matching,
29 FulfillmentContext fulfillment,
30 SettlementContext settlement) {
16 super(); 31 super();
17 this.context = context; 32 this.context = context;
18 this.orderMatching = orderMatching; 33 this.risk = risk;
34 this.matching = matching;
35 this.fulfillment = fulfillment;
36 this.settlement = settlement;
19 } 37 }
20 38
21 @Override 39 @Override
22 public Result<PurchaseReceiptDTO> buyShares( 40 public Result<PurchaseReceiptDTO> placeOrder(
23 String userName, String eventKey, String optionKey, int quantity) { 41 String userName, String eventKey, String optionKey, BigDecimal price, long quantity) {
24 var optional = context.getEvents().get(eventKey); 42 var optional = context.getEvents().get(eventKey);
25 43
26 var userOptional = context.getUsers().get(userName); 44 var userOptional = context.getUsers().get(userName);
@@ -30,17 +48,22 @@ public final class LocalGuessMarketContext implements GuessMarketContext {
30 var event = optional.get(); 48 var event = optional.get();
31 var user = userOptional.get(); 49 var user = userOptional.get();
32 var option = event.getOption(optionKey); 50 var option = event.getOption(optionKey);
51 var order = new Order(Instant.now(), event, option, price, quantity);
33 52
34 var trades = orderMatching.submitOrder(user, event, option, quantity); 53 var riskResult = risk.check(user, order);
54 if (!riskResult.isSuccess()) return Result.error(riskResult.getMessage());
55
56 var rawTrades = matching.match(order);
57 var trades = fulfillment.fulfill(user, order, rawTrades);
35 return Result.ok( 58 return Result.ok(
36 new PurchaseReceiptDTO( 59 new PurchaseReceiptDTO(
37 trades.stream() 60 trades.stream()
38 .map( 61 .map(
39 t -> 62 t ->
40 new TradeRowDTO( 63 new TradeRowDTO(
41 t.at().toString(), 64 InstantOptions.humanize(t.at()),
42 t.userName(), 65 t.buyerUserName(),
43 t.optionName(), 66 t.marketName(),
44 String.valueOf(t.quantity()), 67 String.valueOf(t.quantity()),
45 t.totalPaid().toPlainString())) 68 t.totalPaid().toPlainString()))
46 .toList(), 69 .toList(),
@@ -56,12 +79,14 @@ public final class LocalGuessMarketContext implements GuessMarketContext {
56 79
57 var event = optional.get(); 80 var event = optional.get();
58 if (event.canSettle(userName)) { 81 if (event.canSettle(userName)) {
59 82 settlement.settle(event, winningOptionKey);
60 var payout = event.getPayout();
61 83
62 return Result.ok( 84 return Result.ok(
63 new EventDetailDTO( 85 new EventDetailDTO(
64 event.toEventSummary(), event.toMarketState(), event.getHistory(), "")); 86 event.toEventSummary(),
87 event.toMarketState(),
88 event.getHistory(),
89 event.getWinningOptionKey()));
65 } 90 }
66 91
67 return Result.error("Couldn't settle event."); 92 return Result.error("Couldn't settle event.");
diff --git a/service/src/main/java/market/guess/service/catalog/LocalCatalogContext.java b/service/src/main/java/market/guess/service/catalog/LocalCatalogContext.java
index 6035ce7..7a32e62 100644
--- a/service/src/main/java/market/guess/service/catalog/LocalCatalogContext.java
+++ b/service/src/main/java/market/guess/service/catalog/LocalCatalogContext.java
@@ -3,37 +3,40 @@ package market.guess.service.catalog;
3import java.nio.file.Path; 3import java.nio.file.Path;
4import java.util.List; 4import java.util.List;
5import market.guess.api.CatalogContext; 5import market.guess.api.CatalogContext;
6import market.guess.api.LoadResultDTO; 6import market.guess.api.LoadResult;
7import market.guess.api.Result; 7import market.guess.api.Result;
8import market.guess.model.event.EventDetailDTO; 8import market.guess.model.event.EventDetailDTO;
9import market.guess.model.event.EventSummaryDTO; 9import market.guess.model.event.EventSummaryDTO;
10import market.guess.service.catalog.infrastructure.MarketContext;
11import market.guess.service.catalog.infrastructure.provider.Loader;
12import market.guess.service.catalog.infrastructure.repository.EventRepository;
10import market.guess.service.domain.Event; 13import market.guess.service.domain.Event;
11import market.guess.service.infrastructure.MarketContext;
12import market.guess.service.infrastructure.provider.Loader;
13 14
14public final class LocalCatalogContext implements CatalogContext { 15public final class LocalCatalogContext implements CatalogContext {
15 private final MarketContext context; 16 private final MarketContext context;
16 private final Loader provider; 17 private final Loader provider;
18 private final EventRepository events;
17 19
18 public LocalCatalogContext(Loader provider, MarketContext context) { 20 public LocalCatalogContext(Loader provider, MarketContext context, EventRepository events) {
19 super(); 21 super();
20 this.provider = provider; 22 this.provider = provider;
21 this.context = context; 23 this.context = context;
24 this.events = events;
22 } 25 }
23 26
24 @Override 27 @Override
25 public Result<LoadResultDTO> loadEvents(Path path) { 28 public Result<LoadResult> loadEvents(Path path) {
26 return provider.load(path); 29 return provider.load(path);
27 } 30 }
28 31
29 @Override 32 @Override
30 public Result<List<EventSummaryDTO>> getAllEvents() { 33 public Result<List<EventSummaryDTO>> getAllEvents() {
31 return Result.ok(context.getEvents().getAll().stream().map(Event::toEventSummary).toList()); 34 return Result.ok(events.getAll().stream().map(Event::toEventSummary).toList());
32 } 35 }
33 36
34 @Override 37 @Override
35 public Result<EventDetailDTO> getEvent(String eventKey) { 38 public Result<EventDetailDTO> getEvent(String eventKey) {
36 var optional = context.getEvents().get(eventKey); 39 var optional = events.get(eventKey);
37 40
38 if (optional.isEmpty()) return Result.error("Unable to find event."); 41 if (optional.isEmpty()) return Result.error("Unable to find event.");
39 var event = optional.get(); 42 var event = optional.get();
@@ -53,12 +56,12 @@ public final class LocalCatalogContext implements CatalogContext {
53 } 56 }
54 57
55 @Override 58 @Override
56 public Result<LoadResultDTO> restoreState(Path path) { 59 public Result<LoadResult> restoreState(Path path) {
57 try { 60 try {
58 context.load(); 61 context.load();
59 } catch (Exception e) { 62 } catch (Exception e) {
60 return Result.error("Failed to load.", e.getMessage()); 63 return Result.error("Failed to load.", e.getMessage());
61 } 64 }
62 return Result.ok(new LoadResultDTO(path.toString(), context.getEvents().getAll().size())); 65 return Result.ok(new LoadResult(path.toString(), context.getEvents().getAll().size()));
63 } 66 }
64} 67}
diff --git a/service/src/main/java/market/guess/service/infrastructure/MarketContext.java b/service/src/main/java/market/guess/service/catalog/infrastructure/MarketContext.java
index 7113803..24521ef 100644
--- a/service/src/main/java/market/guess/service/infrastructure/MarketContext.java
+++ b/service/src/main/java/market/guess/service/catalog/infrastructure/MarketContext.java
@@ -1,4 +1,4 @@
1package market.guess.service.infrastructure; 1package market.guess.service.catalog.infrastructure;
2 2
3import com.google.gson.Gson; 3import com.google.gson.Gson;
4import com.google.gson.GsonBuilder; 4import com.google.gson.GsonBuilder;
@@ -11,11 +11,11 @@ import java.nio.file.Paths;
11import java.time.Instant; 11import java.time.Instant;
12import java.util.List; 12import java.util.List;
13import market.guess.exception.GuessMarketException; 13import market.guess.exception.GuessMarketException;
14import market.guess.service.catalog.infrastructure.adapter.InstantTypeAdapter;
15import market.guess.service.catalog.infrastructure.repository.EventRepository;
16import market.guess.service.catalog.infrastructure.repository.UserRepository;
14import market.guess.service.domain.Event; 17import market.guess.service.domain.Event;
15import market.guess.service.domain.User; 18import market.guess.service.domain.User;
16import market.guess.service.infrastructure.adapter.InstantTypeAdapter;
17import market.guess.service.infrastructure.repository.EventRepository;
18import market.guess.service.infrastructure.repository.UserRepository;
19 19
20public final class MarketContext { 20public final class MarketContext {
21 record Wrapper(List<Event> events, List<User> users) {} 21 record Wrapper(List<Event> events, List<User> users) {}
diff --git a/service/src/main/java/market/guess/service/infrastructure/adapter/InstantTypeAdapter.java b/service/src/main/java/market/guess/service/catalog/infrastructure/adapter/InstantTypeAdapter.java
index bc5ddb0..09af0b3 100644
--- a/service/src/main/java/market/guess/service/infrastructure/adapter/InstantTypeAdapter.java
+++ b/service/src/main/java/market/guess/service/catalog/infrastructure/adapter/InstantTypeAdapter.java
@@ -1,4 +1,4 @@
1package market.guess.service.infrastructure.adapter; 1package market.guess.service.catalog.infrastructure.adapter;
2 2
3import com.google.gson.*; 3import com.google.gson.*;
4import java.lang.reflect.Type; 4import java.lang.reflect.Type;
diff --git a/service/src/main/java/market/guess/service/infrastructure/mapper/Mapper.java b/service/src/main/java/market/guess/service/catalog/infrastructure/mapper/Mapper.java
index e3c77bf..c6bd5b6 100644
--- a/service/src/main/java/market/guess/service/infrastructure/mapper/Mapper.java
+++ b/service/src/main/java/market/guess/service/catalog/infrastructure/mapper/Mapper.java
@@ -1,4 +1,4 @@
1package market.guess.service.infrastructure.mapper; 1package market.guess.service.catalog.infrastructure.mapper;
2 2
3public interface Mapper<TModel, TDomain> { 3public interface Mapper<TModel, TDomain> {
4 TDomain toDomain(TModel source); 4 TDomain toDomain(TModel source);
diff --git a/service/src/main/java/market/guess/service/infrastructure/mapper/v1/EventMapperV1.java b/service/src/main/java/market/guess/service/catalog/infrastructure/mapper/v1/EventMapperV1.java
index f049a0b..78fd550 100644
--- a/service/src/main/java/market/guess/service/infrastructure/mapper/v1/EventMapperV1.java
+++ b/service/src/main/java/market/guess/service/catalog/infrastructure/mapper/v1/EventMapperV1.java
@@ -1,14 +1,14 @@
1package market.guess.service.infrastructure.mapper.v1; 1package market.guess.service.catalog.infrastructure.mapper.v1;
2 2
3import java.util.ArrayList; 3import java.util.ArrayList;
4import java.util.List; 4import java.util.List;
5import market.guess.api.CommissionTiming; 5import market.guess.api.CommissionTiming;
6import market.guess.model.event.EventStatus; 6import market.guess.model.event.EventStatus;
7import market.guess.service.catalog.infrastructure.mapper.Mapper;
8import market.guess.service.catalog.model.v1.GMEvent;
7import market.guess.service.domain.Event; 9import market.guess.service.domain.Event;
8import market.guess.service.domain.Market; 10import market.guess.service.domain.Market;
9import market.guess.service.infrastructure.mapper.Mapper;
10import market.guess.service.mechanism.LmsrTradingMechanism; 11import market.guess.service.mechanism.LmsrTradingMechanism;
11import market.guess.service.model.v1.GMEvent;
12 12
13public final class EventMapperV1 implements Mapper<GMEvent, Event> { 13public final class EventMapperV1 implements Mapper<GMEvent, Event> {
14 14
@@ -26,7 +26,8 @@ public final class EventMapperV1 implements Mapper<GMEvent, Event> {
26 new LmsrTradingMechanism(source.getGMMethod().getGMLMSR().getB(), options.size()), 26 new LmsrTradingMechanism(source.getGMMethod().getGMLMSR().getB(), options.size()),
27 EventStatus.ACTIVE, 27 EventStatus.ACTIVE,
28 options, 28 options,
29 ""); 29 "Tester"); // ponytail: only user in this console app; swap for a real market-maker
30 // concept if multi-user support lands
30 } 31 }
31 32
32 private static String getEventKey(GMEvent event) { 33 private static String getEventKey(GMEvent event) {
diff --git a/service/src/main/java/market/guess/service/infrastructure/mapper/v2/EventMapperV2.java b/service/src/main/java/market/guess/service/catalog/infrastructure/mapper/v2/EventMapperV2.java
index 7037c02..82455f1 100644
--- a/service/src/main/java/market/guess/service/infrastructure/mapper/v2/EventMapperV2.java
+++ b/service/src/main/java/market/guess/service/catalog/infrastructure/mapper/v2/EventMapperV2.java
@@ -1,18 +1,18 @@
1package market.guess.service.infrastructure.mapper.v2; 1package market.guess.service.catalog.infrastructure.mapper.v2;
2 2
3import java.util.ArrayList; 3import java.util.ArrayList;
4import java.util.List; 4import java.util.List;
5import market.guess.api.CommissionTiming; 5import market.guess.api.CommissionTiming;
6import market.guess.model.event.EventStatus; 6import market.guess.model.event.EventStatus;
7import market.guess.service.catalog.infrastructure.mapper.Mapper;
8import market.guess.service.catalog.model.v2.GMEvent;
9import market.guess.service.catalog.model.v2.GMLMSR;
10import market.guess.service.catalog.model.v2.GMOrderBook;
7import market.guess.service.domain.Event; 11import market.guess.service.domain.Event;
8import market.guess.service.domain.Market; 12import market.guess.service.domain.Market;
9import market.guess.service.infrastructure.mapper.Mapper;
10import market.guess.service.mechanism.LmsrTradingMechanism; 13import market.guess.service.mechanism.LmsrTradingMechanism;
11import market.guess.service.mechanism.OrderBookTradingMechanism; 14import market.guess.service.mechanism.OrderBookTradingMechanism;
12import market.guess.service.mechanism.TradingMechanism; 15import market.guess.service.mechanism.TradingMechanism;
13import market.guess.service.model.v2.GMEvent;
14import market.guess.service.model.v2.GMLMSR;
15import market.guess.service.model.v2.GMOrderBook;
16 16
17public final class EventMapperV2 implements Mapper<GMEvent, Event> { 17public final class EventMapperV2 implements Mapper<GMEvent, Event> {
18 18
diff --git a/service/src/main/java/market/guess/service/catalog/infrastructure/provider/Loader.java b/service/src/main/java/market/guess/service/catalog/infrastructure/provider/Loader.java
new file mode 100644
index 0000000..62406bb
--- /dev/null
+++ b/service/src/main/java/market/guess/service/catalog/infrastructure/provider/Loader.java
@@ -0,0 +1,12 @@
1package market.guess.service.catalog.infrastructure.provider;
2
3import java.nio.file.Path;
4import market.guess.api.CatalogContext;
5import market.guess.api.LoadResult;
6import market.guess.api.Result;
7
8public interface Loader {
9 Result<LoadResult> seed(CatalogContext context);
10
11 Result<LoadResult> load(Path path);
12}
diff --git a/service/src/main/java/market/guess/service/infrastructure/provider/v1/XMLLoaderV1.java b/service/src/main/java/market/guess/service/catalog/infrastructure/provider/v1/XMLLoaderV1.java
index 412a5d2..67d0b67 100644
--- a/service/src/main/java/market/guess/service/infrastructure/provider/v1/XMLLoaderV1.java
+++ b/service/src/main/java/market/guess/service/catalog/infrastructure/provider/v1/XMLLoaderV1.java
@@ -1,17 +1,18 @@
1package market.guess.service.infrastructure.provider.v1; 1package market.guess.service.catalog.infrastructure.provider.v1;
2 2
3import jakarta.xml.bind.JAXBContext; 3import jakarta.xml.bind.JAXBContext;
4import jakarta.xml.bind.JAXBException; 4import jakarta.xml.bind.JAXBException;
5import java.nio.file.Files; 5import java.nio.file.Files;
6import java.nio.file.Path; 6import java.nio.file.Path;
7import market.guess.api.LoadResultDTO; 7import market.guess.api.CatalogContext;
8import market.guess.api.LoadResult;
8import market.guess.api.Result; 9import market.guess.api.Result;
10import market.guess.service.catalog.infrastructure.mapper.v1.EventMapperV1;
11import market.guess.service.catalog.infrastructure.provider.Loader;
12import market.guess.service.catalog.infrastructure.repository.EventRepository;
13import market.guess.service.catalog.infrastructure.repository.UserRepository;
14import market.guess.service.catalog.model.v1.GuessMarket;
9import market.guess.service.domain.User; 15import market.guess.service.domain.User;
10import market.guess.service.infrastructure.mapper.v1.EventMapperV1;
11import market.guess.service.infrastructure.provider.Loader;
12import market.guess.service.infrastructure.repository.EventRepository;
13import market.guess.service.infrastructure.repository.UserRepository;
14import market.guess.service.model.v1.GuessMarket;
15 16
16public final class XMLLoaderV1 implements Loader { 17public final class XMLLoaderV1 implements Loader {
17 private final JAXBContext context; 18 private final JAXBContext context;
@@ -34,26 +35,29 @@ public final class XMLLoaderV1 implements Loader {
34 } 35 }
35 36
36 @Override 37 @Override
37 public Result<LoadResultDTO> load(Path path) { 38 public Result<LoadResult> load(Path path) {
38
39 if (path.getFileName() == null 39 if (path.getFileName() == null
40 || !path.getFileName().toString().toLowerCase().endsWith(".xml")) { 40 || !path.getFileName().toString().toLowerCase().endsWith(".xml")) {
41 return Result.error("NOT_XML", "The file must be an XML."); 41 return Result.error("NOT_XML", "The file must be an XML.");
42 } 42 }
43 43
44 try (var stream = Files.newInputStream(path)) { 44 try (var stream = Files.newInputStream(path)) {
45
46 var doc = (GuessMarket) context.createUnmarshaller().unmarshal(stream); 45 var doc = (GuessMarket) context.createUnmarshaller().unmarshal(stream);
47
48 for (var event : doc.getGMEvents().getGMEvent()) { 46 for (var event : doc.getGMEvents().getGMEvent()) {
49 eventRepository.add(mapper.toDomain(event)); 47 eventRepository.add(mapper.toDomain(event));
50 } 48 }
51 49
52 userRepository.add(new User("Tester", 9_999_999)); 50 userRepository.add(new User("Tester", 9_999_999));
53 51
54 return Result.ok(new LoadResultDTO(path.toString(), eventRepository.getAll().size())); 52 return Result.ok(new LoadResult(path.toString(), eventRepository.getAll().size()));
55 } catch (Exception e) { 53 } catch (Exception e) {
56 return Result.error("UNREADABLE", "The file could not be read."); 54 return Result.error("UNREADABLE", "The file could not be read.");
57 } 55 }
58 } 56 }
57
58 @Override
59 public Result<LoadResult> seed(CatalogContext context) {
60 // TODO Auto-generated method stub
61 throw new UnsupportedOperationException("Unimplemented method 'seed'");
62 }
59} 63}
diff --git a/service/src/main/java/market/guess/service/infrastructure/repository/EventRepository.java b/service/src/main/java/market/guess/service/catalog/infrastructure/repository/EventRepository.java
index 186695b..be71a49 100644
--- a/service/src/main/java/market/guess/service/infrastructure/repository/EventRepository.java
+++ b/service/src/main/java/market/guess/service/catalog/infrastructure/repository/EventRepository.java
@@ -1,4 +1,4 @@
1package market.guess.service.infrastructure.repository; 1package market.guess.service.catalog.infrastructure.repository;
2 2
3import market.guess.service.domain.Event; 3import market.guess.service.domain.Event;
4 4
diff --git a/service/src/main/java/market/guess/service/infrastructure/repository/InMemoryEventRepository.java b/service/src/main/java/market/guess/service/catalog/infrastructure/repository/InMemoryEventRepository.java
index 8b8eeb2..96c898b 100644
--- a/service/src/main/java/market/guess/service/infrastructure/repository/InMemoryEventRepository.java
+++ b/service/src/main/java/market/guess/service/catalog/infrastructure/repository/InMemoryEventRepository.java
@@ -1,4 +1,4 @@
1package market.guess.service.infrastructure.repository; 1package market.guess.service.catalog.infrastructure.repository;
2 2
3import java.util.ArrayList; 3import java.util.ArrayList;
4import java.util.Collections; 4import java.util.Collections;
diff --git a/service/src/main/java/market/guess/service/infrastructure/repository/InMemoryUserRepository.java b/service/src/main/java/market/guess/service/catalog/infrastructure/repository/InMemoryUserRepository.java
index b611a77..a9c0e8d 100644
--- a/service/src/main/java/market/guess/service/infrastructure/repository/InMemoryUserRepository.java
+++ b/service/src/main/java/market/guess/service/catalog/infrastructure/repository/InMemoryUserRepository.java
@@ -1,4 +1,4 @@
1package market.guess.service.infrastructure.repository; 1package market.guess.service.catalog.infrastructure.repository;
2 2
3import java.util.ArrayList; 3import java.util.ArrayList;
4import java.util.Collections; 4import java.util.Collections;
diff --git a/service/src/main/java/market/guess/service/infrastructure/repository/Repository.java b/service/src/main/java/market/guess/service/catalog/infrastructure/repository/Repository.java
index 41cb578..b165b48 100644
--- a/service/src/main/java/market/guess/service/infrastructure/repository/Repository.java
+++ b/service/src/main/java/market/guess/service/catalog/infrastructure/repository/Repository.java
@@ -1,4 +1,4 @@
1package market.guess.service.infrastructure.repository; 1package market.guess.service.catalog.infrastructure.repository;
2 2
3import java.util.List; 3import java.util.List;
4import java.util.Optional; 4import java.util.Optional;
diff --git a/service/src/main/java/market/guess/service/infrastructure/repository/UserRepository.java b/service/src/main/java/market/guess/service/catalog/infrastructure/repository/UserRepository.java
index 4f0b0a6..ef9a543 100644
--- a/service/src/main/java/market/guess/service/infrastructure/repository/UserRepository.java
+++ b/service/src/main/java/market/guess/service/catalog/infrastructure/repository/UserRepository.java
@@ -1,4 +1,4 @@
1package market.guess.service.infrastructure.repository; 1package market.guess.service.catalog.infrastructure.repository;
2 2
3import market.guess.service.domain.User; 3import market.guess.service.domain.User;
4 4
diff --git a/service/src/main/java/market/guess/service/model/v1/Comision.java b/service/src/main/java/market/guess/service/catalog/model/v1/Comision.java
index c8a374c..17c7a0b 100644
--- a/service/src/main/java/market/guess/service/model/v1/Comision.java
+++ b/service/src/main/java/market/guess/service/catalog/model/v1/Comision.java
@@ -1,11 +1,10 @@
1// 1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5 2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri 3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema. 4// Any modifications to this file will be lost upon recompilation of the source schema.
5// 5//
6 6
7 7package market.guess.service.catalog.model.v1;
8package market.guess.service.model.v1;
9 8
10import jakarta.xml.bind.annotation.XmlAccessType; 9import jakarta.xml.bind.annotation.XmlAccessType;
11import jakarta.xml.bind.annotation.XmlAccessorType; 10import jakarta.xml.bind.annotation.XmlAccessorType;
@@ -14,12 +13,11 @@ import jakarta.xml.bind.annotation.XmlRootElement;
14import jakarta.xml.bind.annotation.XmlType; 13import jakarta.xml.bind.annotation.XmlType;
15import jakarta.xml.bind.annotation.XmlValue; 14import jakarta.xml.bind.annotation.XmlValue;
16 15
17
18/** 16/**
19 * <p>Java class for anonymous complex type</p>. 17 * Java class for anonymous complex type.
20 * 18 *
21 * <p>The following schema fragment specifies the expected content contained within this class.</p> 19 * <p>The following schema fragment specifies the expected content contained within this class.
22 * 20 *
23 * <pre>{@code 21 * <pre>{@code
24 * <complexType> 22 * <complexType>
25 * <simpleContent> 23 * <simpleContent>
@@ -36,59 +34,44 @@ import jakarta.xml.bind.annotation.XmlValue;
36 * </simpleContent> 34 * </simpleContent>
37 * </complexType> 35 * </complexType>
38 * }</pre> 36 * }</pre>
39 *
40 *
41 */ 37 */
42@XmlAccessorType(XmlAccessType.FIELD) 38@XmlAccessorType(XmlAccessType.FIELD)
43@XmlType(name = "", propOrder = { 39@XmlType(
44 "value" 40 name = "",
45}) 41 propOrder = {"value"})
46@XmlRootElement(name = "comision") 42@XmlRootElement(name = "comision")
47public class Comision { 43public class Comision {
48 44
49 @XmlValue 45 @XmlValue protected int value;
50 protected int value;
51 @XmlAttribute(name = "type", required = true)
52 protected String type;
53 46
54 /** 47 @XmlAttribute(name = "type", required = true)
55 * Gets the value of the value property. 48 protected String type;
56 *
57 */
58 public int getValue() {
59 return value;
60 }
61 49
62 /** 50 /** Gets the value of the value property. */
63 * Sets the value of the value property. 51 public int getValue() {
64 * 52 return value;
65 */ 53 }
66 public void setValue(int value) {
67 this.value = value;
68 }
69 54
70 /** 55 /** Sets the value of the value property. */
71 * Gets the value of the type property. 56 public void setValue(int value) {
72 * 57 this.value = value;
73 * @return 58 }
74 * possible object is
75 * {@link String }
76 *
77 */
78 public String getType() {
79 return type;
80 }
81 59
82 /** 60 /**
83 * Sets the value of the type property. 61 * Gets the value of the type property.
84 * 62 *
85 * @param value 63 * @return possible object is {@link String }
86 * allowed object is 64 */
87 * {@link String } 65 public String getType() {
88 * 66 return type;
89 */ 67 }
90 public void setType(String value) {
91 this.type = value;
92 }
93 68
69 /**
70 * Sets the value of the type property.
71 *
72 * @param value allowed object is {@link String }
73 */
74 public void setType(String value) {
75 this.type = value;
76 }
94} 77}
diff --git a/service/src/main/java/market/guess/service/catalog/model/v1/GMEvent.java b/service/src/main/java/market/guess/service/catalog/model/v1/GMEvent.java
new file mode 100644
index 0000000..0b829c5
--- /dev/null
+++ b/service/src/main/java/market/guess/service/catalog/model/v1/GMEvent.java
@@ -0,0 +1,173 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7package market.guess.service.catalog.model.v1;
8
9import jakarta.xml.bind.annotation.XmlAccessType;
10import jakarta.xml.bind.annotation.XmlAccessorType;
11import jakarta.xml.bind.annotation.XmlAttribute;
12import jakarta.xml.bind.annotation.XmlElement;
13import jakarta.xml.bind.annotation.XmlRootElement;
14import jakarta.xml.bind.annotation.XmlType;
15import java.util.ArrayList;
16import java.util.List;
17
18/**
19 * Java class for anonymous complex type.
20 *
21 * <p>The following schema fragment specifies the expected content contained within this class.
22 *
23 * <pre>{@code
24 * <complexType>
25 * <complexContent>
26 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
27 * <sequence>
28 * <element ref="{}id"/>
29 * <element ref="{}description"/>
30 * <element ref="{}comision"/>
31 * <element ref="{}GM-options"/>
32 * <element ref="{}GM-method"/>
33 * </sequence>
34 * <attribute name="name" use="required">
35 * <simpleType>
36 * <list itemType="{http://www.w3.org/2001/XMLSchema}string" />
37 * </simpleType>
38 * </attribute>
39 * </restriction>
40 * </complexContent>
41 * </complexType>
42 * }</pre>
43 */
44@XmlAccessorType(XmlAccessType.FIELD)
45@XmlType(
46 name = "",
47 propOrder = {"id", "description", "comision", "gmOptions", "gmMethod"})
48@XmlRootElement(name = "GM-event")
49public class GMEvent {
50
51 protected int id;
52
53 @XmlElement(required = true)
54 protected String description;
55
56 @XmlElement(required = true)
57 protected Comision comision;
58
59 @XmlElement(name = "GM-options", required = true)
60 protected GMOptions gmOptions;
61
62 @XmlElement(name = "GM-method", required = true)
63 protected GMMethod gmMethod;
64
65 @XmlAttribute(name = "name", required = true)
66 protected List<String> name;
67
68 /** Gets the value of the id property. */
69 public int getId() {
70 return id;
71 }
72
73 /** Sets the value of the id property. */
74 public void setId(int value) {
75 this.id = value;
76 }
77
78 /**
79 * Gets the value of the description property.
80 *
81 * @return possible object is {@link String }
82 */
83 public String getDescription() {
84 return description;
85 }
86
87 /**
88 * Sets the value of the description property.
89 *
90 * @param value allowed object is {@link String }
91 */
92 public void setDescription(String value) {
93 this.description = value;
94 }
95
96 /**
97 * Gets the value of the comision property.
98 *
99 * @return possible object is {@link Comision }
100 */
101 public Comision getComision() {
102 return comision;
103 }
104
105 /**
106 * Sets the value of the comision property.
107 *
108 * @param value allowed object is {@link Comision }
109 */
110 public void setComision(Comision value) {
111 this.comision = value;
112 }
113
114 /**
115 * Gets the value of the gmOptions property.
116 *
117 * @return possible object is {@link GMOptions }
118 */
119 public GMOptions getGMOptions() {
120 return gmOptions;
121 }
122
123 /**
124 * Sets the value of the gmOptions property.
125 *
126 * @param value allowed object is {@link GMOptions }
127 */
128 public void setGMOptions(GMOptions value) {
129 this.gmOptions = value;
130 }
131
132 /**
133 * Gets the value of the gmMethod property.
134 *
135 * @return possible object is {@link GMMethod }
136 */
137 public GMMethod getGMMethod() {
138 return gmMethod;
139 }
140
141 /**
142 * Sets the value of the gmMethod property.
143 *
144 * @param value allowed object is {@link GMMethod }
145 */
146 public void setGMMethod(GMMethod value) {
147 this.gmMethod = value;
148 }
149
150 /**
151 * Gets the value of the name property.
152 *
153 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any
154 * modification you make to the returned list will be present inside the JAXB object. This is why
155 * there is not a <CODE>set</CODE> method for the name property.
156 *
157 * <p>For example, to add a new item, do as follows:
158 *
159 * <pre>
160 * getName().add(newItem);
161 * </pre>
162 *
163 * <p>Objects of the following type(s) are allowed in the list {@link String }
164 *
165 * @return The value of the name property.
166 */
167 public List<String> getName() {
168 if (name == null) {
169 name = new ArrayList<>();
170 }
171 return this.name;
172 }
173}
diff --git a/service/src/main/java/market/guess/service/catalog/model/v1/GMEvents.java b/service/src/main/java/market/guess/service/catalog/model/v1/GMEvents.java
new file mode 100644
index 0000000..b078edd
--- /dev/null
+++ b/service/src/main/java/market/guess/service/catalog/model/v1/GMEvents.java
@@ -0,0 +1,67 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7package market.guess.service.catalog.model.v1;
8
9import jakarta.xml.bind.annotation.XmlAccessType;
10import jakarta.xml.bind.annotation.XmlAccessorType;
11import jakarta.xml.bind.annotation.XmlElement;
12import jakarta.xml.bind.annotation.XmlRootElement;
13import jakarta.xml.bind.annotation.XmlType;
14import java.util.ArrayList;
15import java.util.List;
16
17/**
18 * Java class for anonymous complex type.
19 *
20 * <p>The following schema fragment specifies the expected content contained within this class.
21 *
22 * <pre>{@code
23 * <complexType>
24 * <complexContent>
25 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
26 * <sequence>
27 * <element ref="{}GM-event" maxOccurs="unbounded"/>
28 * </sequence>
29 * </restriction>
30 * </complexContent>
31 * </complexType>
32 * }</pre>
33 */
34@XmlAccessorType(XmlAccessType.FIELD)
35@XmlType(
36 name = "",
37 propOrder = {"gmEvent"})
38@XmlRootElement(name = "GM-events")
39public class GMEvents {
40
41 @XmlElement(name = "GM-event", required = true)
42 protected List<GMEvent> gmEvent;
43
44 /**
45 * Gets the value of the gmEvent property.
46 *
47 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any
48 * modification you make to the returned list will be present inside the JAXB object. This is why
49 * there is not a <CODE>set</CODE> method for the gmEvent property.
50 *
51 * <p>For example, to add a new item, do as follows:
52 *
53 * <pre>
54 * getGMEvent().add(newItem);
55 * </pre>
56 *
57 * <p>Objects of the following type(s) are allowed in the list {@link GMEvent }
58 *
59 * @return The value of the gmEvent property.
60 */
61 public List<GMEvent> getGMEvent() {
62 if (gmEvent == null) {
63 gmEvent = new ArrayList<>();
64 }
65 return this.gmEvent;
66 }
67}
diff --git a/service/src/main/java/market/guess/service/model/v1/GMLMSR.java b/service/src/main/java/market/guess/service/catalog/model/v1/GMLMSR.java
index a8e90a5..90648e2 100644
--- a/service/src/main/java/market/guess/service/model/v1/GMLMSR.java
+++ b/service/src/main/java/market/guess/service/catalog/model/v1/GMLMSR.java
@@ -1,23 +1,21 @@
1// 1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5 2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri 3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema. 4// Any modifications to this file will be lost upon recompilation of the source schema.
5// 5//
6 6
7 7package market.guess.service.catalog.model.v1;
8package market.guess.service.model.v1;
9 8
10import jakarta.xml.bind.annotation.XmlAccessType; 9import jakarta.xml.bind.annotation.XmlAccessType;
11import jakarta.xml.bind.annotation.XmlAccessorType; 10import jakarta.xml.bind.annotation.XmlAccessorType;
12import jakarta.xml.bind.annotation.XmlRootElement; 11import jakarta.xml.bind.annotation.XmlRootElement;
13import jakarta.xml.bind.annotation.XmlType; 12import jakarta.xml.bind.annotation.XmlType;
14 13
15
16/** 14/**
17 * <p>Java class for anonymous complex type</p>. 15 * Java class for anonymous complex type.
18 * 16 *
19 * <p>The following schema fragment specifies the expected content contained within this class.</p> 17 * <p>The following schema fragment specifies the expected content contained within this class.
20 * 18 *
21 * <pre>{@code 19 * <pre>{@code
22 * <complexType> 20 * <complexType>
23 * <complexContent> 21 * <complexContent>
@@ -29,32 +27,23 @@ import jakarta.xml.bind.annotation.XmlType;
29 * </complexContent> 27 * </complexContent>
30 * </complexType> 28 * </complexType>
31 * }</pre> 29 * }</pre>
32 *
33 *
34 */ 30 */
35@XmlAccessorType(XmlAccessType.FIELD) 31@XmlAccessorType(XmlAccessType.FIELD)
36@XmlType(name = "", propOrder = { 32@XmlType(
37 "b" 33 name = "",
38}) 34 propOrder = {"b"})
39@XmlRootElement(name = "GM-LMSR") 35@XmlRootElement(name = "GM-LMSR")
40public class GMLMSR { 36public class GMLMSR {
41 37
42 protected int b; 38 protected int b;
43
44 /**
45 * Gets the value of the b property.
46 *
47 */
48 public int getB() {
49 return b;
50 }
51 39
52 /** 40 /** Gets the value of the b property. */
53 * Sets the value of the b property. 41 public int getB() {
54 * 42 return b;
55 */ 43 }
56 public void setB(int value) {
57 this.b = value;
58 }
59 44
45 /** Sets the value of the b property. */
46 public void setB(int value) {
47 this.b = value;
48 }
60} 49}
diff --git a/service/src/main/java/market/guess/service/model/v1/GMMethod.java b/service/src/main/java/market/guess/service/catalog/model/v1/GMMethod.java
index 867d932..8b73880 100644
--- a/service/src/main/java/market/guess/service/model/v1/GMMethod.java
+++ b/service/src/main/java/market/guess/service/catalog/model/v1/GMMethod.java
@@ -1,11 +1,10 @@
1// 1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5 2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri 3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema. 4// Any modifications to this file will be lost upon recompilation of the source schema.
5// 5//
6 6
7 7package market.guess.service.catalog.model.v1;
8package market.guess.service.model.v1;
9 8
10import jakarta.xml.bind.annotation.XmlAccessType; 9import jakarta.xml.bind.annotation.XmlAccessType;
11import jakarta.xml.bind.annotation.XmlAccessorType; 10import jakarta.xml.bind.annotation.XmlAccessorType;
@@ -13,12 +12,11 @@ import jakarta.xml.bind.annotation.XmlElement;
13import jakarta.xml.bind.annotation.XmlRootElement; 12import jakarta.xml.bind.annotation.XmlRootElement;
14import jakarta.xml.bind.annotation.XmlType; 13import jakarta.xml.bind.annotation.XmlType;
15 14
16
17/** 15/**
18 * <p>Java class for anonymous complex type</p>. 16 * Java class for anonymous complex type.
19 * 17 *
20 * <p>The following schema fragment specifies the expected content contained within this class.</p> 18 * <p>The following schema fragment specifies the expected content contained within this class.
21 * 19 *
22 * <pre>{@code 20 * <pre>{@code
23 * <complexType> 21 * <complexType>
24 * <complexContent> 22 * <complexContent>
@@ -30,41 +28,32 @@ import jakarta.xml.bind.annotation.XmlType;
30 * </complexContent> 28 * </complexContent>
31 * </complexType> 29 * </complexType>
32 * }</pre> 30 * }</pre>
33 *
34 *
35 */ 31 */
36@XmlAccessorType(XmlAccessType.FIELD) 32@XmlAccessorType(XmlAccessType.FIELD)
37@XmlType(name = "", propOrder = { 33@XmlType(
38 "gmlmsr" 34 name = "",
39}) 35 propOrder = {"gmlmsr"})
40@XmlRootElement(name = "GM-method") 36@XmlRootElement(name = "GM-method")
41public class GMMethod { 37public class GMMethod {
42 38
43 @XmlElement(name = "GM-LMSR", required = true) 39 @XmlElement(name = "GM-LMSR", required = true)
44 protected GMLMSR gmlmsr; 40 protected GMLMSR gmlmsr;
45
46 /**
47 * Gets the value of the gmlmsr property.
48 *
49 * @return
50 * possible object is
51 * {@link GMLMSR }
52 *
53 */
54 public GMLMSR getGMLMSR() {
55 return gmlmsr;
56 }
57 41
58 /** 42 /**
59 * Sets the value of the gmlmsr property. 43 * Gets the value of the gmlmsr property.
60 * 44 *
61 * @param value 45 * @return possible object is {@link GMLMSR }
62 * allowed object is 46 */
63 * {@link GMLMSR } 47 public GMLMSR getGMLMSR() {
64 * 48 return gmlmsr;
65 */ 49 }
66 public void setGMLMSR(GMLMSR value) {
67 this.gmlmsr = value;
68 }
69 50
51 /**
52 * Sets the value of the gmlmsr property.
53 *
54 * @param value allowed object is {@link GMLMSR }
55 */
56 public void setGMLMSR(GMLMSR value) {
57 this.gmlmsr = value;
58 }
70} 59}
diff --git a/service/src/main/java/market/guess/service/catalog/model/v1/GMOptions.java b/service/src/main/java/market/guess/service/catalog/model/v1/GMOptions.java
new file mode 100644
index 0000000..9639d1c
--- /dev/null
+++ b/service/src/main/java/market/guess/service/catalog/model/v1/GMOptions.java
@@ -0,0 +1,67 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7package market.guess.service.catalog.model.v1;
8
9import jakarta.xml.bind.annotation.XmlAccessType;
10import jakarta.xml.bind.annotation.XmlAccessorType;
11import jakarta.xml.bind.annotation.XmlElement;
12import jakarta.xml.bind.annotation.XmlRootElement;
13import jakarta.xml.bind.annotation.XmlType;
14import java.util.ArrayList;
15import java.util.List;
16
17/**
18 * Java class for anonymous complex type.
19 *
20 * <p>The following schema fragment specifies the expected content contained within this class.
21 *
22 * <pre>{@code
23 * <complexType>
24 * <complexContent>
25 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
26 * <sequence>
27 * <element ref="{}GM-option" maxOccurs="2"/>
28 * </sequence>
29 * </restriction>
30 * </complexContent>
31 * </complexType>
32 * }</pre>
33 */
34@XmlAccessorType(XmlAccessType.FIELD)
35@XmlType(
36 name = "",
37 propOrder = {"gmOption"})
38@XmlRootElement(name = "GM-options")
39public class GMOptions {
40
41 @XmlElement(name = "GM-option", required = true)
42 protected List<String> gmOption;
43
44 /**
45 * Gets the value of the gmOption property.
46 *
47 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any
48 * modification you make to the returned list will be present inside the JAXB object. This is why
49 * there is not a <CODE>set</CODE> method for the gmOption property.
50 *
51 * <p>For example, to add a new item, do as follows:
52 *
53 * <pre>
54 * getGMOption().add(newItem);
55 * </pre>
56 *
57 * <p>Objects of the following type(s) are allowed in the list {@link String }
58 *
59 * @return The value of the gmOption property.
60 */
61 public List<String> getGMOption() {
62 if (gmOption == null) {
63 gmOption = new ArrayList<>();
64 }
65 return this.gmOption;
66 }
67}
diff --git a/service/src/main/java/market/guess/service/model/v1/GuessMarket.java b/service/src/main/java/market/guess/service/catalog/model/v1/GuessMarket.java
index 43f134d..e584ac2 100644
--- a/service/src/main/java/market/guess/service/model/v1/GuessMarket.java
+++ b/service/src/main/java/market/guess/service/catalog/model/v1/GuessMarket.java
@@ -1,11 +1,10 @@
1// 1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5 2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri 3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema. 4// Any modifications to this file will be lost upon recompilation of the source schema.
5// 5//
6 6
7 7package market.guess.service.catalog.model.v1;
8package market.guess.service.model.v1;
9 8
10import jakarta.xml.bind.annotation.XmlAccessType; 9import jakarta.xml.bind.annotation.XmlAccessType;
11import jakarta.xml.bind.annotation.XmlAccessorType; 10import jakarta.xml.bind.annotation.XmlAccessorType;
@@ -13,12 +12,11 @@ import jakarta.xml.bind.annotation.XmlElement;
13import jakarta.xml.bind.annotation.XmlRootElement; 12import jakarta.xml.bind.annotation.XmlRootElement;
14import jakarta.xml.bind.annotation.XmlType; 13import jakarta.xml.bind.annotation.XmlType;
15 14
16
17/** 15/**
18 * <p>Java class for anonymous complex type</p>. 16 * Java class for anonymous complex type.
19 * 17 *
20 * <p>The following schema fragment specifies the expected content contained within this class.</p> 18 * <p>The following schema fragment specifies the expected content contained within this class.
21 * 19 *
22 * <pre>{@code 20 * <pre>{@code
23 * <complexType> 21 * <complexType>
24 * <complexContent> 22 * <complexContent>
@@ -30,41 +28,32 @@ import jakarta.xml.bind.annotation.XmlType;
30 * </complexContent> 28 * </complexContent>
31 * </complexType> 29 * </complexType>
32 * }</pre> 30 * }</pre>
33 *
34 *
35 */ 31 */
36@XmlAccessorType(XmlAccessType.FIELD) 32@XmlAccessorType(XmlAccessType.FIELD)
37@XmlType(name = "", propOrder = { 33@XmlType(
38 "gmEvents" 34 name = "",
39}) 35 propOrder = {"gmEvents"})
40@XmlRootElement(name = "Guess-Market") 36@XmlRootElement(name = "Guess-Market")
41public class GuessMarket { 37public class GuessMarket {
42 38
43 @XmlElement(name = "GM-events", required = true) 39 @XmlElement(name = "GM-events", required = true)
44 protected GMEvents gmEvents; 40 protected GMEvents gmEvents;
45
46 /**
47 * Gets the value of the gmEvents property.
48 *
49 * @return
50 * possible object is
51 * {@link GMEvents }
52 *
53 */
54 public GMEvents getGMEvents() {
55 return gmEvents;
56 }
57 41
58 /** 42 /**
59 * Sets the value of the gmEvents property. 43 * Gets the value of the gmEvents property.
60 * 44 *
61 * @param value 45 * @return possible object is {@link GMEvents }
62 * allowed object is 46 */
63 * {@link GMEvents } 47 public GMEvents getGMEvents() {
64 * 48 return gmEvents;
65 */ 49 }
66 public void setGMEvents(GMEvents value) {
67 this.gmEvents = value;
68 }
69 50
51 /**
52 * Sets the value of the gmEvents property.
53 *
54 * @param value allowed object is {@link GMEvents }
55 */
56 public void setGMEvents(GMEvents value) {
57 this.gmEvents = value;
58 }
70} 59}
diff --git a/service/src/main/java/market/guess/service/catalog/model/v1/ObjectFactory.java b/service/src/main/java/market/guess/service/catalog/model/v1/ObjectFactory.java
new file mode 100644
index 0000000..cab68ed
--- /dev/null
+++ b/service/src/main/java/market/guess/service/catalog/model/v1/ObjectFactory.java
@@ -0,0 +1,143 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7package market.guess.service.catalog.model.v1;
8
9import jakarta.xml.bind.JAXBElement;
10import jakarta.xml.bind.annotation.XmlElementDecl;
11import jakarta.xml.bind.annotation.XmlRegistry;
12import javax.xml.namespace.QName;
13
14/**
15 * This object contains factory methods for each Java content interface and Java element interface
16 * generated in the market.guess.service.model.v1 package.
17 *
18 * <p>An ObjectFactory allows you to programmatically construct new instances of the Java
19 * representation for XML content. The Java representation of XML content can consist of schema
20 * derived interfaces and classes representing the binding of schema type definitions, element
21 * declarations and model groups. Factory methods for each of these are provided in this class.
22 */
23@XmlRegistry
24public class ObjectFactory {
25
26 private static final QName _Id_QNAME = new QName("", "id");
27 private static final QName _Description_QNAME = new QName("", "description");
28 private static final QName _B_QNAME = new QName("", "b");
29 private static final QName _GMOption_QNAME = new QName("", "GM-option");
30
31 /**
32 * Create a new ObjectFactory that can be used to create new instances of schema derived classes
33 * for package: market.guess.service.model.v1
34 */
35 public ObjectFactory() {}
36
37 /**
38 * Create an instance of {@link Comision }
39 *
40 * @return the new instance of {@link Comision }
41 */
42 public Comision createComision() {
43 return new Comision();
44 }
45
46 /**
47 * Create an instance of {@link GuessMarket }
48 *
49 * @return the new instance of {@link GuessMarket }
50 */
51 public GuessMarket createGuessMarket() {
52 return new GuessMarket();
53 }
54
55 /**
56 * Create an instance of {@link GMEvents }
57 *
58 * @return the new instance of {@link GMEvents }
59 */
60 public GMEvents createGMEvents() {
61 return new GMEvents();
62 }
63
64 /**
65 * Create an instance of {@link GMEvent }
66 *
67 * @return the new instance of {@link GMEvent }
68 */
69 public GMEvent createGMEvent() {
70 return new GMEvent();
71 }
72
73 /**
74 * Create an instance of {@link GMOptions }
75 *
76 * @return the new instance of {@link GMOptions }
77 */
78 public GMOptions createGMOptions() {
79 return new GMOptions();
80 }
81
82 /**
83 * Create an instance of {@link GMMethod }
84 *
85 * @return the new instance of {@link GMMethod }
86 */
87 public GMMethod createGMMethod() {
88 return new GMMethod();
89 }
90
91 /**
92 * Create an instance of {@link GMLMSR }
93 *
94 * @return the new instance of {@link GMLMSR }
95 */
96 public GMLMSR createGMLMSR() {
97 return new GMLMSR();
98 }
99
100 /**
101 * Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
102 *
103 * @param value Java instance representing xml element's value.
104 * @return the new instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
105 */
106 @XmlElementDecl(namespace = "", name = "id")
107 public JAXBElement<Integer> createId(Integer value) {
108 return new JAXBElement<>(_Id_QNAME, Integer.class, null, value);
109 }
110
111 /**
112 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
113 *
114 * @param value Java instance representing xml element's value.
115 * @return the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
116 */
117 @XmlElementDecl(namespace = "", name = "description")
118 public JAXBElement<String> createDescription(String value) {
119 return new JAXBElement<>(_Description_QNAME, String.class, null, value);
120 }
121
122 /**
123 * Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
124 *
125 * @param value Java instance representing xml element's value.
126 * @return the new instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
127 */
128 @XmlElementDecl(namespace = "", name = "b")
129 public JAXBElement<Integer> createB(Integer value) {
130 return new JAXBElement<>(_B_QNAME, Integer.class, null, value);
131 }
132
133 /**
134 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
135 *
136 * @param value Java instance representing xml element's value.
137 * @return the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
138 */
139 @XmlElementDecl(namespace = "", name = "GM-option")
140 public JAXBElement<String> createGMOption(String value) {
141 return new JAXBElement<>(_GMOption_QNAME, String.class, null, value);
142 }
143}
diff --git a/service/src/main/java/market/guess/service/model/v2/Commission.java b/service/src/main/java/market/guess/service/catalog/model/v2/Commission.java
index 5448ff0..b46807e 100644
--- a/service/src/main/java/market/guess/service/model/v2/Commission.java
+++ b/service/src/main/java/market/guess/service/catalog/model/v2/Commission.java
@@ -1,11 +1,10 @@
1// 1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5 2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri 3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema. 4// Any modifications to this file will be lost upon recompilation of the source schema.
5// 5//
6 6
7 7package market.guess.service.catalog.model.v2;
8package market.guess.service.model.v2;
9 8
10import jakarta.xml.bind.annotation.XmlAccessType; 9import jakarta.xml.bind.annotation.XmlAccessType;
11import jakarta.xml.bind.annotation.XmlAccessorType; 10import jakarta.xml.bind.annotation.XmlAccessorType;
@@ -14,12 +13,11 @@ import jakarta.xml.bind.annotation.XmlRootElement;
14import jakarta.xml.bind.annotation.XmlType; 13import jakarta.xml.bind.annotation.XmlType;
15import jakarta.xml.bind.annotation.XmlValue; 14import jakarta.xml.bind.annotation.XmlValue;
16 15
17
18/** 16/**
19 * <p>Java class for anonymous complex type</p>. 17 * Java class for anonymous complex type.
20 * 18 *
21 * <p>The following schema fragment specifies the expected content contained within this class.</p> 19 * <p>The following schema fragment specifies the expected content contained within this class.
22 * 20 *
23 * <pre>{@code 21 * <pre>{@code
24 * <complexType> 22 * <complexType>
25 * <simpleContent> 23 * <simpleContent>
@@ -36,59 +34,44 @@ import jakarta.xml.bind.annotation.XmlValue;
36 * </simpleContent> 34 * </simpleContent>
37 * </complexType> 35 * </complexType>
38 * }</pre> 36 * }</pre>
39 *
40 *
41 */ 37 */
42@XmlAccessorType(XmlAccessType.FIELD) 38@XmlAccessorType(XmlAccessType.FIELD)
43@XmlType(name = "", propOrder = { 39@XmlType(
44 "value" 40 name = "",
45}) 41 propOrder = {"value"})
46@XmlRootElement(name = "commission") 42@XmlRootElement(name = "commission")
47public class Commission { 43public class Commission {
48 44
49 @XmlValue 45 @XmlValue protected int value;
50 protected int value;
51 @XmlAttribute(name = "type", required = true)
52 protected String type;
53 46
54 /** 47 @XmlAttribute(name = "type", required = true)
55 * Gets the value of the value property. 48 protected String type;
56 *
57 */
58 public int getValue() {
59 return value;
60 }
61 49
62 /** 50 /** Gets the value of the value property. */
63 * Sets the value of the value property. 51 public int getValue() {
64 * 52 return value;
65 */ 53 }
66 public void setValue(int value) {
67 this.value = value;
68 }
69 54
70 /** 55 /** Sets the value of the value property. */
71 * Gets the value of the type property. 56 public void setValue(int value) {
72 * 57 this.value = value;
73 * @return 58 }
74 * possible object is
75 * {@link String }
76 *
77 */
78 public String getType() {
79 return type;
80 }
81 59
82 /** 60 /**
83 * Sets the value of the type property. 61 * Gets the value of the type property.
84 * 62 *
85 * @param value 63 * @return possible object is {@link String }
86 * allowed object is 64 */
87 * {@link String } 65 public String getType() {
88 * 66 return type;
89 */ 67 }
90 public void setType(String value) {
91 this.type = value;
92 }
93 68
69 /**
70 * Sets the value of the type property.
71 *
72 * @param value allowed object is {@link String }
73 */
74 public void setType(String value) {
75 this.type = value;
76 }
94} 77}
diff --git a/service/src/main/java/market/guess/service/model/v2/Event.java b/service/src/main/java/market/guess/service/catalog/model/v2/Event.java
index 53ca4ca..afd7a32 100644
--- a/service/src/main/java/market/guess/service/model/v2/Event.java
+++ b/service/src/main/java/market/guess/service/catalog/model/v2/Event.java
@@ -1,11 +1,10 @@
1// 1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5 2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri 3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema. 4// Any modifications to this file will be lost upon recompilation of the source schema.
5// 5//
6 6
7 7package market.guess.service.catalog.model.v2;
8package market.guess.service.model.v2;
9 8
10import jakarta.xml.bind.annotation.XmlAccessType; 9import jakarta.xml.bind.annotation.XmlAccessType;
11import jakarta.xml.bind.annotation.XmlAccessorType; 10import jakarta.xml.bind.annotation.XmlAccessorType;
@@ -13,12 +12,11 @@ import jakarta.xml.bind.annotation.XmlAttribute;
13import jakarta.xml.bind.annotation.XmlRootElement; 12import jakarta.xml.bind.annotation.XmlRootElement;
14import jakarta.xml.bind.annotation.XmlType; 13import jakarta.xml.bind.annotation.XmlType;
15 14
16
17/** 15/**
18 * <p>Java class for anonymous complex type</p>. 16 * Java class for anonymous complex type.
19 * 17 *
20 * <p>The following schema fragment specifies the expected content contained within this class.</p> 18 * <p>The following schema fragment specifies the expected content contained within this class.
21 * 19 *
22 * <pre>{@code 20 * <pre>{@code
23 * <complexType> 21 * <complexType>
24 * <complexContent> 22 * <complexContent>
@@ -28,31 +26,22 @@ import jakarta.xml.bind.annotation.XmlType;
28 * </complexContent> 26 * </complexContent>
29 * </complexType> 27 * </complexType>
30 * }</pre> 28 * }</pre>
31 *
32 *
33 */ 29 */
34@XmlAccessorType(XmlAccessType.FIELD) 30@XmlAccessorType(XmlAccessType.FIELD)
35@XmlType(name = "") 31@XmlType(name = "")
36@XmlRootElement(name = "event") 32@XmlRootElement(name = "event")
37public class Event { 33public class Event {
38 34
39 @XmlAttribute(name = "id", required = true) 35 @XmlAttribute(name = "id", required = true)
40 protected int id; 36 protected int id;
41
42 /**
43 * Gets the value of the id property.
44 *
45 */
46 public int getId() {
47 return id;
48 }
49 37
50 /** 38 /** Gets the value of the id property. */
51 * Sets the value of the id property. 39 public int getId() {
52 * 40 return id;
53 */ 41 }
54 public void setId(int value) {
55 this.id = value;
56 }
57 42
43 /** Sets the value of the id property. */
44 public void setId(int value) {
45 this.id = value;
46 }
58} 47}
diff --git a/service/src/main/java/market/guess/service/catalog/model/v2/GMEvent.java b/service/src/main/java/market/guess/service/catalog/model/v2/GMEvent.java
new file mode 100644
index 0000000..3ce6192
--- /dev/null
+++ b/service/src/main/java/market/guess/service/catalog/model/v2/GMEvent.java
@@ -0,0 +1,161 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7package market.guess.service.catalog.model.v2;
8
9import jakarta.xml.bind.annotation.XmlAccessType;
10import jakarta.xml.bind.annotation.XmlAccessorType;
11import jakarta.xml.bind.annotation.XmlAttribute;
12import jakarta.xml.bind.annotation.XmlElement;
13import jakarta.xml.bind.annotation.XmlRootElement;
14import jakarta.xml.bind.annotation.XmlType;
15
16/**
17 * Java class for anonymous complex type.
18 *
19 * <p>The following schema fragment specifies the expected content contained within this class.
20 *
21 * <pre>{@code
22 * <complexType>
23 * <complexContent>
24 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
25 * <sequence>
26 * <element ref="{}id"/>
27 * <element ref="{}description"/>
28 * <element ref="{}commission"/>
29 * <element ref="{}GM-options"/>
30 * <element ref="{}GM-method"/>
31 * </sequence>
32 * <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
33 * </restriction>
34 * </complexContent>
35 * </complexType>
36 * }</pre>
37 */
38@XmlAccessorType(XmlAccessType.FIELD)
39@XmlType(
40 name = "",
41 propOrder = {"id", "description", "commission", "gmOptions", "gmMethod"})
42@XmlRootElement(name = "GM-event")
43public class GMEvent {
44
45 protected int id;
46
47 @XmlElement(required = true)
48 protected String description;
49
50 @XmlElement(required = true)
51 protected Commission commission;
52
53 @XmlElement(name = "GM-options", required = true)
54 protected GMOptions gmOptions;
55
56 @XmlElement(name = "GM-method", required = true)
57 protected GMMethod gmMethod;
58
59 @XmlAttribute(name = "name", required = true)
60 protected String name;
61
62 /** Gets the value of the id property. */
63 public int getId() {
64 return id;
65 }
66
67 /** Sets the value of the id property. */
68 public void setId(int value) {
69 this.id = value;
70 }
71
72 /**
73 * Gets the value of the description property.
74 *
75 * @return possible object is {@link String }
76 */
77 public String getDescription() {
78 return description;
79 }
80
81 /**
82 * Sets the value of the description property.
83 *
84 * @param value allowed object is {@link String }
85 */
86 public void setDescription(String value) {
87 this.description = value;
88 }
89
90 /**
91 * Gets the value of the commission property.
92 *
93 * @return possible object is {@link Commission }
94 */
95 public Commission getCommission() {
96 return commission;
97 }
98
99 /**
100 * Sets the value of the commission property.
101 *
102 * @param value allowed object is {@link Commission }
103 */
104 public void setCommission(Commission value) {
105 this.commission = value;
106 }
107
108 /**
109 * Gets the value of the gmOptions property.
110 *
111 * @return possible object is {@link GMOptions }
112 */
113 public GMOptions getGMOptions() {
114 return gmOptions;
115 }
116
117 /**
118 * Sets the value of the gmOptions property.
119 *
120 * @param value allowed object is {@link GMOptions }
121 */
122 public void setGMOptions(GMOptions value) {
123 this.gmOptions = value;
124 }
125
126 /**
127 * Gets the value of the gmMethod property.
128 *
129 * @return possible object is {@link GMMethod }
130 */
131 public GMMethod getGMMethod() {
132 return gmMethod;
133 }
134
135 /**
136 * Sets the value of the gmMethod property.
137 *
138 * @param value allowed object is {@link GMMethod }
139 */
140 public void setGMMethod(GMMethod value) {
141 this.gmMethod = value;
142 }
143
144 /**
145 * Gets the value of the name property.
146 *
147 * @return possible object is {@link String }
148 */
149 public String getName() {
150 return name;
151 }
152
153 /**
154 * Sets the value of the name property.
155 *
156 * @param value allowed object is {@link String }
157 */
158 public void setName(String value) {
159 this.name = value;
160 }
161}
diff --git a/service/src/main/java/market/guess/service/catalog/model/v2/GMEvents.java b/service/src/main/java/market/guess/service/catalog/model/v2/GMEvents.java
new file mode 100644
index 0000000..365161e
--- /dev/null
+++ b/service/src/main/java/market/guess/service/catalog/model/v2/GMEvents.java
@@ -0,0 +1,67 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7package market.guess.service.catalog.model.v2;
8
9import jakarta.xml.bind.annotation.XmlAccessType;
10import jakarta.xml.bind.annotation.XmlAccessorType;
11import jakarta.xml.bind.annotation.XmlElement;
12import jakarta.xml.bind.annotation.XmlRootElement;
13import jakarta.xml.bind.annotation.XmlType;
14import java.util.ArrayList;
15import java.util.List;
16
17/**
18 * Java class for anonymous complex type.
19 *
20 * <p>The following schema fragment specifies the expected content contained within this class.
21 *
22 * <pre>{@code
23 * <complexType>
24 * <complexContent>
25 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
26 * <sequence>
27 * <element ref="{}GM-event" maxOccurs="unbounded"/>
28 * </sequence>
29 * </restriction>
30 * </complexContent>
31 * </complexType>
32 * }</pre>
33 */
34@XmlAccessorType(XmlAccessType.FIELD)
35@XmlType(
36 name = "",
37 propOrder = {"gmEvent"})
38@XmlRootElement(name = "GM-events")
39public class GMEvents {
40
41 @XmlElement(name = "GM-event", required = true)
42 protected List<GMEvent> gmEvent;
43
44 /**
45 * Gets the value of the gmEvent property.
46 *
47 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any
48 * modification you make to the returned list will be present inside the JAXB object. This is why
49 * there is not a <CODE>set</CODE> method for the gmEvent property.
50 *
51 * <p>For example, to add a new item, do as follows:
52 *
53 * <pre>
54 * getGMEvent().add(newItem);
55 * </pre>
56 *
57 * <p>Objects of the following type(s) are allowed in the list {@link GMEvent }
58 *
59 * @return The value of the gmEvent property.
60 */
61 public List<GMEvent> getGMEvent() {
62 if (gmEvent == null) {
63 gmEvent = new ArrayList<>();
64 }
65 return this.gmEvent;
66 }
67}
diff --git a/service/src/main/java/market/guess/service/model/v2/GMLMSR.java b/service/src/main/java/market/guess/service/catalog/model/v2/GMLMSR.java
index b299a19..aabd77a 100644
--- a/service/src/main/java/market/guess/service/model/v2/GMLMSR.java
+++ b/service/src/main/java/market/guess/service/catalog/model/v2/GMLMSR.java
@@ -1,23 +1,21 @@
1// 1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5 2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri 3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema. 4// Any modifications to this file will be lost upon recompilation of the source schema.
5// 5//
6 6
7 7package market.guess.service.catalog.model.v2;
8package market.guess.service.model.v2;
9 8
10import jakarta.xml.bind.annotation.XmlAccessType; 9import jakarta.xml.bind.annotation.XmlAccessType;
11import jakarta.xml.bind.annotation.XmlAccessorType; 10import jakarta.xml.bind.annotation.XmlAccessorType;
12import jakarta.xml.bind.annotation.XmlRootElement; 11import jakarta.xml.bind.annotation.XmlRootElement;
13import jakarta.xml.bind.annotation.XmlType; 12import jakarta.xml.bind.annotation.XmlType;
14 13
15
16/** 14/**
17 * <p>Java class for anonymous complex type</p>. 15 * Java class for anonymous complex type.
18 * 16 *
19 * <p>The following schema fragment specifies the expected content contained within this class.</p> 17 * <p>The following schema fragment specifies the expected content contained within this class.
20 * 18 *
21 * <pre>{@code 19 * <pre>{@code
22 * <complexType> 20 * <complexType>
23 * <complexContent> 21 * <complexContent>
@@ -29,32 +27,23 @@ import jakarta.xml.bind.annotation.XmlType;
29 * </complexContent> 27 * </complexContent>
30 * </complexType> 28 * </complexType>
31 * }</pre> 29 * }</pre>
32 *
33 *
34 */ 30 */
35@XmlAccessorType(XmlAccessType.FIELD) 31@XmlAccessorType(XmlAccessType.FIELD)
36@XmlType(name = "", propOrder = { 32@XmlType(
37 "b" 33 name = "",
38}) 34 propOrder = {"b"})
39@XmlRootElement(name = "GM-LMSR") 35@XmlRootElement(name = "GM-LMSR")
40public class GMLMSR { 36public class GMLMSR {
41 37
42 protected int b; 38 protected int b;
43
44 /**
45 * Gets the value of the b property.
46 *
47 */
48 public int getB() {
49 return b;
50 }
51 39
52 /** 40 /** Gets the value of the b property. */
53 * Sets the value of the b property. 41 public int getB() {
54 * 42 return b;
55 */ 43 }
56 public void setB(int value) {
57 this.b = value;
58 }
59 44
45 /** Sets the value of the b property. */
46 public void setB(int value) {
47 this.b = value;
48 }
60} 49}
diff --git a/service/src/main/java/market/guess/service/catalog/model/v2/GMMarketMaker.java b/service/src/main/java/market/guess/service/catalog/model/v2/GMMarketMaker.java
new file mode 100644
index 0000000..886f3f0
--- /dev/null
+++ b/service/src/main/java/market/guess/service/catalog/model/v2/GMMarketMaker.java
@@ -0,0 +1,67 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7package market.guess.service.catalog.model.v2;
8
9import jakarta.xml.bind.annotation.XmlAccessType;
10import jakarta.xml.bind.annotation.XmlAccessorType;
11import jakarta.xml.bind.annotation.XmlElement;
12import jakarta.xml.bind.annotation.XmlRootElement;
13import jakarta.xml.bind.annotation.XmlType;
14import java.util.ArrayList;
15import java.util.List;
16
17/**
18 * Java class for anonymous complex type.
19 *
20 * <p>The following schema fragment specifies the expected content contained within this class.
21 *
22 * <pre>{@code
23 * <complexType>
24 * <complexContent>
25 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
26 * <sequence>
27 * <element ref="{}event" maxOccurs="unbounded"/>
28 * </sequence>
29 * </restriction>
30 * </complexContent>
31 * </complexType>
32 * }</pre>
33 */
34@XmlAccessorType(XmlAccessType.FIELD)
35@XmlType(
36 name = "",
37 propOrder = {"event"})
38@XmlRootElement(name = "GM-market-maker")
39public class GMMarketMaker {
40
41 @XmlElement(required = true)
42 protected List<Event> event;
43
44 /**
45 * Gets the value of the event property.
46 *
47 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any
48 * modification you make to the returned list will be present inside the JAXB object. This is why
49 * there is not a <CODE>set</CODE> method for the event property.
50 *
51 * <p>For example, to add a new item, do as follows:
52 *
53 * <pre>
54 * getEvent().add(newItem);
55 * </pre>
56 *
57 * <p>Objects of the following type(s) are allowed in the list {@link Event }
58 *
59 * @return The value of the event property.
60 */
61 public List<Event> getEvent() {
62 if (event == null) {
63 event = new ArrayList<>();
64 }
65 return this.event;
66 }
67}
diff --git a/service/src/main/java/market/guess/service/catalog/model/v2/GMMethod.java b/service/src/main/java/market/guess/service/catalog/model/v2/GMMethod.java
new file mode 100644
index 0000000..c9a4489
--- /dev/null
+++ b/service/src/main/java/market/guess/service/catalog/model/v2/GMMethod.java
@@ -0,0 +1,81 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7package market.guess.service.catalog.model.v2;
8
9import jakarta.xml.bind.annotation.XmlAccessType;
10import jakarta.xml.bind.annotation.XmlAccessorType;
11import jakarta.xml.bind.annotation.XmlElement;
12import jakarta.xml.bind.annotation.XmlRootElement;
13import jakarta.xml.bind.annotation.XmlType;
14
15/**
16 * Java class for anonymous complex type.
17 *
18 * <p>The following schema fragment specifies the expected content contained within this class.
19 *
20 * <pre>{@code
21 * <complexType>
22 * <complexContent>
23 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
24 * <choice>
25 * <element ref="{}GM-LMSR"/>
26 * <element ref="{}GM-order-book"/>
27 * </choice>
28 * </restriction>
29 * </complexContent>
30 * </complexType>
31 * }</pre>
32 */
33@XmlAccessorType(XmlAccessType.FIELD)
34@XmlType(
35 name = "",
36 propOrder = {"gmlmsr", "gmOrderBook"})
37@XmlRootElement(name = "GM-method")
38public class GMMethod {
39
40 @XmlElement(name = "GM-LMSR")
41 protected GMLMSR gmlmsr;
42
43 @XmlElement(name = "GM-order-book")
44 protected GMOrderBook gmOrderBook;
45
46 /**
47 * Gets the value of the gmlmsr property.
48 *
49 * @return possible object is {@link GMLMSR }
50 */
51 public GMLMSR getGMLMSR() {
52 return gmlmsr;
53 }
54
55 /**
56 * Sets the value of the gmlmsr property.
57 *
58 * @param value allowed object is {@link GMLMSR }
59 */
60 public void setGMLMSR(GMLMSR value) {
61 this.gmlmsr = value;
62 }
63
64 /**
65 * Gets the value of the gmOrderBook property.
66 *
67 * @return possible object is {@link GMOrderBook }
68 */
69 public GMOrderBook getGMOrderBook() {
70 return gmOrderBook;
71 }
72
73 /**
74 * Sets the value of the gmOrderBook property.
75 *
76 * @param value allowed object is {@link GMOrderBook }
77 */
78 public void setGMOrderBook(GMOrderBook value) {
79 this.gmOrderBook = value;
80 }
81}
diff --git a/service/src/main/java/market/guess/service/catalog/model/v2/GMOptions.java b/service/src/main/java/market/guess/service/catalog/model/v2/GMOptions.java
new file mode 100644
index 0000000..ca0bbb2
--- /dev/null
+++ b/service/src/main/java/market/guess/service/catalog/model/v2/GMOptions.java
@@ -0,0 +1,67 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7package market.guess.service.catalog.model.v2;
8
9import jakarta.xml.bind.annotation.XmlAccessType;
10import jakarta.xml.bind.annotation.XmlAccessorType;
11import jakarta.xml.bind.annotation.XmlElement;
12import jakarta.xml.bind.annotation.XmlRootElement;
13import jakarta.xml.bind.annotation.XmlType;
14import java.util.ArrayList;
15import java.util.List;
16
17/**
18 * Java class for anonymous complex type.
19 *
20 * <p>The following schema fragment specifies the expected content contained within this class.
21 *
22 * <pre>{@code
23 * <complexType>
24 * <complexContent>
25 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
26 * <sequence>
27 * <element ref="{}GM-option" maxOccurs="2"/>
28 * </sequence>
29 * </restriction>
30 * </complexContent>
31 * </complexType>
32 * }</pre>
33 */
34@XmlAccessorType(XmlAccessType.FIELD)
35@XmlType(
36 name = "",
37 propOrder = {"gmOption"})
38@XmlRootElement(name = "GM-options")
39public class GMOptions {
40
41 @XmlElement(name = "GM-option", required = true)
42 protected List<String> gmOption;
43
44 /**
45 * Gets the value of the gmOption property.
46 *
47 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any
48 * modification you make to the returned list will be present inside the JAXB object. This is why
49 * there is not a <CODE>set</CODE> method for the gmOption property.
50 *
51 * <p>For example, to add a new item, do as follows:
52 *
53 * <pre>
54 * getGMOption().add(newItem);
55 * </pre>
56 *
57 * <p>Objects of the following type(s) are allowed in the list {@link String }
58 *
59 * @return The value of the gmOption property.
60 */
61 public List<String> getGMOption() {
62 if (gmOption == null) {
63 gmOption = new ArrayList<>();
64 }
65 return this.gmOption;
66 }
67}
diff --git a/service/src/main/java/market/guess/service/catalog/model/v2/GMOrderBook.java b/service/src/main/java/market/guess/service/catalog/model/v2/GMOrderBook.java
new file mode 100644
index 0000000..9d3836f
--- /dev/null
+++ b/service/src/main/java/market/guess/service/catalog/model/v2/GMOrderBook.java
@@ -0,0 +1,90 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7package market.guess.service.catalog.model.v2;
8
9import jakarta.xml.bind.annotation.XmlAccessType;
10import jakarta.xml.bind.annotation.XmlAccessorType;
11import jakarta.xml.bind.annotation.XmlAttribute;
12import jakarta.xml.bind.annotation.XmlRootElement;
13import jakarta.xml.bind.annotation.XmlType;
14
15/**
16 * Java class for anonymous complex type.
17 *
18 * <p>The following schema fragment specifies the expected content contained within this class.
19 *
20 * <pre>{@code
21 * <complexType>
22 * <complexContent>
23 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
24 * <attribute name="initial" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
25 * <attribute name="d" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
26 * <attribute name="allow-mint" use="required">
27 * <simpleType>
28 * <restriction base="{http://www.w3.org/2001/XMLSchema}string">
29 * <enumeration value="false"/>
30 * <enumeration value="true"/>
31 * </restriction>
32 * </simpleType>
33 * </attribute>
34 * </restriction>
35 * </complexContent>
36 * </complexType>
37 * }</pre>
38 */
39@XmlAccessorType(XmlAccessType.FIELD)
40@XmlType(name = "")
41@XmlRootElement(name = "GM-order-book")
42public class GMOrderBook {
43
44 @XmlAttribute(name = "initial", required = true)
45 protected int initial;
46
47 @XmlAttribute(name = "d", required = true)
48 protected int d;
49
50 @XmlAttribute(name = "allow-mint", required = true)
51 protected String allowMint;
52
53 /** Gets the value of the initial property. */
54 public int getInitial() {
55 return initial;
56 }
57
58 /** Sets the value of the initial property. */
59 public void setInitial(int value) {
60 this.initial = value;
61 }
62
63 /** Gets the value of the d property. */
64 public int getD() {
65 return d;
66 }
67
68 /** Sets the value of the d property. */
69 public void setD(int value) {
70 this.d = value;
71 }
72
73 /**
74 * Gets the value of the allowMint property.
75 *
76 * @return possible object is {@link String }
77 */
78 public String getAllowMint() {
79 return allowMint;
80 }
81
82 /**
83 * Sets the value of the allowMint property.
84 *
85 * @param value allowed object is {@link String }
86 */
87 public void setAllowMint(String value) {
88 this.allowMint = value;
89 }
90}
diff --git a/service/src/main/java/market/guess/service/catalog/model/v2/GMUser.java b/service/src/main/java/market/guess/service/catalog/model/v2/GMUser.java
new file mode 100644
index 0000000..bc6e5d9
--- /dev/null
+++ b/service/src/main/java/market/guess/service/catalog/model/v2/GMUser.java
@@ -0,0 +1,96 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7package market.guess.service.catalog.model.v2;
8
9import jakarta.xml.bind.annotation.XmlAccessType;
10import jakarta.xml.bind.annotation.XmlAccessorType;
11import jakarta.xml.bind.annotation.XmlAttribute;
12import jakarta.xml.bind.annotation.XmlElement;
13import jakarta.xml.bind.annotation.XmlRootElement;
14import jakarta.xml.bind.annotation.XmlType;
15
16/**
17 * Java class for anonymous complex type.
18 *
19 * <p>The following schema fragment specifies the expected content contained within this class.
20 *
21 * <pre>{@code
22 * <complexType>
23 * <complexContent>
24 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
25 * <sequence>
26 * <element ref="{}initial-cash"/>
27 * <element ref="{}GM-market-maker" minOccurs="0"/>
28 * </sequence>
29 * <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
30 * </restriction>
31 * </complexContent>
32 * </complexType>
33 * }</pre>
34 */
35@XmlAccessorType(XmlAccessType.FIELD)
36@XmlType(
37 name = "",
38 propOrder = {"initialCash", "gmMarketMaker"})
39@XmlRootElement(name = "GM-user")
40public class GMUser {
41
42 @XmlElement(name = "initial-cash")
43 protected int initialCash;
44
45 @XmlElement(name = "GM-market-maker")
46 protected GMMarketMaker gmMarketMaker;
47
48 @XmlAttribute(name = "name", required = true)
49 protected String name;
50
51 /** Gets the value of the initialCash property. */
52 public int getInitialCash() {
53 return initialCash;
54 }
55
56 /** Sets the value of the initialCash property. */
57 public void setInitialCash(int value) {
58 this.initialCash = value;
59 }
60
61 /**
62 * Gets the value of the gmMarketMaker property.
63 *
64 * @return possible object is {@link GMMarketMaker }
65 */
66 public GMMarketMaker getGMMarketMaker() {
67 return gmMarketMaker;
68 }
69
70 /**
71 * Sets the value of the gmMarketMaker property.
72 *
73 * @param value allowed object is {@link GMMarketMaker }
74 */
75 public void setGMMarketMaker(GMMarketMaker value) {
76 this.gmMarketMaker = value;
77 }
78
79 /**
80 * Gets the value of the name property.
81 *
82 * @return possible object is {@link String }
83 */
84 public String getName() {
85 return name;
86 }
87
88 /**
89 * Sets the value of the name property.
90 *
91 * @param value allowed object is {@link String }
92 */
93 public void setName(String value) {
94 this.name = value;
95 }
96}
diff --git a/service/src/main/java/market/guess/service/catalog/model/v2/GMUsers.java b/service/src/main/java/market/guess/service/catalog/model/v2/GMUsers.java
new file mode 100644
index 0000000..cc6c81d
--- /dev/null
+++ b/service/src/main/java/market/guess/service/catalog/model/v2/GMUsers.java
@@ -0,0 +1,67 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7package market.guess.service.catalog.model.v2;
8
9import jakarta.xml.bind.annotation.XmlAccessType;
10import jakarta.xml.bind.annotation.XmlAccessorType;
11import jakarta.xml.bind.annotation.XmlElement;
12import jakarta.xml.bind.annotation.XmlRootElement;
13import jakarta.xml.bind.annotation.XmlType;
14import java.util.ArrayList;
15import java.util.List;
16
17/**
18 * Java class for anonymous complex type.
19 *
20 * <p>The following schema fragment specifies the expected content contained within this class.
21 *
22 * <pre>{@code
23 * <complexType>
24 * <complexContent>
25 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
26 * <sequence>
27 * <element ref="{}GM-user" maxOccurs="unbounded"/>
28 * </sequence>
29 * </restriction>
30 * </complexContent>
31 * </complexType>
32 * }</pre>
33 */
34@XmlAccessorType(XmlAccessType.FIELD)
35@XmlType(
36 name = "",
37 propOrder = {"gmUser"})
38@XmlRootElement(name = "GM-users")
39public class GMUsers {
40
41 @XmlElement(name = "GM-user", required = true)
42 protected List<GMUser> gmUser;
43
44 /**
45 * Gets the value of the gmUser property.
46 *
47 * <p>This accessor method returns a reference to the live list, not a snapshot. Therefore any
48 * modification you make to the returned list will be present inside the JAXB object. This is why
49 * there is not a <CODE>set</CODE> method for the gmUser property.
50 *
51 * <p>For example, to add a new item, do as follows:
52 *
53 * <pre>
54 * getGMUser().add(newItem);
55 * </pre>
56 *
57 * <p>Objects of the following type(s) are allowed in the list {@link GMUser }
58 *
59 * @return The value of the gmUser property.
60 */
61 public List<GMUser> getGMUser() {
62 if (gmUser == null) {
63 gmUser = new ArrayList<>();
64 }
65 return this.gmUser;
66 }
67}
diff --git a/service/src/main/java/market/guess/service/catalog/model/v2/GuessMarket.java b/service/src/main/java/market/guess/service/catalog/model/v2/GuessMarket.java
new file mode 100644
index 0000000..e312651
--- /dev/null
+++ b/service/src/main/java/market/guess/service/catalog/model/v2/GuessMarket.java
@@ -0,0 +1,81 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7package market.guess.service.catalog.model.v2;
8
9import jakarta.xml.bind.annotation.XmlAccessType;
10import jakarta.xml.bind.annotation.XmlAccessorType;
11import jakarta.xml.bind.annotation.XmlElement;
12import jakarta.xml.bind.annotation.XmlRootElement;
13import jakarta.xml.bind.annotation.XmlType;
14
15/**
16 * Java class for anonymous complex type.
17 *
18 * <p>The following schema fragment specifies the expected content contained within this class.
19 *
20 * <pre>{@code
21 * <complexType>
22 * <complexContent>
23 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
24 * <all>
25 * <element ref="{}GM-events"/>
26 * <element ref="{}GM-users"/>
27 * </all>
28 * </restriction>
29 * </complexContent>
30 * </complexType>
31 * }</pre>
32 */
33@XmlAccessorType(XmlAccessType.FIELD)
34@XmlType(
35 name = "",
36 propOrder = {})
37@XmlRootElement(name = "Guess-Market")
38public class GuessMarket {
39
40 @XmlElement(name = "GM-events", required = true)
41 protected GMEvents gmEvents;
42
43 @XmlElement(name = "GM-users", required = true)
44 protected GMUsers gmUsers;
45
46 /**
47 * Gets the value of the gmEvents property.
48 *
49 * @return possible object is {@link GMEvents }
50 */
51 public GMEvents getGMEvents() {
52 return gmEvents;
53 }
54
55 /**
56 * Sets the value of the gmEvents property.
57 *
58 * @param value allowed object is {@link GMEvents }
59 */
60 public void setGMEvents(GMEvents value) {
61 this.gmEvents = value;
62 }
63
64 /**
65 * Gets the value of the gmUsers property.
66 *
67 * @return possible object is {@link GMUsers }
68 */
69 public GMUsers getGMUsers() {
70 return gmUsers;
71 }
72
73 /**
74 * Sets the value of the gmUsers property.
75 *
76 * @param value allowed object is {@link GMUsers }
77 */
78 public void setGMUsers(GMUsers value) {
79 this.gmUsers = value;
80 }
81}
diff --git a/service/src/main/java/market/guess/service/catalog/model/v2/ObjectFactory.java b/service/src/main/java/market/guess/service/catalog/model/v2/ObjectFactory.java
new file mode 100644
index 0000000..5a20f54
--- /dev/null
+++ b/service/src/main/java/market/guess/service/catalog/model/v2/ObjectFactory.java
@@ -0,0 +1,200 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7package market.guess.service.catalog.model.v2;
8
9import jakarta.xml.bind.JAXBElement;
10import jakarta.xml.bind.annotation.XmlElementDecl;
11import jakarta.xml.bind.annotation.XmlRegistry;
12import javax.xml.namespace.QName;
13
14/**
15 * This object contains factory methods for each Java content interface and Java element interface
16 * generated in the market.guess.service.model.v2 package.
17 *
18 * <p>An ObjectFactory allows you to programmatically construct new instances of the Java
19 * representation for XML content. The Java representation of XML content can consist of schema
20 * derived interfaces and classes representing the binding of schema type definitions, element
21 * declarations and model groups. Factory methods for each of these are provided in this class.
22 */
23@XmlRegistry
24public class ObjectFactory {
25
26 private static final QName _InitialCash_QNAME = new QName("", "initial-cash");
27 private static final QName _Id_QNAME = new QName("", "id");
28 private static final QName _Description_QNAME = new QName("", "description");
29 private static final QName _B_QNAME = new QName("", "b");
30 private static final QName _GMOption_QNAME = new QName("", "GM-option");
31
32 /**
33 * Create a new ObjectFactory that can be used to create new instances of schema derived classes
34 * for package: market.guess.service.model.v2
35 */
36 public ObjectFactory() {}
37
38 /**
39 * Create an instance of {@link Event }
40 *
41 * @return the new instance of {@link Event }
42 */
43 public Event createEvent() {
44 return new Event();
45 }
46
47 /**
48 * Create an instance of {@link Commission }
49 *
50 * @return the new instance of {@link Commission }
51 */
52 public Commission createCommission() {
53 return new Commission();
54 }
55
56 /**
57 * Create an instance of {@link GuessMarket }
58 *
59 * @return the new instance of {@link GuessMarket }
60 */
61 public GuessMarket createGuessMarket() {
62 return new GuessMarket();
63 }
64
65 /**
66 * Create an instance of {@link GMEvents }
67 *
68 * @return the new instance of {@link GMEvents }
69 */
70 public GMEvents createGMEvents() {
71 return new GMEvents();
72 }
73
74 /**
75 * Create an instance of {@link GMEvent }
76 *
77 * @return the new instance of {@link GMEvent }
78 */
79 public GMEvent createGMEvent() {
80 return new GMEvent();
81 }
82
83 /**
84 * Create an instance of {@link GMOptions }
85 *
86 * @return the new instance of {@link GMOptions }
87 */
88 public GMOptions createGMOptions() {
89 return new GMOptions();
90 }
91
92 /**
93 * Create an instance of {@link GMMethod }
94 *
95 * @return the new instance of {@link GMMethod }
96 */
97 public GMMethod createGMMethod() {
98 return new GMMethod();
99 }
100
101 /**
102 * Create an instance of {@link GMLMSR }
103 *
104 * @return the new instance of {@link GMLMSR }
105 */
106 public GMLMSR createGMLMSR() {
107 return new GMLMSR();
108 }
109
110 /**
111 * Create an instance of {@link GMOrderBook }
112 *
113 * @return the new instance of {@link GMOrderBook }
114 */
115 public GMOrderBook createGMOrderBook() {
116 return new GMOrderBook();
117 }
118
119 /**
120 * Create an instance of {@link GMUsers }
121 *
122 * @return the new instance of {@link GMUsers }
123 */
124 public GMUsers createGMUsers() {
125 return new GMUsers();
126 }
127
128 /**
129 * Create an instance of {@link GMUser }
130 *
131 * @return the new instance of {@link GMUser }
132 */
133 public GMUser createGMUser() {
134 return new GMUser();
135 }
136
137 /**
138 * Create an instance of {@link GMMarketMaker }
139 *
140 * @return the new instance of {@link GMMarketMaker }
141 */
142 public GMMarketMaker createGMMarketMaker() {
143 return new GMMarketMaker();
144 }
145
146 /**
147 * Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
148 *
149 * @param value Java instance representing xml element's value.
150 * @return the new instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
151 */
152 @XmlElementDecl(namespace = "", name = "initial-cash")
153 public JAXBElement<Integer> createInitialCash(Integer value) {
154 return new JAXBElement<>(_InitialCash_QNAME, Integer.class, null, value);
155 }
156
157 /**
158 * Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
159 *
160 * @param value Java instance representing xml element's value.
161 * @return the new instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
162 */
163 @XmlElementDecl(namespace = "", name = "id")
164 public JAXBElement<Integer> createId(Integer value) {
165 return new JAXBElement<>(_Id_QNAME, Integer.class, null, value);
166 }
167
168 /**
169 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
170 *
171 * @param value Java instance representing xml element's value.
172 * @return the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
173 */
174 @XmlElementDecl(namespace = "", name = "description")
175 public JAXBElement<String> createDescription(String value) {
176 return new JAXBElement<>(_Description_QNAME, String.class, null, value);
177 }
178
179 /**
180 * Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
181 *
182 * @param value Java instance representing xml element's value.
183 * @return the new instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
184 */
185 @XmlElementDecl(namespace = "", name = "b")
186 public JAXBElement<Integer> createB(Integer value) {
187 return new JAXBElement<>(_B_QNAME, Integer.class, null, value);
188 }
189
190 /**
191 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
192 *
193 * @param value Java instance representing xml element's value.
194 * @return the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
195 */
196 @XmlElementDecl(namespace = "", name = "GM-option")
197 public JAXBElement<String> createGMOption(String value) {
198 return new JAXBElement<>(_GMOption_QNAME, String.class, null, value);
199 }
200}
diff --git a/service/src/main/java/market/guess/service/domain/Event.java b/service/src/main/java/market/guess/service/domain/Event.java
index 943328a..6089aa3 100644
--- a/service/src/main/java/market/guess/service/domain/Event.java
+++ b/service/src/main/java/market/guess/service/domain/Event.java
@@ -5,10 +5,13 @@ import java.time.Instant;
5import java.util.ArrayList; 5import java.util.ArrayList;
6import java.util.List; 6import java.util.List;
7import market.guess.api.CommissionTiming; 7import market.guess.api.CommissionTiming;
8import market.guess.api.MarketDTO;
8import market.guess.api.MarketStateDTO; 9import market.guess.api.MarketStateDTO;
9import market.guess.api.TradeRowDTO; 10import market.guess.api.TradeRowDTO;
10import market.guess.model.event.EventStatus; 11import market.guess.model.event.EventStatus;
11import market.guess.model.event.EventSummaryDTO; 12import market.guess.model.event.EventSummaryDTO;
13import market.guess.service.helpers.BigDecimalOptions;
14import market.guess.service.helpers.InstantOptions;
12import market.guess.service.ledger.Ledger; 15import market.guess.service.ledger.Ledger;
13import market.guess.service.mechanism.TradingMechanism; 16import market.guess.service.mechanism.TradingMechanism;
14 17
@@ -54,6 +57,10 @@ public final class Event {
54 this.state = status; 57 this.state = status;
55 } 58 }
56 59
60 public TradingMechanism getMechanism() {
61 return mechanism;
62 }
63
57 public String getEventKey() { 64 public String getEventKey() {
58 return eventKey; 65 return eventKey;
59 } 66 }
@@ -118,7 +125,7 @@ public final class Event {
118 Instant time, 125 Instant time,
119 String user, 126 String user,
120 Market option, 127 Market option,
121 int quantity, 128 long quantity,
122 BigDecimal cost, 129 BigDecimal cost,
123 BigDecimal commission) { 130 BigDecimal commission) {
124 var trade = 131 var trade =
@@ -131,7 +138,7 @@ public final class Event {
131 138
132 public BigDecimal tradeVolumeOf(String option) { 139 public BigDecimal tradeVolumeOf(String option) {
133 return trades.stream() 140 return trades.stream()
134 .filter(trade -> trade.optionKey().equalsIgnoreCase(option)) 141 .filter(trade -> trade.marketKey().equalsIgnoreCase(option))
135 .map(Trade::sharesCost) 142 .map(Trade::sharesCost)
136 .reduce(BigDecimalOptions.ZERO_MONEY, BigDecimal::add); 143 .reduce(BigDecimalOptions.ZERO_MONEY, BigDecimal::add);
137 } 144 }
@@ -148,9 +155,9 @@ public final class Event {
148 for (var trade : trades.reversed()) { 155 for (var trade : trades.reversed()) {
149 history.add( 156 history.add(
150 new TradeRowDTO( 157 new TradeRowDTO(
151 trade.at().toString(), 158 InstantOptions.humanize(trade.at()),
152 trade.userName(), 159 trade.buyerUserName(),
153 trade.optionName(), 160 trade.marketName(),
154 String.valueOf(trade.quantity()), 161 String.valueOf(trade.quantity()),
155 trade.sharesCost().toPlainString())); 162 trade.sharesCost().toPlainString()));
156 } 163 }
@@ -172,12 +179,18 @@ public final class Event {
172 } 179 }
173 180
174 public MarketStateDTO toMarketState() { 181 public MarketStateDTO toMarketState() {
182 var prices = mechanism.prices();
183 var marketDTOs = new ArrayList<MarketDTO>();
184 for (var i = 0; i < markets.size(); i++) {
185 marketDTOs.add(markets.get(i).toMarket(prices[i]));
186 }
187
175 return new MarketStateDTO( 188 return new MarketStateDTO(
176 eventKey, 189 eventKey,
177 mechanism.getType(), 190 mechanism.getType(),
178 markets.stream().map(Market::toMarket).toList(), 191 marketDTOs,
179 String.valueOf(ledger.getBalance()), 192 String.valueOf(ledger.getBalance()),
180 ""); 193 String.valueOf(getCommission()));
181 } 194 }
182 195
183 public Market getOption(String optionKey) { 196 public Market getOption(String optionKey) {
@@ -194,8 +207,7 @@ public final class Event {
194 return false; 207 return false;
195 } 208 }
196 209
197 public BigDecimal getPayout() { 210 public void addSettlementCommission(BigDecimal amount) {
198 // TODO Auto-generated method stub 211 this.settlementCommission = settlementCommission.add(amount);
199 throw new UnsupportedOperationException("Unimplemented method 'getPayout'");
200 } 212 }
201} 213}
diff --git a/service/src/main/java/market/guess/service/domain/Market.java b/service/src/main/java/market/guess/service/domain/Market.java
index ce95bae..3ff7e2d 100644
--- a/service/src/main/java/market/guess/service/domain/Market.java
+++ b/service/src/main/java/market/guess/service/domain/Market.java
@@ -1,12 +1,13 @@
1package market.guess.service.domain; 1package market.guess.service.domain;
2 2
3import java.math.BigDecimal;
3import market.guess.api.MarketDTO; 4import market.guess.api.MarketDTO;
4 5
5public final class Market { 6public final class Market {
6 private final String key; 7 private final String key;
7 private final String name; 8 private final String name;
8 9
9 private int volume; 10 private long volume;
10 11
11 public Market(String key, String name) { 12 public Market(String key, String name) {
12 super(); 13 super();
@@ -22,11 +23,15 @@ public final class Market {
22 return key; 23 return key;
23 } 24 }
24 25
25 public int getVolume() { 26 public long getVolume() {
26 return volume; 27 return volume;
27 } 28 }
28 29
29 public MarketDTO toMarket() { 30 public void addVolume(long quantity) {
30 return new MarketDTO(key, name, "", String.valueOf(volume)); 31 volume += quantity;
32 }
33
34 public MarketDTO toMarket(BigDecimal price) {
35 return new MarketDTO(key, name, price.toPlainString(), String.valueOf(volume));
31 } 36 }
32} 37}
diff --git a/service/src/main/java/market/guess/service/domain/MarketAction.java b/service/src/main/java/market/guess/service/domain/MarketAction.java
deleted file mode 100644
index d1a0ad5..0000000
--- a/service/src/main/java/market/guess/service/domain/MarketAction.java
+++ /dev/null
@@ -1,24 +0,0 @@
1package market.guess.service.domain;
2
3public record MarketAction(
4 String kind, String at, String userName, String eventKey, String optionKey, long quantity) {
5
6 public static final String BUY = "BUY";
7 public static final String SELL = "SELL";
8 public static final String SETTLE = "SETTLE";
9
10 public static MarketAction buy(
11 String at, String userName, String eventKey, String optionKey, long quantity) {
12 return new MarketAction(BUY, at, userName, eventKey, optionKey, quantity);
13 }
14
15 public static MarketAction sell(
16 String at, String userName, String eventKey, String optionKey, long quantity) {
17 return new MarketAction(SELL, at, userName, eventKey, optionKey, quantity);
18 }
19
20 public static MarketAction settle(
21 String at, String userName, String eventKey, String winningOptionKey) {
22 return new MarketAction(SETTLE, at, userName, eventKey, winningOptionKey, 0);
23 }
24}
diff --git a/service/src/main/java/market/guess/service/domain/Order.java b/service/src/main/java/market/guess/service/domain/Order.java
new file mode 100644
index 0000000..9d54020
--- /dev/null
+++ b/service/src/main/java/market/guess/service/domain/Order.java
@@ -0,0 +1,6 @@
1package market.guess.service.domain;
2
3import java.math.BigDecimal;
4import java.time.Instant;
5
6public record Order(Instant at, Event event, Market market, BigDecimal price, long quantity) {}
diff --git a/service/src/main/java/market/guess/service/domain/Settlement.java b/service/src/main/java/market/guess/service/domain/Settlement.java
deleted file mode 100644
index cfc61f5..0000000
--- a/service/src/main/java/market/guess/service/domain/Settlement.java
+++ /dev/null
@@ -1,6 +0,0 @@
1package market.guess.service.domain;
2
3import java.math.BigDecimal;
4
5public record Settlement(
6 String winningOption, BigDecimal commission, BigDecimal paidOutToHolders) {}
diff --git a/service/src/main/java/market/guess/service/domain/Trade.java b/service/src/main/java/market/guess/service/domain/Trade.java
index 1211280..271582b 100644
--- a/service/src/main/java/market/guess/service/domain/Trade.java
+++ b/service/src/main/java/market/guess/service/domain/Trade.java
@@ -6,10 +6,10 @@ import java.time.Instant;
6public record Trade( 6public record Trade(
7 int id, 7 int id,
8 Instant at, 8 Instant at,
9 String userName, 9 String buyerUserName,
10 String optionKey, 10 String marketKey,
11 String optionName, 11 String marketName,
12 int quantity, 12 long quantity,
13 BigDecimal sharesCost, 13 BigDecimal sharesCost,
14 BigDecimal commission) { 14 BigDecimal commission) {
15 15
diff --git a/service/src/main/java/market/guess/service/domain/User.java b/service/src/main/java/market/guess/service/domain/User.java
index 3536c4e..a00b1a0 100644
--- a/service/src/main/java/market/guess/service/domain/User.java
+++ b/service/src/main/java/market/guess/service/domain/User.java
@@ -1,6 +1,7 @@
1package market.guess.service.domain; 1package market.guess.service.domain;
2 2
3import java.math.BigDecimal; 3import java.math.BigDecimal;
4import market.guess.service.helpers.BigDecimalOptions;
4import market.guess.service.ledger.Ledger; 5import market.guess.service.ledger.Ledger;
5 6
6public final class User { 7public final class User {
diff --git a/service/src/main/java/market/guess/service/fulfillment/FulfillmentContext.java b/service/src/main/java/market/guess/service/fulfillment/FulfillmentContext.java
new file mode 100644
index 0000000..d5205e5
--- /dev/null
+++ b/service/src/main/java/market/guess/service/fulfillment/FulfillmentContext.java
@@ -0,0 +1,10 @@
1package market.guess.service.fulfillment;
2
3import java.util.List;
4import market.guess.service.domain.Order;
5import market.guess.service.domain.Trade;
6import market.guess.service.domain.User;
7
8public interface FulfillmentContext {
9 List<Trade> fulfill(User user, Order order, List<Trade> rawTrades);
10}
diff --git a/service/src/main/java/market/guess/service/fulfillment/LocalFulfillmentContext.java b/service/src/main/java/market/guess/service/fulfillment/LocalFulfillmentContext.java
new file mode 100644
index 0000000..64887dc
--- /dev/null
+++ b/service/src/main/java/market/guess/service/fulfillment/LocalFulfillmentContext.java
@@ -0,0 +1,51 @@
1package market.guess.service.fulfillment;
2
3import java.math.BigDecimal;
4import java.util.ArrayList;
5import java.util.List;
6import market.guess.api.CommissionTiming;
7import market.guess.model.ledger.LedgerType;
8import market.guess.service.domain.Order;
9import market.guess.service.domain.Trade;
10import market.guess.service.domain.User;
11import market.guess.service.helpers.BigDecimalOptions;
12import market.guess.service.ledger.LedgerContext;
13
14public final class LocalFulfillmentContext implements FulfillmentContext {
15 private final LedgerContext ledger;
16
17 public LocalFulfillmentContext(LedgerContext ledger) {
18 this.ledger = ledger;
19 }
20
21 @Override
22 public List<Trade> fulfill(User user, Order order, List<Trade> rawTrades) {
23 var event = order.event();
24 var chargeNow = event.getCommissionTiming() == CommissionTiming.ON_PURCHASE;
25 var rate = BigDecimal.valueOf(event.getCommissionPercent()).divide(BigDecimal.valueOf(100));
26
27 var recorded = new ArrayList<Trade>();
28 for (var raw : rawTrades) {
29 var commission =
30 chargeNow
31 ? BigDecimalOptions.toMoney(raw.sharesCost().multiply(rate))
32 : BigDecimalOptions.ZERO_MONEY;
33 var trade =
34 event.recordTrade(
35 order.at(),
36 user.getName(),
37 order.market(),
38 raw.quantity(),
39 raw.sharesCost(),
40 commission);
41 ledger.debit(
42 user.getName(),
43 LedgerType.PURCHASE,
44 trade.totalPaid(),
45 "Purchase: " + order.market().getName());
46 order.market().addVolume(trade.quantity());
47 recorded.add(trade);
48 }
49 return recorded;
50 }
51}
diff --git a/service/src/main/java/market/guess/service/domain/BigDecimalOptions.java b/service/src/main/java/market/guess/service/helpers/BigDecimalOptions.java
index 992e44f..8fcf920 100644
--- a/service/src/main/java/market/guess/service/domain/BigDecimalOptions.java
+++ b/service/src/main/java/market/guess/service/helpers/BigDecimalOptions.java
@@ -1,10 +1,10 @@
1package market.guess.service.domain; 1package market.guess.service.helpers;
2 2
3import java.math.BigDecimal; 3import java.math.BigDecimal;
4import java.math.RoundingMode; 4import java.math.RoundingMode;
5 5
6public record BigDecimalOptions(int scale, RoundingMode roundingMode) { 6public record BigDecimalOptions(int scale, RoundingMode roundingMode) {
7 public static final BigDecimalOptions DEFAULT = new BigDecimalOptions(2, RoundingMode.HALF_EVEN); 7 private static final BigDecimalOptions DEFAULT = new BigDecimalOptions(2, RoundingMode.HALF_EVEN);
8 public static final BigDecimal ZERO_MONEY = 8 public static final BigDecimal ZERO_MONEY =
9 BigDecimal.ZERO.setScale(DEFAULT.scale(), DEFAULT.roundingMode()); 9 BigDecimal.ZERO.setScale(DEFAULT.scale(), DEFAULT.roundingMode());
10 10
diff --git a/service/src/main/java/market/guess/service/helpers/InstantOptions.java b/service/src/main/java/market/guess/service/helpers/InstantOptions.java
new file mode 100644
index 0000000..3977dcb
--- /dev/null
+++ b/service/src/main/java/market/guess/service/helpers/InstantOptions.java
@@ -0,0 +1,16 @@
1package market.guess.service.helpers;
2
3import java.time.Instant;
4import java.time.ZoneId;
5import java.time.format.DateTimeFormatter;
6
7public final class InstantOptions {
8 private static final DateTimeFormatter HUMAN =
9 DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
10
11 private InstantOptions() {}
12
13 public static String humanize(Instant instant) {
14 return HUMAN.format(instant);
15 }
16}
diff --git a/service/src/main/java/market/guess/service/infrastructure/provider/Loader.java b/service/src/main/java/market/guess/service/infrastructure/provider/Loader.java
deleted file mode 100644
index fcca92f..0000000
--- a/service/src/main/java/market/guess/service/infrastructure/provider/Loader.java
+++ /dev/null
@@ -1,9 +0,0 @@
1package market.guess.service.infrastructure.provider;
2
3import java.nio.file.Path;
4import market.guess.api.LoadResultDTO;
5import market.guess.api.Result;
6
7public interface Loader {
8 Result<LoadResultDTO> load(Path path);
9}
diff --git a/service/src/main/java/market/guess/service/ledger/Ledger.java b/service/src/main/java/market/guess/service/ledger/Ledger.java
index 744fde7..72bf387 100644
--- a/service/src/main/java/market/guess/service/ledger/Ledger.java
+++ b/service/src/main/java/market/guess/service/ledger/Ledger.java
@@ -4,7 +4,7 @@ import java.math.BigDecimal;
4import java.util.ArrayList; 4import java.util.ArrayList;
5import java.util.Collections; 5import java.util.Collections;
6import java.util.List; 6import java.util.List;
7import market.guess.service.domain.BigDecimalOptions; 7import market.guess.service.helpers.BigDecimalOptions;
8 8
9public final class Ledger { 9public final class Ledger {
10 private final String owner; 10 private final String owner;
@@ -31,5 +31,6 @@ public final class Ledger {
31 31
32 public void record(LedgerEntry entry) { 32 public void record(LedgerEntry entry) {
33 entries.add(entry); 33 entries.add(entry);
34 this.balance = entry.balanceAfter();
34 } 35 }
35} 36}
diff --git a/service/src/main/java/market/guess/service/ledger/LedgerContext.java b/service/src/main/java/market/guess/service/ledger/LedgerContext.java
index 12ec614..bb1bf97 100644
--- a/service/src/main/java/market/guess/service/ledger/LedgerContext.java
+++ b/service/src/main/java/market/guess/service/ledger/LedgerContext.java
@@ -3,7 +3,7 @@ package market.guess.service.ledger;
3import java.math.BigDecimal; 3import java.math.BigDecimal;
4import java.time.Clock; 4import java.time.Clock;
5import market.guess.model.ledger.LedgerType; 5import market.guess.model.ledger.LedgerType;
6import market.guess.service.infrastructure.repository.UserRepository; 6import market.guess.service.catalog.infrastructure.repository.UserRepository;
7 7
8public final class LedgerContext { 8public final class LedgerContext {
9 private final Clock clock; 9 private final Clock clock;
@@ -11,10 +11,6 @@ public final class LedgerContext {
11 11
12 private int runningId; 12 private int runningId;
13 13
14 public LedgerContext(UserRepository users) {
15 this(users, Clock.systemUTC());
16 }
17
18 public LedgerContext(UserRepository users, Clock clock) { 14 public LedgerContext(UserRepository users, Clock clock) {
19 super(); 15 super();
20 this.clock = clock; 16 this.clock = clock;
diff --git a/service/src/main/java/market/guess/service/matching/LocalMatchingEngine.java b/service/src/main/java/market/guess/service/matching/LocalMatchingEngine.java
new file mode 100644
index 0000000..6a815c8
--- /dev/null
+++ b/service/src/main/java/market/guess/service/matching/LocalMatchingEngine.java
@@ -0,0 +1,20 @@
1package market.guess.service.matching;
2
3import java.util.List;
4import market.guess.service.domain.Order;
5import market.guess.service.domain.Trade;
6
7public final class LocalMatchingEngine implements MatchingEngine {
8
9 @Override
10 public List<Trade> match(Order order) {
11 var mechanism = order.event().getMechanism();
12 return mechanism.buy(order.event(), order.market(), order.quantity());
13 }
14
15 @Override
16 public boolean cancelOrder() {
17 // TODO Auto-generated method stub
18 throw new UnsupportedOperationException("Unimplemented method 'cancelOrder'");
19 }
20}
diff --git a/service/src/main/java/market/guess/service/matching/MatchingEngine.java b/service/src/main/java/market/guess/service/matching/MatchingEngine.java
new file mode 100644
index 0000000..a8fc0c4
--- /dev/null
+++ b/service/src/main/java/market/guess/service/matching/MatchingEngine.java
@@ -0,0 +1,11 @@
1package market.guess.service.matching;
2
3import java.util.List;
4import market.guess.service.domain.Order;
5import market.guess.service.domain.Trade;
6
7public interface MatchingEngine {
8 List<Trade> match(Order order);
9
10 boolean cancelOrder();
11}
diff --git a/service/src/main/java/market/guess/service/matching/OrderMatchingContext.java b/service/src/main/java/market/guess/service/matching/OrderMatchingContext.java
deleted file mode 100644
index 8882432..0000000
--- a/service/src/main/java/market/guess/service/matching/OrderMatchingContext.java
+++ /dev/null
@@ -1,13 +0,0 @@
1package market.guess.service.matching;
2
3import java.util.List;
4import market.guess.service.domain.Event;
5import market.guess.service.domain.Market;
6import market.guess.service.domain.Trade;
7import market.guess.service.domain.User;
8
9public interface OrderMatchingContext {
10 List<Trade> submitOrder(User user, Event event, Market market, int quantity);
11
12 boolean cancelOrder();
13}
diff --git a/service/src/main/java/market/guess/service/mechanism/LmsrTradingMechanism.java b/service/src/main/java/market/guess/service/mechanism/LmsrTradingMechanism.java
index cdba3f6..87c5661 100644
--- a/service/src/main/java/market/guess/service/mechanism/LmsrTradingMechanism.java
+++ b/service/src/main/java/market/guess/service/mechanism/LmsrTradingMechanism.java
@@ -1,17 +1,30 @@
1package market.guess.service.mechanism; 1package market.guess.service.mechanism;
2 2
3import java.math.BigDecimal; 3import java.math.BigDecimal;
4import java.time.Clock;
4import java.util.Arrays; 5import java.util.Arrays;
6import java.util.List;
5import market.guess.api.MechanismType; 7import market.guess.api.MechanismType;
6import market.guess.service.domain.BigDecimalOptions; 8import market.guess.service.domain.Event;
9import market.guess.service.domain.Market;
10import market.guess.service.domain.Trade;
11import market.guess.service.helpers.BigDecimalOptions;
7 12
8public final class LmsrTradingMechanism implements TradingMechanism { 13public final class LmsrTradingMechanism implements TradingMechanism {
9 private final int liquidity; 14 private final int liquidity;
10 private final int[] q; 15 private final int[] q;
11 16
17 private final Clock clock;
18
12 public LmsrTradingMechanism(int liquidity, int optionCount) { 19 public LmsrTradingMechanism(int liquidity, int optionCount) {
20 this(liquidity, optionCount, Clock.systemUTC());
21 }
22
23 public LmsrTradingMechanism(int liquidity, int optionCount, Clock clock) {
24 super();
13 this.liquidity = liquidity; 25 this.liquidity = liquidity;
14 this.q = new int[optionCount]; 26 this.q = new int[optionCount];
27 this.clock = clock;
15 } 28 }
16 29
17 @Override 30 @Override
@@ -20,12 +33,8 @@ public final class LmsrTradingMechanism implements TradingMechanism {
20 } 33 }
21 34
22 @Override 35 @Override
23 public BigDecimal openingCost() { 36 public List<Trade> buy(Event event, Market market, long quantity) {
24 return BigDecimalOptions.toMoney(cost(new int[q.length])); 37 var optionIndex = event.getMarkets().indexOf(market);
25 }
26
27 @Override
28 public TradeExecution buy(int optionIndex, int quantity) {
29 var before = cost(q); 38 var before = cost(q);
30 39
31 var after = q.clone(); 40 var after = q.clone();
@@ -34,7 +43,16 @@ public final class LmsrTradingMechanism implements TradingMechanism {
34 43
35 q[optionIndex] += quantity; 44 q[optionIndex] += quantity;
36 45
37 return new TradeExecution(quantity, BigDecimalOptions.toMoney(delta)); 46 return List.of(
47 new Trade(
48 0,
49 clock.instant(),
50 null,
51 market.getKey(),
52 market.getName(),
53 quantity,
54 BigDecimalOptions.toMoney(delta),
55 null));
38 } 56 }
39 57
40 @Override 58 @Override
diff --git a/service/src/main/java/market/guess/service/mechanism/OrderBookTradingMechanism.java b/service/src/main/java/market/guess/service/mechanism/OrderBookTradingMechanism.java
index 43f4843..4e0dd0a 100644
--- a/service/src/main/java/market/guess/service/mechanism/OrderBookTradingMechanism.java
+++ b/service/src/main/java/market/guess/service/mechanism/OrderBookTradingMechanism.java
@@ -5,8 +5,10 @@ import java.math.RoundingMode;
5import java.util.ArrayList; 5import java.util.ArrayList;
6import java.util.List; 6import java.util.List;
7import market.guess.api.MechanismType; 7import market.guess.api.MechanismType;
8import market.guess.service.domain.BigDecimalOptions; 8import market.guess.service.domain.Event;
9import market.guess.service.domain.Market;
9import market.guess.service.domain.Trade; 10import market.guess.service.domain.Trade;
11import market.guess.service.helpers.BigDecimalOptions;
10 12
11public final class OrderBookTradingMechanism implements TradingMechanism { 13public final class OrderBookTradingMechanism implements TradingMechanism {
12 public enum Side { 14 public enum Side {
@@ -54,13 +56,9 @@ public final class OrderBookTradingMechanism implements TradingMechanism {
54 } 56 }
55 57
56 @Override 58 @Override
57 public BigDecimal openingCost() { 59 public List<Trade> buy(Event event, Market market, long quantity) {
58 return BigDecimalOptions.toMoney(initial); 60 var optionIndex = event.getMarkets().indexOf(market);
59 } 61 return List.of(match(optionIndex, Side.BUY, (int) quantity, null, false));
60
61 @Override
62 public Trade buy(int optionIndex, int quantity) {
63 return match(optionIndex, Side.BUY, quantity, null, false);
64 } 62 }
65 63
66 /** Priced limit order — not on the shared interface, no engine call site yet. */ 64 /** Priced limit order — not on the shared interface, no engine call site yet. */
diff --git a/service/src/main/java/market/guess/service/mechanism/TradingMechanism.java b/service/src/main/java/market/guess/service/mechanism/TradingMechanism.java
index 204a170..16a5c6f 100644
--- a/service/src/main/java/market/guess/service/mechanism/TradingMechanism.java
+++ b/service/src/main/java/market/guess/service/mechanism/TradingMechanism.java
@@ -1,16 +1,17 @@
1package market.guess.service.mechanism; 1package market.guess.service.mechanism;
2 2
3import java.math.BigDecimal; 3import java.math.BigDecimal;
4import java.util.List;
4import market.guess.api.MechanismType; 5import market.guess.api.MechanismType;
6import market.guess.service.domain.Event;
7import market.guess.service.domain.Market;
5import market.guess.service.domain.Trade; 8import market.guess.service.domain.Trade;
6 9
7public sealed interface TradingMechanism permits LmsrTradingMechanism, OrderBookTradingMechanism { 10public sealed interface TradingMechanism permits LmsrTradingMechanism, OrderBookTradingMechanism {
8 11
9 MechanismType getType(); 12 MechanismType getType();
10 13
11 BigDecimal openingCost(); 14 List<Trade> buy(Event event, Market market, long quantity);
12
13 Trade buy(int optionIndex, int quantity);
14 15
15 BigDecimal[] prices(); 16 BigDecimal[] prices();
16} 17}
diff --git a/service/src/main/java/market/guess/service/model/v1/GMEvent.java b/service/src/main/java/market/guess/service/model/v1/GMEvent.java
deleted file mode 100644
index efe5d30..0000000
--- a/service/src/main/java/market/guess/service/model/v1/GMEvent.java
+++ /dev/null
@@ -1,215 +0,0 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7
8package market.guess.service.model.v1;
9
10import java.util.ArrayList;
11import java.util.List;
12import jakarta.xml.bind.annotation.XmlAccessType;
13import jakarta.xml.bind.annotation.XmlAccessorType;
14import jakarta.xml.bind.annotation.XmlAttribute;
15import jakarta.xml.bind.annotation.XmlElement;
16import jakarta.xml.bind.annotation.XmlRootElement;
17import jakarta.xml.bind.annotation.XmlType;
18
19
20/**
21 * <p>Java class for anonymous complex type</p>.
22 *
23 * <p>The following schema fragment specifies the expected content contained within this class.</p>
24 *
25 * <pre>{@code
26 * <complexType>
27 * <complexContent>
28 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
29 * <sequence>
30 * <element ref="{}id"/>
31 * <element ref="{}description"/>
32 * <element ref="{}comision"/>
33 * <element ref="{}GM-options"/>
34 * <element ref="{}GM-method"/>
35 * </sequence>
36 * <attribute name="name" use="required">
37 * <simpleType>
38 * <list itemType="{http://www.w3.org/2001/XMLSchema}string" />
39 * </simpleType>
40 * </attribute>
41 * </restriction>
42 * </complexContent>
43 * </complexType>
44 * }</pre>
45 *
46 *
47 */
48@XmlAccessorType(XmlAccessType.FIELD)
49@XmlType(name = "", propOrder = {
50 "id",
51 "description",
52 "comision",
53 "gmOptions",
54 "gmMethod"
55})
56@XmlRootElement(name = "GM-event")
57public class GMEvent {
58
59 protected int id;
60 @XmlElement(required = true)
61 protected String description;
62 @XmlElement(required = true)
63 protected Comision comision;
64 @XmlElement(name = "GM-options", required = true)
65 protected GMOptions gmOptions;
66 @XmlElement(name = "GM-method", required = true)
67 protected GMMethod gmMethod;
68 @XmlAttribute(name = "name", required = true)
69 protected List<String> name;
70
71 /**
72 * Gets the value of the id property.
73 *
74 */
75 public int getId() {
76 return id;
77 }
78
79 /**
80 * Sets the value of the id property.
81 *
82 */
83 public void setId(int value) {
84 this.id = value;
85 }
86
87 /**
88 * Gets the value of the description property.
89 *
90 * @return
91 * possible object is
92 * {@link String }
93 *
94 */
95 public String getDescription() {
96 return description;
97 }
98
99 /**
100 * Sets the value of the description property.
101 *
102 * @param value
103 * allowed object is
104 * {@link String }
105 *
106 */
107 public void setDescription(String value) {
108 this.description = value;
109 }
110
111 /**
112 * Gets the value of the comision property.
113 *
114 * @return
115 * possible object is
116 * {@link Comision }
117 *
118 */
119 public Comision getComision() {
120 return comision;
121 }
122
123 /**
124 * Sets the value of the comision property.
125 *
126 * @param value
127 * allowed object is
128 * {@link Comision }
129 *
130 */
131 public void setComision(Comision value) {
132 this.comision = value;
133 }
134
135 /**
136 * Gets the value of the gmOptions property.
137 *
138 * @return
139 * possible object is
140 * {@link GMOptions }
141 *
142 */
143 public GMOptions getGMOptions() {
144 return gmOptions;
145 }
146
147 /**
148 * Sets the value of the gmOptions property.
149 *
150 * @param value
151 * allowed object is
152 * {@link GMOptions }
153 *
154 */
155 public void setGMOptions(GMOptions value) {
156 this.gmOptions = value;
157 }
158
159 /**
160 * Gets the value of the gmMethod property.
161 *
162 * @return
163 * possible object is
164 * {@link GMMethod }
165 *
166 */
167 public GMMethod getGMMethod() {
168 return gmMethod;
169 }
170
171 /**
172 * Sets the value of the gmMethod property.
173 *
174 * @param value
175 * allowed object is
176 * {@link GMMethod }
177 *
178 */
179 public void setGMMethod(GMMethod value) {
180 this.gmMethod = value;
181 }
182
183 /**
184 * Gets the value of the name property.
185 *
186 * <p>This accessor method returns a reference to the live list,
187 * not a snapshot. Therefore any modification you make to the
188 * returned list will be present inside the JAXB object.
189 * This is why there is not a <CODE>set</CODE> method for the name property.</p>
190 *
191 * <p>
192 * For example, to add a new item, do as follows:
193 * </p>
194 * <pre>
195 * getName().add(newItem);
196 * </pre>
197 *
198 *
199 * <p>
200 * Objects of the following type(s) are allowed in the list
201 * {@link String }
202 * </p>
203 *
204 *
205 * @return
206 * The value of the name property.
207 */
208 public List<String> getName() {
209 if (name == null) {
210 name = new ArrayList<>();
211 }
212 return this.name;
213 }
214
215}
diff --git a/service/src/main/java/market/guess/service/model/v1/GMEvents.java b/service/src/main/java/market/guess/service/model/v1/GMEvents.java
deleted file mode 100644
index ca4efea..0000000
--- a/service/src/main/java/market/guess/service/model/v1/GMEvents.java
+++ /dev/null
@@ -1,80 +0,0 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7
8package market.guess.service.model.v1;
9
10import java.util.ArrayList;
11import java.util.List;
12import jakarta.xml.bind.annotation.XmlAccessType;
13import jakarta.xml.bind.annotation.XmlAccessorType;
14import jakarta.xml.bind.annotation.XmlElement;
15import jakarta.xml.bind.annotation.XmlRootElement;
16import jakarta.xml.bind.annotation.XmlType;
17
18
19/**
20 * <p>Java class for anonymous complex type</p>.
21 *
22 * <p>The following schema fragment specifies the expected content contained within this class.</p>
23 *
24 * <pre>{@code
25 * <complexType>
26 * <complexContent>
27 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
28 * <sequence>
29 * <element ref="{}GM-event" maxOccurs="unbounded"/>
30 * </sequence>
31 * </restriction>
32 * </complexContent>
33 * </complexType>
34 * }</pre>
35 *
36 *
37 */
38@XmlAccessorType(XmlAccessType.FIELD)
39@XmlType(name = "", propOrder = {
40 "gmEvent"
41})
42@XmlRootElement(name = "GM-events")
43public class GMEvents {
44
45 @XmlElement(name = "GM-event", required = true)
46 protected List<GMEvent> gmEvent;
47
48 /**
49 * Gets the value of the gmEvent property.
50 *
51 * <p>This accessor method returns a reference to the live list,
52 * not a snapshot. Therefore any modification you make to the
53 * returned list will be present inside the JAXB object.
54 * This is why there is not a <CODE>set</CODE> method for the gmEvent property.</p>
55 *
56 * <p>
57 * For example, to add a new item, do as follows:
58 * </p>
59 * <pre>
60 * getGMEvent().add(newItem);
61 * </pre>
62 *
63 *
64 * <p>
65 * Objects of the following type(s) are allowed in the list
66 * {@link GMEvent }
67 * </p>
68 *
69 *
70 * @return
71 * The value of the gmEvent property.
72 */
73 public List<GMEvent> getGMEvent() {
74 if (gmEvent == null) {
75 gmEvent = new ArrayList<>();
76 }
77 return this.gmEvent;
78 }
79
80}
diff --git a/service/src/main/java/market/guess/service/model/v1/GMOptions.java b/service/src/main/java/market/guess/service/model/v1/GMOptions.java
deleted file mode 100644
index d344f74..0000000
--- a/service/src/main/java/market/guess/service/model/v1/GMOptions.java
+++ /dev/null
@@ -1,80 +0,0 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7
8package market.guess.service.model.v1;
9
10import java.util.ArrayList;
11import java.util.List;
12import jakarta.xml.bind.annotation.XmlAccessType;
13import jakarta.xml.bind.annotation.XmlAccessorType;
14import jakarta.xml.bind.annotation.XmlElement;
15import jakarta.xml.bind.annotation.XmlRootElement;
16import jakarta.xml.bind.annotation.XmlType;
17
18
19/**
20 * <p>Java class for anonymous complex type</p>.
21 *
22 * <p>The following schema fragment specifies the expected content contained within this class.</p>
23 *
24 * <pre>{@code
25 * <complexType>
26 * <complexContent>
27 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
28 * <sequence>
29 * <element ref="{}GM-option" maxOccurs="2"/>
30 * </sequence>
31 * </restriction>
32 * </complexContent>
33 * </complexType>
34 * }</pre>
35 *
36 *
37 */
38@XmlAccessorType(XmlAccessType.FIELD)
39@XmlType(name = "", propOrder = {
40 "gmOption"
41})
42@XmlRootElement(name = "GM-options")
43public class GMOptions {
44
45 @XmlElement(name = "GM-option", required = true)
46 protected List<String> gmOption;
47
48 /**
49 * Gets the value of the gmOption property.
50 *
51 * <p>This accessor method returns a reference to the live list,
52 * not a snapshot. Therefore any modification you make to the
53 * returned list will be present inside the JAXB object.
54 * This is why there is not a <CODE>set</CODE> method for the gmOption property.</p>
55 *
56 * <p>
57 * For example, to add a new item, do as follows:
58 * </p>
59 * <pre>
60 * getGMOption().add(newItem);
61 * </pre>
62 *
63 *
64 * <p>
65 * Objects of the following type(s) are allowed in the list
66 * {@link String }
67 * </p>
68 *
69 *
70 * @return
71 * The value of the gmOption property.
72 */
73 public List<String> getGMOption() {
74 if (gmOption == null) {
75 gmOption = new ArrayList<>();
76 }
77 return this.gmOption;
78 }
79
80}
diff --git a/service/src/main/java/market/guess/service/model/v1/ObjectFactory.java b/service/src/main/java/market/guess/service/model/v1/ObjectFactory.java
deleted file mode 100644
index cd43428..0000000
--- a/service/src/main/java/market/guess/service/model/v1/ObjectFactory.java
+++ /dev/null
@@ -1,167 +0,0 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7
8package market.guess.service.model.v1;
9
10import javax.xml.namespace.QName;
11import jakarta.xml.bind.JAXBElement;
12import jakarta.xml.bind.annotation.XmlElementDecl;
13import jakarta.xml.bind.annotation.XmlRegistry;
14
15
16/**
17 * This object contains factory methods for each
18 * Java content interface and Java element interface
19 * generated in the market.guess.service.model.v1 package.
20 * <p>An ObjectFactory allows you to programmatically
21 * construct new instances of the Java representation
22 * for XML content. The Java representation of XML
23 * content can consist of schema derived interfaces
24 * and classes representing the binding of schema
25 * type definitions, element declarations and model
26 * groups. Factory methods for each of these are
27 * provided in this class.
28 *
29 */
30@XmlRegistry
31public class ObjectFactory {
32
33 private static final QName _Id_QNAME = new QName("", "id");
34 private static final QName _Description_QNAME = new QName("", "description");
35 private static final QName _B_QNAME = new QName("", "b");
36 private static final QName _GMOption_QNAME = new QName("", "GM-option");
37
38 /**
39 * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: market.guess.service.model.v1
40 *
41 */
42 public ObjectFactory() {
43 }
44
45 /**
46 * Create an instance of {@link Comision }
47 *
48 * @return
49 * the new instance of {@link Comision }
50 */
51 public Comision createComision() {
52 return new Comision();
53 }
54
55 /**
56 * Create an instance of {@link GuessMarket }
57 *
58 * @return
59 * the new instance of {@link GuessMarket }
60 */
61 public GuessMarket createGuessMarket() {
62 return new GuessMarket();
63 }
64
65 /**
66 * Create an instance of {@link GMEvents }
67 *
68 * @return
69 * the new instance of {@link GMEvents }
70 */
71 public GMEvents createGMEvents() {
72 return new GMEvents();
73 }
74
75 /**
76 * Create an instance of {@link GMEvent }
77 *
78 * @return
79 * the new instance of {@link GMEvent }
80 */
81 public GMEvent createGMEvent() {
82 return new GMEvent();
83 }
84
85 /**
86 * Create an instance of {@link GMOptions }
87 *
88 * @return
89 * the new instance of {@link GMOptions }
90 */
91 public GMOptions createGMOptions() {
92 return new GMOptions();
93 }
94
95 /**
96 * Create an instance of {@link GMMethod }
97 *
98 * @return
99 * the new instance of {@link GMMethod }
100 */
101 public GMMethod createGMMethod() {
102 return new GMMethod();
103 }
104
105 /**
106 * Create an instance of {@link GMLMSR }
107 *
108 * @return
109 * the new instance of {@link GMLMSR }
110 */
111 public GMLMSR createGMLMSR() {
112 return new GMLMSR();
113 }
114
115 /**
116 * Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
117 *
118 * @param value
119 * Java instance representing xml element's value.
120 * @return
121 * the new instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
122 */
123 @XmlElementDecl(namespace = "", name = "id")
124 public JAXBElement<Integer> createId(Integer value) {
125 return new JAXBElement<>(_Id_QNAME, Integer.class, null, value);
126 }
127
128 /**
129 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
130 *
131 * @param value
132 * Java instance representing xml element's value.
133 * @return
134 * the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
135 */
136 @XmlElementDecl(namespace = "", name = "description")
137 public JAXBElement<String> createDescription(String value) {
138 return new JAXBElement<>(_Description_QNAME, String.class, null, value);
139 }
140
141 /**
142 * Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
143 *
144 * @param value
145 * Java instance representing xml element's value.
146 * @return
147 * the new instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
148 */
149 @XmlElementDecl(namespace = "", name = "b")
150 public JAXBElement<Integer> createB(Integer value) {
151 return new JAXBElement<>(_B_QNAME, Integer.class, null, value);
152 }
153
154 /**
155 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
156 *
157 * @param value
158 * Java instance representing xml element's value.
159 * @return
160 * the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
161 */
162 @XmlElementDecl(namespace = "", name = "GM-option")
163 public JAXBElement<String> createGMOption(String value) {
164 return new JAXBElement<>(_GMOption_QNAME, String.class, null, value);
165 }
166
167}
diff --git a/service/src/main/java/market/guess/service/model/v2/GMEvent.java b/service/src/main/java/market/guess/service/model/v2/GMEvent.java
deleted file mode 100644
index c011c32..0000000
--- a/service/src/main/java/market/guess/service/model/v2/GMEvent.java
+++ /dev/null
@@ -1,201 +0,0 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7
8package market.guess.service.model.v2;
9
10import jakarta.xml.bind.annotation.XmlAccessType;
11import jakarta.xml.bind.annotation.XmlAccessorType;
12import jakarta.xml.bind.annotation.XmlAttribute;
13import jakarta.xml.bind.annotation.XmlElement;
14import jakarta.xml.bind.annotation.XmlRootElement;
15import jakarta.xml.bind.annotation.XmlType;
16
17
18/**
19 * <p>Java class for anonymous complex type</p>.
20 *
21 * <p>The following schema fragment specifies the expected content contained within this class.</p>
22 *
23 * <pre>{@code
24 * <complexType>
25 * <complexContent>
26 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
27 * <sequence>
28 * <element ref="{}id"/>
29 * <element ref="{}description"/>
30 * <element ref="{}commission"/>
31 * <element ref="{}GM-options"/>
32 * <element ref="{}GM-method"/>
33 * </sequence>
34 * <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
35 * </restriction>
36 * </complexContent>
37 * </complexType>
38 * }</pre>
39 *
40 *
41 */
42@XmlAccessorType(XmlAccessType.FIELD)
43@XmlType(name = "", propOrder = {
44 "id",
45 "description",
46 "commission",
47 "gmOptions",
48 "gmMethod"
49})
50@XmlRootElement(name = "GM-event")
51public class GMEvent {
52
53 protected int id;
54 @XmlElement(required = true)
55 protected String description;
56 @XmlElement(required = true)
57 protected Commission commission;
58 @XmlElement(name = "GM-options", required = true)
59 protected GMOptions gmOptions;
60 @XmlElement(name = "GM-method", required = true)
61 protected GMMethod gmMethod;
62 @XmlAttribute(name = "name", required = true)
63 protected String name;
64
65 /**
66 * Gets the value of the id property.
67 *
68 */
69 public int getId() {
70 return id;
71 }
72
73 /**
74 * Sets the value of the id property.
75 *
76 */
77 public void setId(int value) {
78 this.id = value;
79 }
80
81 /**
82 * Gets the value of the description property.
83 *
84 * @return
85 * possible object is
86 * {@link String }
87 *
88 */
89 public String getDescription() {
90 return description;
91 }
92
93 /**
94 * Sets the value of the description property.
95 *
96 * @param value
97 * allowed object is
98 * {@link String }
99 *
100 */
101 public void setDescription(String value) {
102 this.description = value;
103 }
104
105 /**
106 * Gets the value of the commission property.
107 *
108 * @return
109 * possible object is
110 * {@link Commission }
111 *
112 */
113 public Commission getCommission() {
114 return commission;
115 }
116
117 /**
118 * Sets the value of the commission property.
119 *
120 * @param value
121 * allowed object is
122 * {@link Commission }
123 *
124 */
125 public void setCommission(Commission value) {
126 this.commission = value;
127 }
128
129 /**
130 * Gets the value of the gmOptions property.
131 *
132 * @return
133 * possible object is
134 * {@link GMOptions }
135 *
136 */
137 public GMOptions getGMOptions() {
138 return gmOptions;
139 }
140
141 /**
142 * Sets the value of the gmOptions property.
143 *
144 * @param value
145 * allowed object is
146 * {@link GMOptions }
147 *
148 */
149 public void setGMOptions(GMOptions value) {
150 this.gmOptions = value;
151 }
152
153 /**
154 * Gets the value of the gmMethod property.
155 *
156 * @return
157 * possible object is
158 * {@link GMMethod }
159 *
160 */
161 public GMMethod getGMMethod() {
162 return gmMethod;
163 }
164
165 /**
166 * Sets the value of the gmMethod property.
167 *
168 * @param value
169 * allowed object is
170 * {@link GMMethod }
171 *
172 */
173 public void setGMMethod(GMMethod value) {
174 this.gmMethod = value;
175 }
176
177 /**
178 * Gets the value of the name property.
179 *
180 * @return
181 * possible object is
182 * {@link String }
183 *
184 */
185 public String getName() {
186 return name;
187 }
188
189 /**
190 * Sets the value of the name property.
191 *
192 * @param value
193 * allowed object is
194 * {@link String }
195 *
196 */
197 public void setName(String value) {
198 this.name = value;
199 }
200
201}
diff --git a/service/src/main/java/market/guess/service/model/v2/GMEvents.java b/service/src/main/java/market/guess/service/model/v2/GMEvents.java
deleted file mode 100644
index 61a5473..0000000
--- a/service/src/main/java/market/guess/service/model/v2/GMEvents.java
+++ /dev/null
@@ -1,80 +0,0 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7
8package market.guess.service.model.v2;
9
10import java.util.ArrayList;
11import java.util.List;
12import jakarta.xml.bind.annotation.XmlAccessType;
13import jakarta.xml.bind.annotation.XmlAccessorType;
14import jakarta.xml.bind.annotation.XmlElement;
15import jakarta.xml.bind.annotation.XmlRootElement;
16import jakarta.xml.bind.annotation.XmlType;
17
18
19/**
20 * <p>Java class for anonymous complex type</p>.
21 *
22 * <p>The following schema fragment specifies the expected content contained within this class.</p>
23 *
24 * <pre>{@code
25 * <complexType>
26 * <complexContent>
27 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
28 * <sequence>
29 * <element ref="{}GM-event" maxOccurs="unbounded"/>
30 * </sequence>
31 * </restriction>
32 * </complexContent>
33 * </complexType>
34 * }</pre>
35 *
36 *
37 */
38@XmlAccessorType(XmlAccessType.FIELD)
39@XmlType(name = "", propOrder = {
40 "gmEvent"
41})
42@XmlRootElement(name = "GM-events")
43public class GMEvents {
44
45 @XmlElement(name = "GM-event", required = true)
46 protected List<GMEvent> gmEvent;
47
48 /**
49 * Gets the value of the gmEvent property.
50 *
51 * <p>This accessor method returns a reference to the live list,
52 * not a snapshot. Therefore any modification you make to the
53 * returned list will be present inside the JAXB object.
54 * This is why there is not a <CODE>set</CODE> method for the gmEvent property.</p>
55 *
56 * <p>
57 * For example, to add a new item, do as follows:
58 * </p>
59 * <pre>
60 * getGMEvent().add(newItem);
61 * </pre>
62 *
63 *
64 * <p>
65 * Objects of the following type(s) are allowed in the list
66 * {@link GMEvent }
67 * </p>
68 *
69 *
70 * @return
71 * The value of the gmEvent property.
72 */
73 public List<GMEvent> getGMEvent() {
74 if (gmEvent == null) {
75 gmEvent = new ArrayList<>();
76 }
77 return this.gmEvent;
78 }
79
80}
diff --git a/service/src/main/java/market/guess/service/model/v2/GMMarketMaker.java b/service/src/main/java/market/guess/service/model/v2/GMMarketMaker.java
deleted file mode 100644
index 2eb0e6e..0000000
--- a/service/src/main/java/market/guess/service/model/v2/GMMarketMaker.java
+++ /dev/null
@@ -1,80 +0,0 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7
8package market.guess.service.model.v2;
9
10import java.util.ArrayList;
11import java.util.List;
12import jakarta.xml.bind.annotation.XmlAccessType;
13import jakarta.xml.bind.annotation.XmlAccessorType;
14import jakarta.xml.bind.annotation.XmlElement;
15import jakarta.xml.bind.annotation.XmlRootElement;
16import jakarta.xml.bind.annotation.XmlType;
17
18
19/**
20 * <p>Java class for anonymous complex type</p>.
21 *
22 * <p>The following schema fragment specifies the expected content contained within this class.</p>
23 *
24 * <pre>{@code
25 * <complexType>
26 * <complexContent>
27 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
28 * <sequence>
29 * <element ref="{}event" maxOccurs="unbounded"/>
30 * </sequence>
31 * </restriction>
32 * </complexContent>
33 * </complexType>
34 * }</pre>
35 *
36 *
37 */
38@XmlAccessorType(XmlAccessType.FIELD)
39@XmlType(name = "", propOrder = {
40 "event"
41})
42@XmlRootElement(name = "GM-market-maker")
43public class GMMarketMaker {
44
45 @XmlElement(required = true)
46 protected List<Event> event;
47
48 /**
49 * Gets the value of the event property.
50 *
51 * <p>This accessor method returns a reference to the live list,
52 * not a snapshot. Therefore any modification you make to the
53 * returned list will be present inside the JAXB object.
54 * This is why there is not a <CODE>set</CODE> method for the event property.</p>
55 *
56 * <p>
57 * For example, to add a new item, do as follows:
58 * </p>
59 * <pre>
60 * getEvent().add(newItem);
61 * </pre>
62 *
63 *
64 * <p>
65 * Objects of the following type(s) are allowed in the list
66 * {@link Event }
67 * </p>
68 *
69 *
70 * @return
71 * The value of the event property.
72 */
73 public List<Event> getEvent() {
74 if (event == null) {
75 event = new ArrayList<>();
76 }
77 return this.event;
78 }
79
80}
diff --git a/service/src/main/java/market/guess/service/model/v2/GMMethod.java b/service/src/main/java/market/guess/service/model/v2/GMMethod.java
deleted file mode 100644
index 06338c0..0000000
--- a/service/src/main/java/market/guess/service/model/v2/GMMethod.java
+++ /dev/null
@@ -1,98 +0,0 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7
8package market.guess.service.model.v2;
9
10import jakarta.xml.bind.annotation.XmlAccessType;
11import jakarta.xml.bind.annotation.XmlAccessorType;
12import jakarta.xml.bind.annotation.XmlElement;
13import jakarta.xml.bind.annotation.XmlRootElement;
14import jakarta.xml.bind.annotation.XmlType;
15
16
17/**
18 * <p>Java class for anonymous complex type</p>.
19 *
20 * <p>The following schema fragment specifies the expected content contained within this class.</p>
21 *
22 * <pre>{@code
23 * <complexType>
24 * <complexContent>
25 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
26 * <choice>
27 * <element ref="{}GM-LMSR"/>
28 * <element ref="{}GM-order-book"/>
29 * </choice>
30 * </restriction>
31 * </complexContent>
32 * </complexType>
33 * }</pre>
34 *
35 *
36 */
37@XmlAccessorType(XmlAccessType.FIELD)
38@XmlType(name = "", propOrder = {
39 "gmlmsr",
40 "gmOrderBook"
41})
42@XmlRootElement(name = "GM-method")
43public class GMMethod {
44
45 @XmlElement(name = "GM-LMSR")
46 protected GMLMSR gmlmsr;
47 @XmlElement(name = "GM-order-book")
48 protected GMOrderBook gmOrderBook;
49
50 /**
51 * Gets the value of the gmlmsr property.
52 *
53 * @return
54 * possible object is
55 * {@link GMLMSR }
56 *
57 */
58 public GMLMSR getGMLMSR() {
59 return gmlmsr;
60 }
61
62 /**
63 * Sets the value of the gmlmsr property.
64 *
65 * @param value
66 * allowed object is
67 * {@link GMLMSR }
68 *
69 */
70 public void setGMLMSR(GMLMSR value) {
71 this.gmlmsr = value;
72 }
73
74 /**
75 * Gets the value of the gmOrderBook property.
76 *
77 * @return
78 * possible object is
79 * {@link GMOrderBook }
80 *
81 */
82 public GMOrderBook getGMOrderBook() {
83 return gmOrderBook;
84 }
85
86 /**
87 * Sets the value of the gmOrderBook property.
88 *
89 * @param value
90 * allowed object is
91 * {@link GMOrderBook }
92 *
93 */
94 public void setGMOrderBook(GMOrderBook value) {
95 this.gmOrderBook = value;
96 }
97
98}
diff --git a/service/src/main/java/market/guess/service/model/v2/GMOptions.java b/service/src/main/java/market/guess/service/model/v2/GMOptions.java
deleted file mode 100644
index a819656..0000000
--- a/service/src/main/java/market/guess/service/model/v2/GMOptions.java
+++ /dev/null
@@ -1,80 +0,0 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7
8package market.guess.service.model.v2;
9
10import java.util.ArrayList;
11import java.util.List;
12import jakarta.xml.bind.annotation.XmlAccessType;
13import jakarta.xml.bind.annotation.XmlAccessorType;
14import jakarta.xml.bind.annotation.XmlElement;
15import jakarta.xml.bind.annotation.XmlRootElement;
16import jakarta.xml.bind.annotation.XmlType;
17
18
19/**
20 * <p>Java class for anonymous complex type</p>.
21 *
22 * <p>The following schema fragment specifies the expected content contained within this class.</p>
23 *
24 * <pre>{@code
25 * <complexType>
26 * <complexContent>
27 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
28 * <sequence>
29 * <element ref="{}GM-option" maxOccurs="2"/>
30 * </sequence>
31 * </restriction>
32 * </complexContent>
33 * </complexType>
34 * }</pre>
35 *
36 *
37 */
38@XmlAccessorType(XmlAccessType.FIELD)
39@XmlType(name = "", propOrder = {
40 "gmOption"
41})
42@XmlRootElement(name = "GM-options")
43public class GMOptions {
44
45 @XmlElement(name = "GM-option", required = true)
46 protected List<String> gmOption;
47
48 /**
49 * Gets the value of the gmOption property.
50 *
51 * <p>This accessor method returns a reference to the live list,
52 * not a snapshot. Therefore any modification you make to the
53 * returned list will be present inside the JAXB object.
54 * This is why there is not a <CODE>set</CODE> method for the gmOption property.</p>
55 *
56 * <p>
57 * For example, to add a new item, do as follows:
58 * </p>
59 * <pre>
60 * getGMOption().add(newItem);
61 * </pre>
62 *
63 *
64 * <p>
65 * Objects of the following type(s) are allowed in the list
66 * {@link String }
67 * </p>
68 *
69 *
70 * @return
71 * The value of the gmOption property.
72 */
73 public List<String> getGMOption() {
74 if (gmOption == null) {
75 gmOption = new ArrayList<>();
76 }
77 return this.gmOption;
78 }
79
80}
diff --git a/service/src/main/java/market/guess/service/model/v2/GMOrderBook.java b/service/src/main/java/market/guess/service/model/v2/GMOrderBook.java
deleted file mode 100644
index f38c707..0000000
--- a/service/src/main/java/market/guess/service/model/v2/GMOrderBook.java
+++ /dev/null
@@ -1,111 +0,0 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7
8package market.guess.service.model.v2;
9
10import jakarta.xml.bind.annotation.XmlAccessType;
11import jakarta.xml.bind.annotation.XmlAccessorType;
12import jakarta.xml.bind.annotation.XmlAttribute;
13import jakarta.xml.bind.annotation.XmlRootElement;
14import jakarta.xml.bind.annotation.XmlType;
15
16
17/**
18 * <p>Java class for anonymous complex type</p>.
19 *
20 * <p>The following schema fragment specifies the expected content contained within this class.</p>
21 *
22 * <pre>{@code
23 * <complexType>
24 * <complexContent>
25 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
26 * <attribute name="initial" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
27 * <attribute name="d" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
28 * <attribute name="allow-mint" use="required">
29 * <simpleType>
30 * <restriction base="{http://www.w3.org/2001/XMLSchema}string">
31 * <enumeration value="false"/>
32 * <enumeration value="true"/>
33 * </restriction>
34 * </simpleType>
35 * </attribute>
36 * </restriction>
37 * </complexContent>
38 * </complexType>
39 * }</pre>
40 *
41 *
42 */
43@XmlAccessorType(XmlAccessType.FIELD)
44@XmlType(name = "")
45@XmlRootElement(name = "GM-order-book")
46public class GMOrderBook {
47
48 @XmlAttribute(name = "initial", required = true)
49 protected int initial;
50 @XmlAttribute(name = "d", required = true)
51 protected int d;
52 @XmlAttribute(name = "allow-mint", required = true)
53 protected String allowMint;
54
55 /**
56 * Gets the value of the initial property.
57 *
58 */
59 public int getInitial() {
60 return initial;
61 }
62
63 /**
64 * Sets the value of the initial property.
65 *
66 */
67 public void setInitial(int value) {
68 this.initial = value;
69 }
70
71 /**
72 * Gets the value of the d property.
73 *
74 */
75 public int getD() {
76 return d;
77 }
78
79 /**
80 * Sets the value of the d property.
81 *
82 */
83 public void setD(int value) {
84 this.d = value;
85 }
86
87 /**
88 * Gets the value of the allowMint property.
89 *
90 * @return
91 * possible object is
92 * {@link String }
93 *
94 */
95 public String getAllowMint() {
96 return allowMint;
97 }
98
99 /**
100 * Sets the value of the allowMint property.
101 *
102 * @param value
103 * allowed object is
104 * {@link String }
105 *
106 */
107 public void setAllowMint(String value) {
108 this.allowMint = value;
109 }
110
111}
diff --git a/service/src/main/java/market/guess/service/model/v2/GMUser.java b/service/src/main/java/market/guess/service/model/v2/GMUser.java
deleted file mode 100644
index 85b41f4..0000000
--- a/service/src/main/java/market/guess/service/model/v2/GMUser.java
+++ /dev/null
@@ -1,118 +0,0 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7
8package market.guess.service.model.v2;
9
10import jakarta.xml.bind.annotation.XmlAccessType;
11import jakarta.xml.bind.annotation.XmlAccessorType;
12import jakarta.xml.bind.annotation.XmlAttribute;
13import jakarta.xml.bind.annotation.XmlElement;
14import jakarta.xml.bind.annotation.XmlRootElement;
15import jakarta.xml.bind.annotation.XmlType;
16
17
18/**
19 * <p>Java class for anonymous complex type</p>.
20 *
21 * <p>The following schema fragment specifies the expected content contained within this class.</p>
22 *
23 * <pre>{@code
24 * <complexType>
25 * <complexContent>
26 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
27 * <sequence>
28 * <element ref="{}initial-cash"/>
29 * <element ref="{}GM-market-maker" minOccurs="0"/>
30 * </sequence>
31 * <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
32 * </restriction>
33 * </complexContent>
34 * </complexType>
35 * }</pre>
36 *
37 *
38 */
39@XmlAccessorType(XmlAccessType.FIELD)
40@XmlType(name = "", propOrder = {
41 "initialCash",
42 "gmMarketMaker"
43})
44@XmlRootElement(name = "GM-user")
45public class GMUser {
46
47 @XmlElement(name = "initial-cash")
48 protected int initialCash;
49 @XmlElement(name = "GM-market-maker")
50 protected GMMarketMaker gmMarketMaker;
51 @XmlAttribute(name = "name", required = true)
52 protected String name;
53
54 /**
55 * Gets the value of the initialCash property.
56 *
57 */
58 public int getInitialCash() {
59 return initialCash;
60 }
61
62 /**
63 * Sets the value of the initialCash property.
64 *
65 */
66 public void setInitialCash(int value) {
67 this.initialCash = value;
68 }
69
70 /**
71 * Gets the value of the gmMarketMaker property.
72 *
73 * @return
74 * possible object is
75 * {@link GMMarketMaker }
76 *
77 */
78 public GMMarketMaker getGMMarketMaker() {
79 return gmMarketMaker;
80 }
81
82 /**
83 * Sets the value of the gmMarketMaker property.
84 *
85 * @param value
86 * allowed object is
87 * {@link GMMarketMaker }
88 *
89 */
90 public void setGMMarketMaker(GMMarketMaker value) {
91 this.gmMarketMaker = value;
92 }
93
94 /**
95 * Gets the value of the name property.
96 *
97 * @return
98 * possible object is
99 * {@link String }
100 *
101 */
102 public String getName() {
103 return name;
104 }
105
106 /**
107 * Sets the value of the name property.
108 *
109 * @param value
110 * allowed object is
111 * {@link String }
112 *
113 */
114 public void setName(String value) {
115 this.name = value;
116 }
117
118}
diff --git a/service/src/main/java/market/guess/service/model/v2/GMUsers.java b/service/src/main/java/market/guess/service/model/v2/GMUsers.java
deleted file mode 100644
index cfebbc4..0000000
--- a/service/src/main/java/market/guess/service/model/v2/GMUsers.java
+++ /dev/null
@@ -1,80 +0,0 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7
8package market.guess.service.model.v2;
9
10import java.util.ArrayList;
11import java.util.List;
12import jakarta.xml.bind.annotation.XmlAccessType;
13import jakarta.xml.bind.annotation.XmlAccessorType;
14import jakarta.xml.bind.annotation.XmlElement;
15import jakarta.xml.bind.annotation.XmlRootElement;
16import jakarta.xml.bind.annotation.XmlType;
17
18
19/**
20 * <p>Java class for anonymous complex type</p>.
21 *
22 * <p>The following schema fragment specifies the expected content contained within this class.</p>
23 *
24 * <pre>{@code
25 * <complexType>
26 * <complexContent>
27 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
28 * <sequence>
29 * <element ref="{}GM-user" maxOccurs="unbounded"/>
30 * </sequence>
31 * </restriction>
32 * </complexContent>
33 * </complexType>
34 * }</pre>
35 *
36 *
37 */
38@XmlAccessorType(XmlAccessType.FIELD)
39@XmlType(name = "", propOrder = {
40 "gmUser"
41})
42@XmlRootElement(name = "GM-users")
43public class GMUsers {
44
45 @XmlElement(name = "GM-user", required = true)
46 protected List<GMUser> gmUser;
47
48 /**
49 * Gets the value of the gmUser property.
50 *
51 * <p>This accessor method returns a reference to the live list,
52 * not a snapshot. Therefore any modification you make to the
53 * returned list will be present inside the JAXB object.
54 * This is why there is not a <CODE>set</CODE> method for the gmUser property.</p>
55 *
56 * <p>
57 * For example, to add a new item, do as follows:
58 * </p>
59 * <pre>
60 * getGMUser().add(newItem);
61 * </pre>
62 *
63 *
64 * <p>
65 * Objects of the following type(s) are allowed in the list
66 * {@link GMUser }
67 * </p>
68 *
69 *
70 * @return
71 * The value of the gmUser property.
72 */
73 public List<GMUser> getGMUser() {
74 if (gmUser == null) {
75 gmUser = new ArrayList<>();
76 }
77 return this.gmUser;
78 }
79
80}
diff --git a/service/src/main/java/market/guess/service/model/v2/GuessMarket.java b/service/src/main/java/market/guess/service/model/v2/GuessMarket.java
deleted file mode 100644
index 1ce28c8..0000000
--- a/service/src/main/java/market/guess/service/model/v2/GuessMarket.java
+++ /dev/null
@@ -1,97 +0,0 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7
8package market.guess.service.model.v2;
9
10import jakarta.xml.bind.annotation.XmlAccessType;
11import jakarta.xml.bind.annotation.XmlAccessorType;
12import jakarta.xml.bind.annotation.XmlElement;
13import jakarta.xml.bind.annotation.XmlRootElement;
14import jakarta.xml.bind.annotation.XmlType;
15
16
17/**
18 * <p>Java class for anonymous complex type</p>.
19 *
20 * <p>The following schema fragment specifies the expected content contained within this class.</p>
21 *
22 * <pre>{@code
23 * <complexType>
24 * <complexContent>
25 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
26 * <all>
27 * <element ref="{}GM-events"/>
28 * <element ref="{}GM-users"/>
29 * </all>
30 * </restriction>
31 * </complexContent>
32 * </complexType>
33 * }</pre>
34 *
35 *
36 */
37@XmlAccessorType(XmlAccessType.FIELD)
38@XmlType(name = "", propOrder = {
39
40})
41@XmlRootElement(name = "Guess-Market")
42public class GuessMarket {
43
44 @XmlElement(name = "GM-events", required = true)
45 protected GMEvents gmEvents;
46 @XmlElement(name = "GM-users", required = true)
47 protected GMUsers gmUsers;
48
49 /**
50 * Gets the value of the gmEvents property.
51 *
52 * @return
53 * possible object is
54 * {@link GMEvents }
55 *
56 */
57 public GMEvents getGMEvents() {
58 return gmEvents;
59 }
60
61 /**
62 * Sets the value of the gmEvents property.
63 *
64 * @param value
65 * allowed object is
66 * {@link GMEvents }
67 *
68 */
69 public void setGMEvents(GMEvents value) {
70 this.gmEvents = value;
71 }
72
73 /**
74 * Gets the value of the gmUsers property.
75 *
76 * @return
77 * possible object is
78 * {@link GMUsers }
79 *
80 */
81 public GMUsers getGMUsers() {
82 return gmUsers;
83 }
84
85 /**
86 * Sets the value of the gmUsers property.
87 *
88 * @param value
89 * allowed object is
90 * {@link GMUsers }
91 *
92 */
93 public void setGMUsers(GMUsers value) {
94 this.gmUsers = value;
95 }
96
97}
diff --git a/service/src/main/java/market/guess/service/model/v2/ObjectFactory.java b/service/src/main/java/market/guess/service/model/v2/ObjectFactory.java
deleted file mode 100644
index 7f0fff9..0000000
--- a/service/src/main/java/market/guess/service/model/v2/ObjectFactory.java
+++ /dev/null
@@ -1,231 +0,0 @@
1//
2// This file was generated by the Eclipse Implementation of JAXB, v4.0.5
3// See https://eclipse-ee4j.github.io/jaxb-ri
4// Any modifications to this file will be lost upon recompilation of the source schema.
5//
6
7
8package market.guess.service.model.v2;
9
10import javax.xml.namespace.QName;
11import jakarta.xml.bind.JAXBElement;
12import jakarta.xml.bind.annotation.XmlElementDecl;
13import jakarta.xml.bind.annotation.XmlRegistry;
14
15
16/**
17 * This object contains factory methods for each
18 * Java content interface and Java element interface
19 * generated in the market.guess.service.model.v2 package.
20 * <p>An ObjectFactory allows you to programmatically
21 * construct new instances of the Java representation
22 * for XML content. The Java representation of XML
23 * content can consist of schema derived interfaces
24 * and classes representing the binding of schema
25 * type definitions, element declarations and model
26 * groups. Factory methods for each of these are
27 * provided in this class.
28 *
29 */
30@XmlRegistry
31public class ObjectFactory {
32
33 private static final QName _InitialCash_QNAME = new QName("", "initial-cash");
34 private static final QName _Id_QNAME = new QName("", "id");
35 private static final QName _Description_QNAME = new QName("", "description");
36 private static final QName _B_QNAME = new QName("", "b");
37 private static final QName _GMOption_QNAME = new QName("", "GM-option");
38
39 /**
40 * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: market.guess.service.model.v2
41 *
42 */
43 public ObjectFactory() {
44 }
45
46 /**
47 * Create an instance of {@link Event }
48 *
49 * @return
50 * the new instance of {@link Event }
51 */
52 public Event createEvent() {
53 return new Event();
54 }
55
56 /**
57 * Create an instance of {@link Commission }
58 *
59 * @return
60 * the new instance of {@link Commission }
61 */
62 public Commission createCommission() {
63 return new Commission();
64 }
65
66 /**
67 * Create an instance of {@link GuessMarket }
68 *
69 * @return
70 * the new instance of {@link GuessMarket }
71 */
72 public GuessMarket createGuessMarket() {
73 return new GuessMarket();
74 }
75
76 /**
77 * Create an instance of {@link GMEvents }
78 *
79 * @return
80 * the new instance of {@link GMEvents }
81 */
82 public GMEvents createGMEvents() {
83 return new GMEvents();
84 }
85
86 /**
87 * Create an instance of {@link GMEvent }
88 *
89 * @return
90 * the new instance of {@link GMEvent }
91 */
92 public GMEvent createGMEvent() {
93 return new GMEvent();
94 }
95
96 /**
97 * Create an instance of {@link GMOptions }
98 *
99 * @return
100 * the new instance of {@link GMOptions }
101 */
102 public GMOptions createGMOptions() {
103 return new GMOptions();
104 }
105
106 /**
107 * Create an instance of {@link GMMethod }
108 *
109 * @return
110 * the new instance of {@link GMMethod }
111 */
112 public GMMethod createGMMethod() {
113 return new GMMethod();
114 }
115
116 /**
117 * Create an instance of {@link GMLMSR }
118 *
119 * @return
120 * the new instance of {@link GMLMSR }
121 */
122 public GMLMSR createGMLMSR() {
123 return new GMLMSR();
124 }
125
126 /**
127 * Create an instance of {@link GMOrderBook }
128 *
129 * @return
130 * the new instance of {@link GMOrderBook }
131 */
132 public GMOrderBook createGMOrderBook() {
133 return new GMOrderBook();
134 }
135
136 /**
137 * Create an instance of {@link GMUsers }
138 *
139 * @return
140 * the new instance of {@link GMUsers }
141 */
142 public GMUsers createGMUsers() {
143 return new GMUsers();
144 }
145
146 /**
147 * Create an instance of {@link GMUser }
148 *
149 * @return
150 * the new instance of {@link GMUser }
151 */
152 public GMUser createGMUser() {
153 return new GMUser();
154 }
155
156 /**
157 * Create an instance of {@link GMMarketMaker }
158 *
159 * @return
160 * the new instance of {@link GMMarketMaker }
161 */
162 public GMMarketMaker createGMMarketMaker() {
163 return new GMMarketMaker();
164 }
165
166 /**
167 * Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
168 *
169 * @param value
170 * Java instance representing xml element's value.
171 * @return
172 * the new instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
173 */
174 @XmlElementDecl(namespace = "", name = "initial-cash")
175 public JAXBElement<Integer> createInitialCash(Integer value) {
176 return new JAXBElement<>(_InitialCash_QNAME, Integer.class, null, value);
177 }
178
179 /**
180 * Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
181 *
182 * @param value
183 * Java instance representing xml element's value.
184 * @return
185 * the new instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
186 */
187 @XmlElementDecl(namespace = "", name = "id")
188 public JAXBElement<Integer> createId(Integer value) {
189 return new JAXBElement<>(_Id_QNAME, Integer.class, null, value);
190 }
191
192 /**
193 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
194 *
195 * @param value
196 * Java instance representing xml element's value.
197 * @return
198 * the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
199 */
200 @XmlElementDecl(namespace = "", name = "description")
201 public JAXBElement<String> createDescription(String value) {
202 return new JAXBElement<>(_Description_QNAME, String.class, null, value);
203 }
204
205 /**
206 * Create an instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
207 *
208 * @param value
209 * Java instance representing xml element's value.
210 * @return
211 * the new instance of {@link JAXBElement }{@code <}{@link Integer }{@code >}
212 */
213 @XmlElementDecl(namespace = "", name = "b")
214 public JAXBElement<Integer> createB(Integer value) {
215 return new JAXBElement<>(_B_QNAME, Integer.class, null, value);
216 }
217
218 /**
219 * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}
220 *
221 * @param value
222 * Java instance representing xml element's value.
223 * @return
224 * the new instance of {@link JAXBElement }{@code <}{@link String }{@code >}
225 */
226 @XmlElementDecl(namespace = "", name = "GM-option")
227 public JAXBElement<String> createGMOption(String value) {
228 return new JAXBElement<>(_GMOption_QNAME, String.class, null, value);
229 }
230
231}
diff --git a/service/src/main/java/market/guess/service/risk/LocalRiskEngine.java b/service/src/main/java/market/guess/service/risk/LocalRiskEngine.java
new file mode 100644
index 0000000..d3e46e2
--- /dev/null
+++ b/service/src/main/java/market/guess/service/risk/LocalRiskEngine.java
@@ -0,0 +1,18 @@
1package market.guess.service.risk;
2
3import java.math.BigDecimal;
4import market.guess.api.Result;
5import market.guess.service.domain.Order;
6import market.guess.service.domain.User;
7
8public final class LocalRiskEngine implements RiskEngine {
9
10 @Override
11 public Result<Void> check(User user, Order order) {
12 var cost = order.price().multiply(BigDecimal.valueOf(order.quantity()));
13 if (user.getLedger().getBalance().compareTo(cost) < 0) {
14 return Result.error("Insufficient balance.");
15 }
16 return Result.ok();
17 }
18}
diff --git a/service/src/main/java/market/guess/service/risk/RiskEngine.java b/service/src/main/java/market/guess/service/risk/RiskEngine.java
new file mode 100644
index 0000000..3b71650
--- /dev/null
+++ b/service/src/main/java/market/guess/service/risk/RiskEngine.java
@@ -0,0 +1,9 @@
1package market.guess.service.risk;
2
3import market.guess.api.Result;
4import market.guess.service.domain.Order;
5import market.guess.service.domain.User;
6
7public interface RiskEngine {
8 Result<Void> check(User user, Order order);
9}
diff --git a/service/src/main/java/market/guess/service/settlement/LocalSettlementContext.java b/service/src/main/java/market/guess/service/settlement/LocalSettlementContext.java
new file mode 100644
index 0000000..118e349
--- /dev/null
+++ b/service/src/main/java/market/guess/service/settlement/LocalSettlementContext.java
@@ -0,0 +1,50 @@
1package market.guess.service.settlement;
2
3import java.math.BigDecimal;
4import java.util.HashMap;
5import market.guess.api.CommissionTiming;
6import market.guess.model.event.EventStatus;
7import market.guess.model.ledger.LedgerType;
8import market.guess.service.domain.Event;
9import market.guess.service.helpers.BigDecimalOptions;
10import market.guess.service.ledger.LedgerContext;
11
12public final class LocalSettlementContext implements SettlementContext {
13 private final LedgerContext ledger;
14
15 public LocalSettlementContext(LedgerContext ledger) {
16 this.ledger = ledger;
17 }
18
19 @Override
20 public BigDecimal settle(Event event, String winningOptionKey) {
21 event.setWinningOptionKey(winningOptionKey);
22
23 var chargeCommission = event.getCommissionTiming() == CommissionTiming.ON_CLOSE;
24 var rate = BigDecimal.valueOf(event.getCommissionPercent()).divide(BigDecimal.valueOf(100));
25 var winningOption = event.getOption(winningOptionKey);
26
27 var sharesByUser = new HashMap<String, Long>();
28 for (var trade : event.getTrades()) {
29 if (!trade.marketKey().equalsIgnoreCase(winningOptionKey)) continue;
30 sharesByUser.merge(trade.buyerUserName(), trade.quantity(), Long::sum);
31 }
32
33 var totalPayout = BigDecimalOptions.ZERO_MONEY;
34 for (var entry : sharesByUser.entrySet()) {
35 var gross = BigDecimalOptions.toMoney(BigDecimal.valueOf(entry.getValue()));
36 var commission =
37 chargeCommission
38 ? BigDecimalOptions.toMoney(gross.multiply(rate))
39 : BigDecimalOptions.ZERO_MONEY;
40 var net = gross.subtract(commission);
41
42 ledger.credit(entry.getKey(), LedgerType.PAYOUT, net, "Payout: " + winningOption.getName());
43 event.addSettlementCommission(commission);
44 totalPayout = totalPayout.add(net);
45 }
46
47 event.setState(EventStatus.SETTLED);
48 return totalPayout;
49 }
50}
diff --git a/service/src/main/java/market/guess/service/settlement/SettlementContext.java b/service/src/main/java/market/guess/service/settlement/SettlementContext.java
new file mode 100644
index 0000000..07b9cd0
--- /dev/null
+++ b/service/src/main/java/market/guess/service/settlement/SettlementContext.java
@@ -0,0 +1,8 @@
1package market.guess.service.settlement;
2
3import java.math.BigDecimal;
4import market.guess.service.domain.Event;
5
6public interface SettlementContext {
7 BigDecimal settle(Event event, String winningOptionKey);
8}