news.stories
Fetches historical news stories published after an optional millisecond timestamp. No request is sent until the builder is passed to velo.query().
Imports
import { Velo } from 'velo-sdk';Examples
import { Velo, news } from 'velo-sdk';
const velo = new Velo({ apiKey: process.env.VELO_API_KEY! });
const stories = await velo.query(
news.stories({
begin: Date.now() - 24 * 60 * 60 * 1000,
}),
);
for (const story of stories) {
console.log(story.time, story.headline);
}Definition
function stories(params?: NewsStoriesParams): NewsStoriesBuilder;Parameters
params
- Type:
NewsStoriesParams - Optional
| Property | Type | Description |
|---|---|---|
begin | number | Only returns stories published after this millisecond timestamp. Defaults to 0. |
begin must be a non-negative safe integer. Omitting it returns all available stories.
Return Type
- Type:
NewsStoriesBuilder
Returns an immutable request builder. Passing it to velo.query() resolves to NewsStory[]: an array of matching news stories, or an empty array when no stories match.
News is served as a single JSON document rather than rows, so this builder is query-only: velo.stream() does not accept it, and passing it is a type error.
Per-request timeout, retry, and abort-signal options (HttpRequestOptions) are supplied as the second argument to velo.query(), not to news.stories().
NewsStory
| Property | Type | Description |
|---|---|---|
id | number | The story identifier. |
time | number | Publication timestamp in milliseconds. |
effectiveTime | number | Timestamp at which the story became market-relevant, in milliseconds. |
effectivePrice | `number | null` |
headline | string | The story headline. |
source | Nullable string | The story publisher or source. |
priority | number | The story priority. |
coins | string[] | Coins associated with the story. |
summary | Nullable string | A summary of the story. |
link | Nullable string | A link to the original story. |