() => {
const [events, setEvents] = React.useState([])
const feed = React.useMemo(() => new Feed(), [])
React.useEffect(() => {
feed.connect('wss://demo.dxfeed.com/webservice/cometd')
return () => feed.disconnect()
}, [])
const request = () => {
feed.getTimeSeries(
'AAPL{=1m}',
'Candle',
1690719917962,
1690806317962,
).then(setEvents)
}
return (
<>
<Button variant="outlined" onClick={request}>
Request
</Button>
<DataViewer events={events} />
</>
)
}