Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

173
Vistas
How to fetch data from multiple API's at the same time - that require a different seaarch prase

I'm making an app that fetches data from 2 different APIs at the same time based on the user's search.

The app is supposed to fetch current crypto prices and historical data. But the APIs use 2 different formats for the symbol, like so:

1.

  • BTC-USD (yahoo.com/BTC-USD)
  • BITCOIN (coingecko.com/api/BITCOIN)

if someone looks up 'BITCOIN' it's only going to pull up data from 1 API, because the other 1 requires 'BTC-USD'

2.

  • ETH-USD (yahoo.com/ETH-USD)
  • ETHEREUM coingecko.com/api/ETHEREUM

Is it possible to somehow fetch data from both APIs at the same time-based?

I guess I could see some solutions (hardcoding the data, or switching APIs so they use the same format), altho this path seems pretty work-intensive.

Any ideas on how this can be done?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Use Promise.all if you want fetch data from 2 different API's at the sane time:

const fetchData = async (yahoo_API_URL, coingecko_API_URL) => {
    const fetchYahoo = fetch(yahoo_API_URL, /* config */)
    const fetchCoingecko = fetch(coingecko_API_URL, /* config */)
    const [fetchYahooRes, fetchCoingeckoRes] = await Promise.all([fetchYahoo, fetchCoingecko])
    const [cryptoPriceFromYahoo, cryptoPriceFromCoingecko] = await Promise.all([fetchYahooRes.json(), fetchCoingeckoRes.json()])
    ...
  }

  fetchData('yahoo.com/BTC-USD', 'coingecko.com/api/BITCOIN')
  fetchData('yahoo.com/ETH-USD', 'coingecko.com/api/ETHEREUM')
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda