I'm excited to announce that real-time streaming functionality is now available in the RefinitivR package for R. This enables R users to access live market data through WebSocket connections, similar to what's available in Python and other languages.
WHAT'S NEW
The package now includes a comprehensive streaming API that allows you to:
- Stream live market data in real-time via WebSocket connections
- Receive event callbacks for refresh, update, and error messages
- Track data history automatically with built-in buffering
- Create live visualizations with built-in Shiny integration
- Access latest snapshots and summary statistics on-demand
QUICK EXAMPLE
library(Refinitiv)
Connect to Refinitiv (ensure Eikon/LSEG Workspace is running)
rd <- RDConnect()
Create a streaming connection
stream <- rd_get_streaming_data(
universe = "EUR=",
fields = c("BID", "ASK", "OPEN_PRC"),
RDObject = rd
)
Add callback for real-time updates
stream$on_update(function(stream, instrument, fields) {
cat(sprintf("%s: BID=%s, ASK=%s\n", instrument, fields$BID, fields$ASK))
})
Open stream and collect data
stream$open()
Sys.sleep(10) # Collect for 10 seconds
View results
print(stream$get_latest_data())
print(stream$get_summary())
Create live plot
app <- stream$plot_live(field = "BID", instrument = "EUR=")
shiny::runApp(app)
Close stream
stream$close()
FEATURES
Event-Driven Architecture:
- on_refresh() - Called when initial data is received
- on_update() - Called on every price update
- on_error() - Called on errors or status changes
Data Access:
- get_latest_data() - Get current snapshot (all instruments or specific)
- get_data_history() - Get full history as data.table
- get_summary() - Get summary statistics
Built-in Visualizations:
- plot_live() - Creates interactive Shiny app for live plotting
- Supports custom Shiny applications
- Compatible with ggplot2, plotly, and other visualization libraries
INSTALLATION
install.packages("devtools")
devtools::install_github("GreenGrassBlueOcean/RefinitivR")
library(Refinitiv)
DOCUMENTATION & EXAMPLES
The package includes comprehensive documentation and example scripts:
List available examples
list.files(system.file("examples", package = "Refinitiv"))
Run quick example (~10 seconds)
source(system.file("examples", "streaming_quick_example.R", package = "Refinitiv"))
Run complete example (~30 seconds, all features)
source(system.file("examples", "streaming_complete_example.R", package = "Refinitiv"))
Full documentation is available in the README at:
https://github.com/GreenGrassBlueOcean/RefinitivR
The documentation includes:
- Quick start guide
- API reference
- Custom visualization guide (5 different approaches)
- Advanced usage examples
REQUIREMENTS
- Eikon/LSEG Workspace must be running
- Valid API key configured
- R packages: websocket, later, shiny, data.table (installed automatically)
TESTING & FEEDBACK
I'd love to get your feedback on this new functionality! Please try it out and let me know:
- Does it work well with your use cases?
- Are there any issues or bugs you encounter?
- What additional features would be useful?
- Any suggestions for improvements?
You can report issues or provide feedback on the GitHub repository at:
https://github.com/GreenGrassBlueOcean/RefinitivR
Or simply reply to this thread.
ADDITIONAL NOTES
- The streaming API uses different protocols depending on stream type:
- Pricing streams: tr_json2 protocol (OMM-based) via WebSocket
- Analytics streams: rdp_streaming protocol via WebSocket
- Supports multiple instruments and fields
- Automatic connection management and reconnection handling
- Debug logging available via: options(refinitiv_streaming_debug = TRUE)
Looking forward to hearing your experiences and feedback!
Best regards,
Laurens
Package Repository: https://github.com/GreenGrassBlueOcean/RefinitivR
Documentation: See README.md in the repository