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.voidcloseStreamsAndLogoff(com.neovisionaries.ws.client.WebSocket webSocket)Sends a close login stream message.voidonConnected(com.neovisionaries.ws.client.WebSocket websocket, Map<String,List<String>> headers)Called when handshake is complete and websocket is open, send loginvoidonTextMessage(com.neovisionaries.ws.client.WebSocket websocket, String message)voidwriteDataset(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:
onConnectedin interfacecom.neovisionaries.ws.client.WebSocketListener- Overrides:
onConnectedin classcom.neovisionaries.ws.client.WebSocketAdapter- Throws:
Exception
-
asObservable
Description copied from class:LiveFeedAdapterGet the reactive source as an observable stream.- Specified by:
asObservablein classLiveFeedAdapter<MarketDataSet>- Returns:
- the observable stream.
-
onTextMessage
- Specified by:
onTextMessagein interfacecom.neovisionaries.ws.client.WebSocketListener- Overrides:
onTextMessagein 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:
closeStreamsAndLogoffin classLiveFeedAdapter<MarketDataSet>- Parameters:
webSocket- the socket on which the message must be sent
-
writeDataset
public void writeDataset(String importFile, MarketDataSet transferMessage, boolean isOvernightFixing) throws IOExceptionWrites the formatted output from the Refinitiv stream to an import candidates file.- Specified by:
writeDatasetin 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
-