UNPKG

polygon.io

Version:

Isomorphic Javascript client for Polygon.io Stocks, Forex, and Crypto APIs

31 lines (28 loc) 717 B
// CF: https://polygon.io/docs/#!/Stocks--Equities/get_v1_meta_exchanges import { get } from "../transport/request"; export interface IExchangeRaw { id: number; type: string; market: string; mic: string; name: string; tape: string; } export interface IExchangeFormatted { id: number; type: string; market: string; mic: string; marketIdentifierCode: string; name: string; tape: string; } const formatIExchangeRaw = (raw: IExchangeRaw): IExchangeFormatted => ({ ...raw, marketIdentifierCode: raw.mic }); export const exchanges = async ( apiKey: string, apiBase: string ): Promise<IExchangeFormatted[]> => (await get(`/v1/meta/exchanges`, apiKey, apiBase)).map(formatIExchangeRaw);