Class ReactiveMarketDataUpdater
java.lang.Object
com.neovisionaries.ws.client.WebSocketAdapter
net.finmath.smartcontract.valuation.marketdata.generators.legacy.LiveFeedAdapter<MarketDataSet>
net.finmath.smartcontract.valuation.marketdata.generators.legacy.ReactiveMarketDataUpdater
- All Implemented Interfaces:
com.neovisionaries.ws.client.WebSocketListener
Class that provides a reactive event emitter that listens to the Refinitiv live market feed and outputs marked data transfer messages.
- Author:
- Luca Bressan
-
Constructor Summary
ConstructorsConstructorDescriptionReactiveMarketDataUpdater
(org.json.JSONObject authJson, String position, List<CalibrationDataItem.Spec> itemList) -
Method Summary
Modifier and TypeMethodDescriptionio.reactivex.rxjava3.core.Observable
<MarketDataSet> Get the reactive source as an observable stream.void
closeStreamsAndLogoff
(com.neovisionaries.ws.client.WebSocket webSocket) Sends a close login stream message.void
onConnected
(com.neovisionaries.ws.client.WebSocket websocket, Map<String, List<String>> headers) Called when handshake is complete and websocket is open, send loginvoid
onTextMessage
(com.neovisionaries.ws.client.WebSocket websocket, String message) void
writeDataset
(String importFile, MarketDataSet transferMessage, boolean isOvernightFixing) Writes the formatted output from the Refinitiv stream to an import candidates file.Methods inherited from class com.neovisionaries.ws.client.WebSocketAdapter
handleCallbackError, onBinaryFrame, onBinaryMessage, onCloseFrame, onConnectError, onContinuationFrame, onDisconnected, onError, onFrame, onFrameError, onFrameSent, onFrameUnsent, onMessageDecompressionError, onMessageError, onPingFrame, onPongFrame, onSendError, onSendingFrame, onSendingHandshake, onStateChanged, onTextFrame, onTextMessage, onTextMessageError, onThreadCreated, onThreadStarted, onThreadStopping, onUnexpectedError
-
Constructor Details
-
ReactiveMarketDataUpdater
public ReactiveMarketDataUpdater(org.json.JSONObject authJson, String position, List<CalibrationDataItem.Spec> itemList)
-
-
Method Details
-
onConnected
public void onConnected(com.neovisionaries.ws.client.WebSocket websocket, Map<String, List<String>> headers) throws ExceptionCalled when handshake is complete and websocket is open, send login- Specified by:
onConnected
in interfacecom.neovisionaries.ws.client.WebSocketListener
- Overrides:
onConnected
in classcom.neovisionaries.ws.client.WebSocketAdapter
- Throws:
Exception
-
asObservable
Description copied from class:LiveFeedAdapter
Get the reactive source as an observable stream.- Specified by:
asObservable
in classLiveFeedAdapter<MarketDataSet>
- Returns:
- the observable stream.
-
onTextMessage
- Specified by:
onTextMessage
in interfacecom.neovisionaries.ws.client.WebSocketListener
- Overrides:
onTextMessage
in classcom.neovisionaries.ws.client.WebSocketAdapter
-
closeStreamsAndLogoff
public void closeStreamsAndLogoff(com.neovisionaries.ws.client.WebSocket webSocket) Sends a close login stream message. Closing the login stream also closes and resets all data streams.- Specified by:
closeStreamsAndLogoff
in classLiveFeedAdapter<MarketDataSet>
- Parameters:
webSocket
- the socket on which the message must be sent
-
writeDataset
public void writeDataset(String importFile, MarketDataSet transferMessage, boolean isOvernightFixing) throws IOException Writes the formatted output from the Refinitiv stream to an import candidates file.- Specified by:
writeDataset
in classLiveFeedAdapter<MarketDataSet>
- Parameters:
importFile
- location of the import candidates filetransferMessage
- the transfer message to be writtenisOvernightFixing
- true when the correction for overnight rates time must be applied- Throws:
IOException
- if the writing operation fails
-