Pebble App Framework: Phone API
    Preparing search index...

    Interface StockDeps

    The helpers runStockRound needs, passed in so the specs can swap them.

    interface StockDeps {
        fetchQuote: (
            symbol: string,
            onQuote: (result: StockQuote) => void,
        ) => void;
        firstDelayMs?: number;
        now: () => number;
        paid?: boolean;
        probeFirst?: boolean;
        provider?: string;
        retriesLost?: boolean;
        reuse?: (symbol: string) => StockQuote | null;
        sendStocks: (results: StockQuote[]) => void;
        spacingMs?: number;
        timeoutMs: number;
    }
    Index
    fetchQuote: (symbol: string, onQuote: (result: StockQuote) => void) => void
    firstDelayMs?: number

    How long to wait before the first call, so it keeps the gap from a call in the round before.

    now: () => number
    paid?: boolean

    True on a paid plan, where Alpha Vantage backs off after a limit as Yahoo does.

    probeFirst?: boolean

    True when the round should ask for its first ticker alone and the rest only once that one is answered, as after a round that left a backoff. A first call lost to the network, timed out, or rate limited ends the round there, with the other tickers carrying the same status unspent.

    provider?: string

    The provider, so a rate limit sets the right wait. Left out, a rate limit sets none.

    retriesLost?: boolean

    True when the next round asks again only for tickers it holds no current quote for, as Alpha Vantage does. A ticker lost to the network then leaves the time alone, so the next ask tries it again rather than waiting out the floor, and spends a call on it alone.

    reuse?: (symbol: string) => StockQuote | null

    A quote already held for a ticker, which then fills its slot with no call.

    sendStocks: (results: StockQuote[]) => void
    spacingMs?: number

    The gap between one call answering and the next starting, for a provider that refuses calls close together. Spaced calls go one at a time.

    timeoutMs: number