Class ExposureReservationService
java.lang.Object
edu.yu.marketmaker.exposurereservation.ExposureReservationService
Service responsible for managing exposure limits and reservations.
Handles the logic for creating reservations against available capacity,
applying fills to reduce open exposure, and releasing unused reservations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintApplies a fill to an active reservation.createReservation(Quote quote) Creates a new exposure reservation.Calculates the current system-wide exposure state.intReleases all remaining capacity for a specific reservation.
-
Constructor Details
-
ExposureReservationService
-
-
Method Details
-
createReservation
Creates a new exposure reservation. Checks current usage against limits and grants full, partial, or no capacity.- Parameters:
quote- The requested quote.- Returns:
- The response containing the reservation ID and the actual granted quantity.
-
applyFill
Applies a fill to an active reservation. When a trade executes, the reserved exposure is converted to actual position (not tracked here), so we free up the reserved capacity corresponding to the fill.- Parameters:
id- The UUID of the reservation.filledQty- The quantity that was filled.- Returns:
- The amount of capacity freed by this operation.
- Throws:
RuntimeException- if the reservation is not found.
-
release
Releases all remaining capacity for a specific reservation. This is typically called when a quote is cancelled.- Parameters:
id- The UUID of the reservation.- Returns:
- The total capacity freed.
- Throws:
RuntimeException- if the reservation is not found.
-
getExposureState
Calculates the current system-wide exposure state.- Returns:
- Snapshot of usage, capacity, and active count.
-