Closed vincentbollaert closed 7 years ago
Poloniex API is down!
Did you retry? Are you able to connect to Poloniex (or any internet site) from the box that is running your bot?
I wasn't running Zenbot in a docker container, and not sure the API being down is even related. The provided 'nonce' is incorrect
Having the same issue here.
Nonce must be greater than xxx
or the time out error bellow.
ggetBalance error: { error: 'Connection timed out. Please try again.' } Poloniex API is down! unable to call getBalance, retrying in 10s
It seens like it does not work only some times. I put a console.log in the end of getBalance function and most of the time it passes. Could it be the number of request per second/minute Poloniex accepts?
Also getting this same error:
ggetBalance error:
{ error: 'Nonce must be greater than 1496361634359495. You provided 149636192715100.' }
If you look at the time stamps, they are off by a few orders of 10
Example: 1496361634359495 # Needed 149636192715100 # Provided by Zenbot
Having same issue.
Reference: https://github.com/timmolter/XChange/issues/1193
getBalance error: { error: 'Nonce must be greater than 149695216646000. You provided 149695215679400.' }
Poloniex API is down! unable to call getBalance, retrying in 10s
getBalance error: { error: 'Nonce must be greater than 149695225678600. You provided 149695224643200.' }
Poloniex API is down! unable to call getBalance, retrying in 10s
getBalance error: { error: 'Nonce must be greater than 149695230660000. You provided 149695229647500.' }
Poloniex API is down! unable to call getBalance, retrying in 10s
getBalance error: { error: 'Nonce must be greater than 149695237659600. You provided 149695236673600.' }
Poloniex API is down! unable to call getBalance, retrying in 10s
AnnihilaT , it didnt help. I have full default settings. Im trying work with polo in the docker zenbot.
---------------------------- STARTING LIVE TRADING ---------------------------- ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705692249700.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705693291700.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705694629500.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705695656400.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705696684000.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705698020600.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705699047800.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705700975900.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705702339800.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705703368000.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705704670000.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705706565900.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705707592600.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705708647000.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705711675200.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705712704600.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705714236500.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705715261200.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705717289200.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705718321400.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705719642600.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705721204200.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705722234000.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705723293500.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705724822400.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 1496885422687535. You provided 149705725911000.' }
try new generated api key. and avoid to use multiple application with same key.
https://github.com/codiwest/zenbot/blob/master/docs/FAQ.md#error-1
nao0811ta, thanks! All work fine!
ggetBalance error: { error: 'Nonce must be greater than 149724606975500. You provided 149724606975300.' }
Poloniex API is down! unable to call getBalance, retrying in 10s
To combat these errors I have followed steps other users have taken across the web but no success!
None of the above have worked, it's providing the wrong times to Poloniex (and i assume as it's a nonce issue this is not exchange specific).
Any new suggestions, did anyone else find something different that worked here? Thanks in advance :)
@CreativeBacon
Hmm..
I suggest modify poloniex/exchange.js to
12 function publicClient (product_id) {
13 // if (!public_client) public_client = new
Poloniex(c.poloniex.key, c.poloniex.secret)
14 // return public_client
15 return authedClient()
16 }
I think the reason is exchange.js's two poloniex instance. So, another instance have old nonce value. It need to be thread-safe..
Thank you for the speedy reply, super appreciated!
I have made the edits as specified and the following error is now presented: `Alexs-MacBook-Pro:zenbot alex$ zenbot trade --period=1m poloniex.doge-btc fetching pre-roll data: /Users/alex/zenbot/node_modules/poloniex.js/lib/poloniex.js:30 this._getPrivateHeaders = function(parameters) { ^
TypeError: Cannot set property '_getPrivateHeaders' of undefined
at Poloniex (/Users/alex/zenbot/node_modules/poloniex.js/lib/poloniex.js:30:33)
at publicClient (/Users/alex/zenbot/extensions/exchanges/poloniex/exchange.js:14:9)
at Object.getTrades (/Users/alex/zenbot/extensions/exchanges/poloniex/exchange.js:57:26)
at getNext (/Users/alex/zenbot/commands/backfill.js:75:22)
at Object.
update, the line wrap on your post made me think line 13 was now to be separated. I have tried and it's running!
I'll update with progress, thanks again. :)
Period is so short and different line of source with mine. It works for me with macd strategy and default parameters on up to date version.
as shown in the above screenshot, zenbot shows the attempted buy but then thinks it's succeeded. The bid is not withdrawn and stays there, I have a pending bid at the currency it tried to buy and zenbot has stopped tracking this buy order due to the nonce error.
@CreativeBacon It's only temporary modification. Due it's not my logic, Someone Let me know better and safe methology.. Or different poloniex library we need
My logs tracked well. Which strategy are you using??
How about retrying modified logic with your new key.
Still a lot of nonce errors, debugging at present!
How does the bot calculate the nonce?
@CreativeBacon The nonce generation is not done by the bot. It is done in the API functions from exchange API which is pulled in when you do an "npm install"
@CreativeBacon I modified like below. I'm using two API key lol..
12 function publicClient (product_id) {
13 if (!public_client) public_client = new Poloniex(c.poloniex.key, c.poloniex.secret)
14 return public_client
15 }
16
17 function authedClient () {
18 if (!authed_client) {
19 if (!c.poloniex || !c.poloniex.key || c.poloniex.key === 'YOUR-API-KEY') {
20 throw new Error('please configure your Poloniex credentials in conf.js')
21 }
22 authed_client = new Poloniex(c.poloniex2.key, c.poloniex2.secret)
23 }
24 return authed_client
25 }
found
getBalance and getTrades are send sometimes at the same time. I'm using lock flag . but need to handle by mutex
getBalance
finish getBalance
getTrades
finish getTrades
getBalance
locked from getTrades
finish getBalance
2017-06-12 14:18:51 0.13908836 ETH-BTC -1.1% 21737 +++ +00.0019 74 2.24 ETH 0.00280 BTC +12.3% -14.4%
interesting, I have also added a second set of API keys and will test once they unban me in two minutes!
Nice suggestion.. π
@CreativeBacon Apparently, two API keys was not good idea. use lock flag and when locked, retry. Tentatively ETH-BTC to the Moon now.
@nao0811ta Removed double API. π By 'lock flag' you mean to add --lock to the run command?
This would be easier messaging back and forth on a skype chat, feel free to add me - my Skype ID is freshlondon.biz
not testing with large amounts of course, but if the above image helps..? π
like that
52 getTrades: function (opts, cb) {
53 //console.error('getTrades')
54 var func_args = [].slice.call(arguments)
55 if (lock) {
56 // console.log('locked from getTrades')
57 return retry('getTrades', func_args)
58 }
59 //console.log('getTrades')
60 lock = true
61 var client = publicClient()
62 var args = {
63 currencyPair: joinProduct(opts.product_id)
64 }
65 if (opts.from) {
66 args.start = opts.from
67 }
68 if (opts.to) {
69 args.end = opts.to
70 }
71 if (args.start && !args.end) {
72 // add 2 hours
73 args.end = args.start + 7200
74 }
75 else if (args.end && !args.start) {
76 // subtract 2 hours
77 args.start = args.end - 7200
78 }
79
80 client._public('returnTradeHistory', args, function (err, body) {
81 lock = false
i hope i did the above correctly, although i am returned:
note how i tried running with both --lock and without in the command, just in case. I wish this wasn't JS, one of the coding languages i totally suck at! π
Thanks a lot for your help so far @nao0811ta - you're a superstar π
(1 day trading period, keen to get this functioning!)
A trading friend who dabbles with JS has his working a little more productively as far as the error messages go, although they still exist. Apparently it's as if polo is lagging by 20ish seconds, do you have this experience?
Nope. I don't have.. It looks like need to ntcupdate.
had a search online but not finding anything that helps, may i ask what is ntcupdate?
@CreativeBacon I'm sorry ntcupdate is not proper info. I recommend c.poll_trades to increase. if you do that, timeout and another api error to be decreased. I set it to
93 // ms to poll new trades at
94 c.poll_trades = 50000
yup, still the issue of the errors just its asking poloniex less so shows less. Not as effectove for trading, i am doing some trades with my settings but due to the nonce issues it's greatly affected productivity.
Fingers crossed a patch comes out soon!
@CreativeBacon I hope so. But I haven't been being happen nonce error now anymore. I am controling geBalance and getTrades by lock flag.
WOW, incredible! fancy sharing your files? π
could use wetransfer and email: me@alexhigh.co.uk ..without your API keys of course!
I'll then send it back with some super awesome tweaked settings (after testing what works) as a thank you π
Hey folks is there a fix for this in the works? It seems like you found a workaround? This error is hindering my trading as well since it sometimes fails to sell or buy with this error and it misses the ideal signal.
ditto, i've moved to another exchange for now but poloniex is the only one of interest! strange thing i've noticed is the error doesnt show on any other exchanges, could it be an issue with poloniex themselves?
I'm seeing issue on Bitfinex as well
Anyone want to share a complete file? :) get the same error over an dover on polo
When I trade in the same time in the different crypto then I get same error. (In one of the docker console.) pack is: edit
Edited /zenbot/extensions/exchanges/poloniex/exchange.js:
var Poloniex = require('poloniex.js') , path = require('path') , moment = require('moment') , n = require('numbro') , colors = require('colors')
module.exports = function container (get, set, clear) { var c = get('conf')
var public_client, authed_client
function publicClient (product_id) { if (!public_client) public_client = new Poloniex(c.poloniex.key, c.poloniex.secret) return public_client }
function authedClient () { if (!authed_client) { if (!c.poloniex || !c.poloniex.key || c.poloniex.key === 'YOUR-API-KEY') { throw new Error('please configure your Poloniex credentials in conf.js') } authed_client = new Poloniex(c.poloniex.key, c.poloniex.secret) } return authed_client }
function joinProduct (product_id) { return productid.split('-')[1] + '' + product_id.split('-')[0] }
function retry (method, args) { if (method !== 'getTrades') { console.error(('\nPoloniex API is down! unable to call ' + method + ', retrying in 10s').red) } setTimeout(function () { exchange[method].apply(exchange, args) }, 10000) }
var orders = {}
var exchange = { name: 'poloniex', historyScan: 'backward', makerFee: 0.15, takerFee: 0.25,
getProducts: function () {
return require('./products.json')
},
getTrades: function (opts, cb) { //console.error('getTrades') var func_args = [].slice.call(arguments) var lock = false if (lock) { // console.log('locked from getTrades') return retry('getTrades', func_args) } //console.log('getTrades') lock = true var client = publicClient() var args = { currencyPair: joinProduct(opts.product_id) } if (opts.from) { args.start = opts.from } if (opts.to) { args.end = opts.to } if (args.start && !args.end) { // add 2 hours args.end = args.start + 7200 } else if (args.end && !args.start) { // subtract 2 hours args.start = args.end - 7200 }
client._public('returnTradeHistory', args, function (err, body) {
lock = false if (err) return cb(err) if (typeof body === 'string') { return retry('getTrades', func_args) } if (!body.map) { console.error('\getTrades odd result:') console.error(body) return retry('getTrades', func_args) } var trades = body.map(function (trade) { return { trade_id: trade.tradeID, time: moment.utc(trade.date).valueOf(), size: Number(trade.amount), price: Number(trade.rate), side: trade.type } }) cb(null, trades) }) },
getBalance: function (opts, cb) {
var args = [].slice.call(arguments)
var client = authedClient()
client.returnCompleteBalances(function (err, body) {
if (err) return cb(err)
var balance = {asset: 0, currency: 0}
if (typeof body === 'string') {
return retry('getBalance', args)
}
if (body.error) {
console.error('\ggetBalance error:')
console.error(body)
return retry('getBalance', args)
}
if (body[opts.currency]) {
balance.currency =
n(body[opts.currency].available).add(body[opts.currency].onOrders).format('0.00000000') balance.currency_hold = body[opts.currency].onOrders } if (body[opts.asset]) { balance.asset = n(body[opts.asset].available).add(body[opts.asset].onOrders).format('0.00000000') balance.asset_hold = body[opts.asset].onOrders } cb(null, balance) }) },
getQuote: function (opts, cb) {
var args = [].slice.call(arguments)
var client = publicClient()
var product_id = joinProduct(opts.product_id)
client.getTicker(function (err, body) {
if (err) return cb(err)
if (typeof body === 'string') {
return retry('getQuote', args)
}
if (body.error) {
console.error('\ggetQuote error:')
console.error(body)
return retry('getQuote', args)
}
var quote = body[product_id]
if (!quote) return cb(new Error('no quote for ' + product_id))
if (quote.isFrozen == '1') console.error('\nwarning: product ' +
product_id + ' is frozen') cb(null, { bid: quote.highestBid, ask: quote.lowestAsk, }) }) },
cancelOrder: function (opts, cb) {
var args = [].slice.call(arguments)
var client = authedClient()
client._private('cancelOrder', {orderNumber: opts.order_id}, function
(err, result) { if (typeof result === 'string') { return retry('cancelOrder', args) } if (!err && !result.success) { // sometimes the order gets cancelled on the server side for some reason and we get this. ignore that case... if (result.error !== 'Invalid order number, or you are not the person who placed the order.') { err = new Error('unable to cancel order') err.body = result } } cb(err) }) },
trade: function (type, opts, cb) {
var args = [].slice.call(arguments)
var client = authedClient()
var params = {
currencyPair: joinProduct(opts.product_id),
rate: opts.price,
amount: opts.size,
postOnly: opts.post_only === false ? '0' : '1'
}
client._private(type, params, function (err, result) {
if (typeof result === 'string') {
return retry('trade', args)
}
var order = {
id: result ? result.orderNumber : null,
status: 'open',
price: opts.price,
size: opts.size,
post_only: !!opts.post_only,
created_at: new Date().getTime(),
filled_size: '0'
}
if (result && result.error === 'Unable to place post-only order at
this price.') { order.status = 'rejected' order.reject_reason = 'post only' return cb(null, order) } else if (result && result.error && result.error.match(/^Not enough/)) { order.status = 'rejected' order.reject_reason = 'balance' return cb(null, order) } if (!err && result.error) { err = new Error('unable to ' + type) err.body = result } if (err) return cb(err) orders['~' + result.orderNumber] = order cb(null, order) }) },
buy: function (opts, cb) {
exchange.trade('buy', opts, cb)
},
sell: function (opts, cb) {
exchange.trade('sell', opts, cb)
},
getOrder: function (opts, cb) {
var args = [].slice.call(arguments)
var order = orders['~' + opts.order_id]
if (!order) return cb(new Error('order not found in cache'))
var client = authedClient()
var params = {
currencyPair: joinProduct(opts.product_id)
}
client._private('returnOpenOrders', params, function (err, body) {
if (err) return cb(err)
if (typeof body === 'string' || !body) {
return retry('getOrder', args)
}
var active = false
if (!body.forEach) {
console.error('\nreturnOpenOrders odd result:')
console.error(body)
}
else {
body.forEach(function (api_order) {
if (api_order.orderNumber == opts.order_id) active = true
})
}
if (!active) {
order.status = 'done'
order.done_at = new Date().getTime()
return cb(null, order)
}
client.returnOrderTrades(opts.order_id, function (err, body) {
if (typeof body === 'string' || !body) {
return retry('getOrder', args)
}
if (err || body.error || !body.forEach) return cb(null, order)
order.filled_size = '0'
body.forEach(function (trade) {
order.filled_size =
n(order.filled_size).add(trade.amount).format('0.00000000') }) if (n(order.filled_size).value() == n(order.size).value()) { order.status = 'done' order.done_at = new Date().getTime() } cb(null, order) }) }) },
// return the property used for range querying.
getCursor: function (trade) {
return Math.floor((trade.time || trade) / 1000)
}
} return exchange }
2017-06-15 13:35 GMT+03:00 crack00r notifications@github.com:
Anyone want to share a complete file? :) get the same error over an dover on polo
β You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/carlos8f/zenbot/issues/193#issuecomment-308694226, or mute the thread https://github.com/notifications/unsubscribe-auth/Ab1B_D2xahtW6fdsRrDqhDX5hmnGC07_ks5sEQjogaJpZM4NoBjr .
With this, you dont have errors? @denisa08
@crack00r I dont have errors when i trade with one crypto. But if i going trading with multiple crypto then i get it error in one of crypto trade console.
I gice it a try, thx
@denisa08 can you may upload on nopaste? here are to many format errors
http://dropmefiles.com/QbAyU @crack00r
Click to the "Π‘ΠΊΠ°ΡΠ°ΡΡ Π²ΡΠ΅". Im from Russia, sorry:)
thx! I try it now
again :( and more erros
`ggetBalance error: { error: 'Nonce must be greater than 149754973633900. You provided 149754972917800.' }
Poloniex API is down! unable to call getBalance, retrying in 10s ggetBalance error: { error: 'Nonce must be greater than 149754973633900. You provided 149754972919100.' }
Poloniex API is down! unable to call getBalance, retrying in 10s
{ Error: unable to sell
at /root/zenbot/extensions/exchanges/poloniex/exchange.js:206:17
at Request._callback (/root/zenbot/node_modules/poloniex.js/lib/poloniex.js:79:7)
at Request.self.callback (/root/zenbot/node_modules/poloniex.js/node_modules/request/request.js:122:22)
at emitTwo (events.js:125:13)
at Request.emit (events.js:213:7)
at Request.
ggetBalance error: { error: 'Nonce must be greater than 149754975863100. You provided 149754975106300.' }
Poloniex API is down! unable to call getBalance, retrying in 10s `
@crack00r docker-compose build, docker-compose up and after all works fine
i use ubuntu
@crack00r i see it errors too:( Our patch don't work.
While making its 1st purchase on poloniex.BCN-BTC