Class TradingStateService

java.lang.Object
edu.yu.marketmaker.state.TradingStateService

@RestController @Profile("trading-state") public class TradingStateService extends Object
Trading state service controls system-wide positions.
  • Constructor Details

  • Method Details

    • submitFillRSocket

      @MessageMapping("state.fills") public reactor.core.publisher.Mono<Void> submitFillRSocket(@Payload Fill fill)
      TCP/RSocket: submit a fill via request-response on route "state.fills".
      Parameters:
      fill - the fill to record
      Returns:
      Mono that completes empty on success, or errors on invalid input
    • getAllPositionsRSocket

      @MessageMapping("positions") public reactor.core.publisher.Flux<Position> getAllPositionsRSocket()
      TCP/RSocket: get all current positions via request-stream on route "positions". Each position is emitted as a separate item, then the stream completes.
      Returns:
      a Flux that emits every current Position and then completes
    • getPositionRSocket

      @MessageMapping("positions.{symbol}") public reactor.core.publisher.Mono<Position> getPositionRSocket(@DestinationVariable String symbol)
      TCP/RSocket: get a specific position via request-response on route "positions.{symbol}". Example route: "positions.AAPL"
      Parameters:
      symbol - ticker symbol extracted from the route
      Returns:
      a Mono emitting the Position, or empty if not found
    • streamPositions

      @MessageMapping("state.stream") public reactor.core.publisher.Flux<StateSnapshot> streamPositions()
      RSocket request-stream endpoint. Connect via TCP to port 7000 (spring.rsocket.server.port) and send route "state.stream".

      The subscriber first receives a StateSnapshot for every position that already exists at subscription time (the current snapshot), and then continues to receive a new StateSnapshot every time a fill is submitted that updates a position – i.e. the stream never completes while the connection is open.

      Returns:
      a hot Flux of StateSnapshot items