Skip to content
Velo

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
PropertyTypeDescription
beginnumberOnly 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

PropertyTypeDescription
idnumberThe story identifier.
timenumberPublication timestamp in milliseconds.
effectiveTimenumberTimestamp at which the story became market-relevant, in milliseconds.
effectivePrice`numbernull`
headlinestringThe story headline.
sourceNullable stringThe story publisher or source.
prioritynumberThe story priority.
coinsstring[]Coins associated with the story.
summaryNullable stringA summary of the story.
linkNullable stringA link to the original story.