Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!