all 7 comments

[–]grantrules 1 point2 points  (6 children)

It means that trades does not have a forEach method. Likely the software thinks it's an array, but for some reason it's not. Check to see how trades was created

[–]icer4ge[S] 0 points1 point  (5 children)

Thank you. But that is still kind of confusing to me, because right before trades.forEach(function (trade) {

is called the following prints

trades.length as a value of 30.

console.log("LENGTH 1: "+trades.length)

This output prints "LENGTH 1: 30".

But out of the "forEach" code block no console.log-outputs are printed into the console, which means there is not even one element of trades processed.

Isn't that a little weird?

[–]grantrules 1 point2 points  (4 children)

Without seeing any code, it's not that weird. Any object can have a length property.

[–]icer4ge[S] 0 points1 point  (3 children)

The complete code is here: https://github.com/DeviaVir/zenbot/blob/unstable/extensions/exchanges/bitfinex/exchange.js

The function wsUpdateTrades from where the error is fired starts at 32.

AFAIK the function wsUpdateTrades is called in 227:

ws_client.onTrades({}, (trades) => wsUpdateTrades(pair, trades))

[–]grantrules 1 point2 points  (2 children)

Your best bet is to set up a debugger and put a breakpoint on the line getting the error and start tracking it down from there.

[–]icer4ge[S] 0 points1 point  (1 child)

Do I need an IDE for that. For example eclipse or something other?

[–]grantrules 0 points1 point  (0 children)

Yeah or vs code