Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

163
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda