Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.
This repository was archived by the owner on May 30, 2024. It is now read-only.

Can't get function to return anything #56

@boxxa

Description

@boxxa

I am trying to wrap the talib.execute function with Sync. Below is the normal function that is async. When calling the calculateEma function, I would like the talib part to complete before calculateEma returns. I am not sure what I am doing wrong since wrapping it with the Sync fiber doesn't return anything.

Async/Original

calculateAdx = function(series, period) 
{
      talib.execute({
       name: "ADX",
       startIdx: 0,
       endIdx: series.close.length - 1,
       high: series.high,
       low: series.low,
       close: series.close,
       optInTimePeriod: period
     }, function (err, result) {
         if(!err)
            return result
      });
  })
}

Trying with Sync

calculateAdx = function(series, period) 
{
  Sync(function(){
      talib.execute.sync({
       name: "ADX",
       startIdx: 0,
       endIdx: series.close.length - 1,
       high: series.high,
       low: series.low,
       close: series.close,
       optInTimePeriod: period
     }, function (err, result) {
         if(!err)
            return result
      });
  })
 })
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions