Release v25.002 (from ea00b60e)
Fixes tradingview/charting_library#4226 Fixes tradingview/charting_library#7466 Fixes tradingview/charting_library#7722 Fixes tradingview/charting_library#7732
This commit is contained in:
1
datafeeds/udf/lib/provider-interfaces.js
Normal file
1
datafeeds/udf/lib/provider-interfaces.js
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
||||
@@ -1,21 +1,14 @@
|
||||
import {
|
||||
LibrarySymbolInfo,
|
||||
SubscribeBarsCallback,
|
||||
} from '../../../charting_library/datafeed-api';
|
||||
|
||||
import {
|
||||
GetBarsResult,
|
||||
HistoryProvider,
|
||||
} from './history-provider';
|
||||
import { LibrarySymbolInfo, ResolutionString, SubscribeBarsCallback } from '../../../charting_library/datafeed-api';
|
||||
|
||||
import {
|
||||
getErrorMessage,
|
||||
logMessage,
|
||||
} from './helpers';
|
||||
import { IDataPulseProvider, IHistoryProvider, GetBarsResult } from './provider-interfaces';
|
||||
|
||||
interface DataSubscriber {
|
||||
symbolInfo: LibrarySymbolInfo;
|
||||
resolution: string;
|
||||
resolution: ResolutionString;
|
||||
lastBarTime: number | null;
|
||||
listener: SubscribeBarsCallback;
|
||||
}
|
||||
@@ -24,17 +17,17 @@ interface DataSubscribers {
|
||||
[guid: string]: DataSubscriber;
|
||||
}
|
||||
|
||||
export class DataPulseProvider {
|
||||
export class DataPulseProvider implements IDataPulseProvider {
|
||||
private readonly _subscribers: DataSubscribers = {};
|
||||
private _requestsPending: number = 0;
|
||||
private readonly _historyProvider: HistoryProvider;
|
||||
private readonly _historyProvider: IHistoryProvider;
|
||||
|
||||
public constructor(historyProvider: HistoryProvider, updateFrequency: number) {
|
||||
public constructor(historyProvider: IHistoryProvider, updateFrequency: number) {
|
||||
this._historyProvider = historyProvider;
|
||||
setInterval(this._updateData.bind(this), updateFrequency);
|
||||
}
|
||||
|
||||
public subscribeBars(symbolInfo: LibrarySymbolInfo, resolution: string, newDataCallback: SubscribeBarsCallback, listenerGuid: string): void {
|
||||
public subscribeBars(symbolInfo: LibrarySymbolInfo, resolution: ResolutionString, newDataCallback: SubscribeBarsCallback, listenerGuid: string): void {
|
||||
if (this._subscribers.hasOwnProperty(listenerGuid)) {
|
||||
logMessage(`DataPulseProvider: already has subscriber with id=${listenerGuid}`);
|
||||
return;
|
||||
|
||||
19
datafeeds/udf/src/provider-interfaces.ts
Normal file
19
datafeeds/udf/src/provider-interfaces.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Bar, HistoryMetadata, LibrarySymbolInfo, PeriodParams, ResolutionString, SubscribeBarsCallback, SymbolResolveExtension } from '../../../charting_library/datafeed-api';
|
||||
|
||||
export interface IDataPulseProvider {
|
||||
subscribeBars(symbolInfo: LibrarySymbolInfo, resolution: ResolutionString, newDataCallback: SubscribeBarsCallback, listenerGuid: string): void;
|
||||
unsubscribeBars(listenerGuid: string): void;
|
||||
}
|
||||
|
||||
export interface GetBarsResult {
|
||||
bars: Bar[];
|
||||
meta: HistoryMetadata;
|
||||
}
|
||||
|
||||
export interface IHistoryProvider {
|
||||
getBars(symbolInfo: LibrarySymbolInfo, resolution: ResolutionString, periodParams: PeriodParams): Promise<GetBarsResult>;
|
||||
}
|
||||
|
||||
export interface IResolveProvider {
|
||||
resolveSymbol(symbolName: string, extension?: SymbolResolveExtension | undefined): Promise<LibrarySymbolInfo>;
|
||||
}
|
||||
Reference in New Issue
Block a user