UNPKG

@dxfeed/dxlink-feed

Version:

dxLink FEED provides access to the real-time and historical data of dxFeed

63 lines (62 loc) 2.24 kB
import { type DXLinkChannelMessage } from '@dxfeed/dxlink-core'; export declare enum FeedContract { 'AUTO' = "AUTO", 'TICKER' = "TICKER", 'HISTORY' = "HISTORY", 'STREAM' = "STREAM" } export declare enum FeedDataFormat { 'FULL' = "FULL", 'COMPACT' = "COMPACT" } export interface FeedParameters { readonly contract: FeedContract; } export interface FeedEventFields { [eventType: string]: string[]; } export interface FeedSetupMessage { readonly type: 'FEED_SETUP'; readonly acceptAggregationPeriod?: number; readonly acceptDataFormat?: FeedDataFormat; readonly acceptEventFields?: FeedEventFields; } export interface FeedConfigMessage { readonly type: 'FEED_CONFIG'; readonly aggregationPeriod: number; readonly dataFormat: FeedDataFormat; readonly eventFields?: FeedEventFields; } export type Subscription = { readonly type: string; readonly symbol: string; }; export type TimeSeriesSubscription = { readonly type: string; readonly symbol: string; readonly fromTime: number; }; export type IndexedEventSubscription = { readonly type: string; readonly symbol: string; readonly source: string; }; export interface FeedSubscriptionMessage { readonly type: 'FEED_SUBSCRIPTION'; readonly add?: (Subscription | TimeSeriesSubscription | IndexedEventSubscription)[]; readonly remove?: (Subscription | TimeSeriesSubscription | IndexedEventSubscription)[]; readonly reset?: boolean; } export type FeedEventValue = number | string | boolean; export interface FeedEventData { [key: string]: FeedEventValue; } export type FeedCompactEventData = [string, FeedEventValue[]]; export interface FeedDataMessage { readonly type: 'FEED_DATA'; readonly data: FeedEventData[] | FeedCompactEventData; } export type FeedMessage = FeedSetupMessage | FeedConfigMessage | FeedSubscriptionMessage | FeedDataMessage; export declare const isFeedFullData: (data: FeedEventData[] | FeedCompactEventData) => data is FeedEventData[]; export declare const isFeedCompactData: (data: FeedEventData[] | FeedCompactEventData) => data is FeedCompactEventData; export declare const isFeedMessage: (message: DXLinkChannelMessage) => message is FeedMessage;