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

162
Vistas
How to get value out of async call

Im trying to use this binance api to back test some strategies. I have the async call but I want to extract the value from the call out so I can use it. I'm planning to use it for more than just a console log, I want to use it as a starting point to do some other logic later on. I feel lik Im close but I just can't quite get the syntax to do what I want. dataPoint has the value I want but I dont know how to get it to the parent function so I can use it in the future.

const ethCandlesticks =  async function(time) {
    let data = await binance.candlesticks("ETHUSDT", "1m", null , {limit: 1, endTime: time});
    return data[0][4];

}

const test = () => {
    let balance = 1000;
    const oneMonthAgo = new Date(2022, 01, 01).getTime();
    const data = ethCandlesticks(oneMonthAgo).then((dataPoint) => {
        return dataPoint;
    });
    
    console.log("test" + data); 

}

test();
about 4 years ago · Juan Pablo Isaza
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