Open Utfard opened 3 years ago
Anyone else having this issue ?
I am having the exact same issue. Using docker-compose in Manjaro, getting "TypeError: trades.forEach is not a function"
Have I written custom code (as opposed to using zenbot vanilla):NO OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Manjaro 20.2.1 Zenbot version (commit ref, or version):4.1.0 ( git ref 016ab678f657b4e17882ef84783938ddb18c7f2) Zenbot branch: unstable NodeJS version: Python version (when using a python script): Exact command to reproduce (include everything): docker-compose exec server zenbot balance bitfinex.XRP-USD (after docker-compose up -d) Did I make any changes to conf-sample.js?: copied to conf.js, only added bitfinex API key
Note: I modified the docker-compose.yml to override the entrypoint so that zenbot is not started automatically when starting the container. I added this to the "server" service:
entrypoint: /bin/sh
command: ""
I have the same problem.
Hi again,
I commented out the code in function wsUpdates
in extensions/exchanges/bitfinex/exchange.js. This way it at least runs.
I'm not sure about the consequences. Obviously you cannot get a trade list this way.
I was able to trigger a manual orders this way, e.g. "./zenbot sell
I'm still testing this in manual mode with small amounts, before I use automatic trading.
Hi all, Have the same issue. Now testing is in progress. What I have changed in exchange.js:
When wsUpdateTrades is called, trades may come as an object with _collection, or without it (single trade). So:
function wsUpdateTrades(pair, trades) {
if (trades["id"]) {
var newTrade = {
trade_id: Number(trades.id),
time: Number(trades.mts),
size: Math.abs(trades.amount),
price: Number(trades.price),
side: trades.amount > 0 ? 'buy' : 'sell'
}
ws_trades.push(newTrade)
} else if (trades["_collection"])
{
const collection_trades = trades["_collection"]
collection_trades.forEach(function (trade) {
var newTrade = {
trade_id: Number(trade.id),
time: Number(trade.mts),
size: Math.abs(trade.amount),
price: Number(trade.price),
side: trade.amount > 0 ? 'buy' : 'sell'
}
ws_trades.push(newTrade)
})
}
if (ws_trades.length > 1010)
ws_trades.shift()
}
then, in the wsMessage function, I removed the line: console.log(message)
It should have been as if(so.debug)
obviously. Otherwise, it interferes with screen output.
Then, walletUpdate was called too often. It caused websocket blocking and no new trades were coming.
Changed timeout:
function waitForCalc(method, args, cb) { setTimeout(function () { exchange[method].call(exchange, args, cb) }, 2000) }
And after these changes, I would drop all the collections: trades and sessions etc in mongo db and start from the empty.
Another bug fix: After some time, or when the terminal was inactive (not in the focus), the process.stdout.write stopped printing while the trades were updating. I suggest it cased by the timers. So, it's seemed to work better with this changes in engine.js:
function writeReport (is_progress, blink_off) {
if ((so.mode === 'sim' || so.mode === 'train') && !so.verbose) {
if(so.silent) return
is_progress = true
}
else if (is_progress && typeof blink_off === 'undefined' && s.vol_since_last_blink) {
s.vol_since_last_blink = 0
const ref = setTimeout(function () {
writeReport(true, true)
}, 200)
ref.unref()
const ref1 = setTimeout(function () {
writeReport(true, false)
}, 400)
ref1.unref()
const ref2 = setTimeout(function () {
writeReport(true, true)
}, 600)
ref2.unref()
const ref3 = setTimeout(function () {
writeReport(true, false)
}, 800)
ref3.unref()
}
........................
I did the same trick for the queues everywhere in exchange.js with all setTimeout
@Osolemio you rock
System information
Describe the problem
Paper or real trading not working at all crashing with the error below. I added here the output for balance check as it gave the same error.
Source code / Error logs