News Data Provider
NewsDataProvider
connects your news regarding selected instrument with dxchart5-react
application.
Here's how they look like on chart:

Example
/** Copyright ©2024 Devexperts LLC.All rights reserved. Any unauthorized use will constitute an infringement of copyright.In case of any questions regarding types of use, please contact legal@devexperts.com.This notice must remain intact.**/import { addDays } from 'date-fns';const MOCK_NEWS_DATA = [{title: 'News 1',timestamp: addDays(Date.now(), -5).getTime(),sourceLink: 'https://google.com',},{title: 'News 2',timestamp: addDays(Date.now(), -6).getTime(),sourceLink: 'https://google.com',},{title: 'News 3',timestamp: addDays(Date.now(), -10).getTime(),sourceLink: 'https://google.com',},];/*** Creates mock implementation of {@link NewsDataProvider}.*/export const createMockNewsDataProvider = () => ({requestNews() {return Promise.resolve({news: MOCK_NEWS_DATA,});},});
API Reference
NewsDataProvider
Fetches news related to the instrument
- NewsDataProvider.requestNews
- Parameters
- symbol: string
- options: AtLeastOne<RequestNewsOptions, "fromTime">
- Returns
- Promise<NewsData>
NewsDataProvider.requestNews(symbol: string, options: AtLeastOne<RequestNewsOptions, "fromTime">): Promise<NewsData>