charton API / @chart-on/core / index / MockDataSource
Interface: MockDataSource
Defined in: packages/core/src/data/adapters.ts:418
The mock data source, with controls to pause live ticks and to simulate the stream dropping.
Extends
Methods
adjustments()?
optionaladjustments(symbol,request):Promise<Adjustment[]>
Defined in: packages/core/src/data/types.ts:251
Splits, dividends and other corporate actions taking effect in request's range, so the chart can back-adjust older bars (see the adjustment chart option). Asked for after each batch of bars, over that batch's span. Bars must come unadjusted when this is present. Without it the bars are shown as sent. A noun, like the other lookups.
Parameters
symbol
request
Returns
Promise<Adjustment[]>
Inherited from
history()
history(
symbol,interval,request):Promise<BarsResult>
Defined in: packages/core/src/data/types.ts:216
Bars for request, ascending by time.
Parameters
symbol
interval
request
Returns
Promise<BarsResult>
Inherited from
markers()?
optionalmarkers(symbol,interval,request):Promise<SourceMarker[]>
Defined in: packages/core/src/data/types.ts:260
Markers (see SourceMarker) at times in request's range, for bars and the time axis alike. Asked for around the visible range as the view moves, afresh after every symbol or interval change and after a reset (onReset) of the shown bars; never while the marks and timeMarks options are both off. Invalid markers are dropped. Named for what draws them, annotation markers.
Parameters
symbol
interval
request
Returns
Promise<SourceMarker[]>
Inherited from
now()?
optionalnow():Promise<number>
Defined in: packages/core/src/data/types.ts:243
The source's current time, unix seconds.
Returns
Promise<number>
Inherited from
onReset()?
optionalonReset(listener): () =>void
Defined in: packages/core/src/data/types.ts:231
Report bars that changed after they were sent; the chart refetches them through history. A subscription on the source, not an argument of stream, so that sources without a stream (REST, polling, static) can report corrections too, everything that reads the source's bars (the main series, other symbols' bars in indicators) refetches through one path, and it works like onStatus. Returns an unsubscribe function.
Parameters
listener
(reset) => void
Returns
() => void
Inherited from
onStatus()?
optionalonStatus(listener): () =>void
Defined in: packages/core/src/data/types.ts:236
Report connection changes. After reconnecting then connected, the chart refetches the bars missed meanwhile. Returns an unsubscribe function.
Parameters
listener
(status) => void
Returns
() => void
Inherited from
quotes()?
optionalquotes(symbol,onQuote): () =>void
Defined in: packages/core/src/data/types.ts:241
Stream the best bid and ask for the bid and ask reference lines. Each quote replaces the previous one. Returns an unsubscribe function.
Parameters
symbol
onQuote
(quote) => void
Returns
() => void
Inherited from
search()
search(
query):Promise<SymbolInfo[]>
Defined in: packages/core/src/data/types.ts:214
Symbols matching a search query, for symbol search.
Parameters
query
string
Returns
Promise<SymbolInfo[]>
Inherited from
setConnected()
setConnected(
connected):void
Defined in: packages/core/src/data/adapters.ts:425
Simulate the live stream dropping (false: no ticks, status reconnecting) and coming back (true: status connected).
Parameters
connected
boolean
Returns
void
setPaused()
setPaused(
paused):void
Defined in: packages/core/src/data/adapters.ts:420
Pause or resume live ticks.
Parameters
paused
boolean
Returns
void
stream()?
optionalstream(symbol,interval,onBar): () =>void
Defined in: packages/core/src/data/types.ts:222
Stream live bars. A bar with the current last time replaces it, a newer one appends, older ones are ignored. Bars sent earlier that changed are reported through onReset, not here. Returns an unsubscribe function.
Parameters
symbol
interval
onBar
(bar) => void
Returns
() => void
Inherited from
symbol()
symbol(
symbol):Promise<SymbolInfo>
Defined in: packages/core/src/data/types.ts:212
The symbol's description; throw (or reject) when the source does not know it.
Parameters
symbol
string
Returns
Promise<SymbolInfo>