Documentation Index
Fetch the complete documentation index at: https://docs.ostium.com/llms.txt
Use this file to discover all available pages before exploring further.
const stream = client.streamPrices([0, 1]);
stream.onSnapshot(ticks => {
console.log(ticks);
});
stream.onTick(tick => {
console.log(tick.pair, tick.mid);
});
You can update subscriptions dynamically:
stream.subscribe([2]);
stream.unsubscribe([1]);
Response schema
interface Response {
onSnapshot(handler: (ticks: PriceTick[]) => void): () => void;
onTick(handler: (tick: PriceTick) => void): () => void;
subscribe(pairIds: Array<string | number>): void;
unsubscribe(pairIds: Array<string | number>): void;
close(): void;
}
interface PriceTick {
feedId: string;
pair: string;
from: string;
to: string;
bid: number;
mid: number;
ask: number;
isMarketOpen: boolean;
isDayTradingClosed: boolean;
secondsToToggleIsDayTradingClosed: number;
timestampSeconds: number;
}