getTrades() returned duplicate result when backfill hitbtc contract
docker-compose exec server zenbot backfill hitbtc.ETH-USD --days 100
hitbtc.ETH-USD saved 100 trades 1 days left . error: getTrades() returned duplicate results { product_id: 'ETH-USD', from: 1512045503368 } { product_id: 'ETH-USD', from: 1512045503368 }
I think the culprit is in the mongodb npm module: https://github.com/mongodb/node-mongodb-native
I removed the ^ to stick to the set version, I tried mongodb 3.2 so it has to me a npm module somewhere or a requests update. Even on nodejs 8 though I get this error with any mongodb apt package. This leads me to think that is /has/ to be a npm module that got way too updated.
Rolling back to the current mongodb version now through apt, didnt work even after flushing databases. IDK..........
I have no idea.
Your best bet is this: https://serverfault.com/questions/117255/git-pull-specific-revision-from-remote-repository
And this:
https://github.com/carlos8f/zenbot/commit/d8f296b61244a52f3a7abfb45a7f386bd752f130
So what's the solution? I am getting this same error
Is there a clean option to get rid of downloaded data?
My patch to work:
--- a/extensions/exchanges/hitbtc/exchange.js
+++ b/extensions/exchanges/hitbtc/exchange.js
@@ -36,6 +36,8 @@ module.exports = function container (get, set, clear) {
var orders = {}
+ var limit = 10;
+
var exchange = {
name: 'hitbtc',
historyScan: 'forward',
@@ -49,7 +51,7 @@ module.exports = function container (get, set, clear) {
getTrades: function (opts, cb) {
var func_args = [].slice.call(arguments)
var client = publicClient()
- client.fetchTrades(joinProduct(opts.product_id)).then(result => {
+ client.fetchTrades(joinProduct(opts.product_id), null, null, {sort: 'ASC', by: 'timestamp', from: opts.from, limit: limit}).then(result => {
var trades = result.map(function (trade) {
return {
trade_id: trade.id,
@@ -60,8 +62,14 @@ module.exports = function container (get, set, clear) {
}
})
cb(null, trades)
+
+ // increment 50%
+ limit = Math.min(Math.ceil(limit * 1.5), 1000);
})
.catch(function (error) {
+ //decrement 70%
+ limit = Math.max(Math.floor(limit * 0.3), 1);
+
console.error('An error occurred', error)
return retry('getTrades', func_args)
})
Donations:
My Monero Wallet Address (XMR)
429VTmDsAw4aKgibxkk4PzZbxzj8txYtq5XrKHc28pXsUtMDWniL749WbwaVe4vUMveKAzAiA4j8xgUi29TpKXpm41bmrwQ
My Bitcoin Wallet Address (BTC)
38hcARGVzgYrcdYPkXxBXKTqScdixvFhZ4
My Ethereum Wallet Address (ETH)
0xdb77aa3d0e496c73a0dac816ac33ea389cf54681
Another Cryptocurrency: https://freewallet.org/id/edgardmessias
With the patch, the backfill is working but there is a new error using trade command.... any solution?