Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

CEXIO getTrades() returned duplicate results #641

Closed
avery1227 opened this issue Oct 18, 2017 · 8 comments
Closed

CEXIO getTrades() returned duplicate results #641

avery1227 opened this issue Oct 18, 2017 · 8 comments

Comments

@avery1227
Copy link

Hello,

I'm trying to use CEX.IO but am met with an error. I've looked around and noticed another exchange was fixed by changing it from 2 hours to 12. Any idea why this error would happen? It seems even after wiping the collection and trying again it still fails at the same spot.

fetching pre-roll data:

skipping 10457 hrs of previously collected data

cexio.BTC-USD saved 1000 trades 750 days left
.
error: getTrades() returned duplicate results
{ product_id: 'BTC-USD', from: 376024 }
{ product_id: 'BTC-USD', from: 376024 }
               DATE            PRICE     DIFF            VOL         RSI                         ACTIONS                      BAL                PROFIT
2017-10-17 21:00:00  5621.85 BTC-USD                3
2017-10-17 21:30:00  5587.00 BTC-USD   -0.62%       48
2017-10-17 22:00:00  5580.00 BTC-USD   -0.13%       16
2017-10-17 22:30:00  5589.96 BTC-USD   +0.18%       44
---------------------------- STARTING LIVE TRADING ----------------------------
Press  l  to list available commands.
/home/hype/zenbot/extensions/exchanges/cexio/exchange.js:77
        balance.currency = n(body[opts.currency].available).format('0.00000000')
                                                 ^

TypeError: Cannot read property 'available' of undefined
    at /home/xxx/zenbot/extensions/exchanges/cexio/exchange.js:77:43
    at Request.request [as _callback] (/home/xxx/zenbot/node_modules/cexio-api-node/rest.js:67:16)
    at Request.self.callback (/home/xxx/zenbot/node_modules/cexio-api-node/node_modules/request/request.js:186:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
    at Request.<anonymous> (/home/xxx/zenbot/node_modules/cexio-api-node/node_modules/request/request.js:1163:10)
    at emitOne (events.js:115:13)
    at Request.emit (events.js:210:7)
    at IncomingMessage.<anonymous> (/home/xxx/zenbot/node_modules/cexio-api-node/node_modules/request/request.js:1085:12)
    at Object.onceWrapper (events.js:314:30)
    at emitNone (events.js:110:20)
    at IncomingMessage.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1057:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
@nedievas
Copy link
Contributor

Hello, I'm aware of this issue and have fix for it. Will prepare PR, but DeviaVir is on vacation, so I'm testing for more bugs.
Quick fix at #75 change to:
if (err || typeof body === 'undefined' || body === 'error: Nonce must be incremented') return retry('getBalance', func_args, err)

@avery1227
Copy link
Author

@nedievas Didn't seem to fix it.

skipping 10457 hrs of previously collected data

cexio.BTC-USD saved 1000 trades 750 days left
.
error: getTrades() returned duplicate results
{ product_id: 'BTC-USD', from: 376024 }
{ product_id: 'BTC-USD', from: 376024 }
               DATE            PRICE     DIFF            VOL         RSI                         ACTIONS                      BAL                PROFIT
2017-10-17 21:00:00  5621.85 BTC-USD                3
2017-10-17 21:30:00  5587.00 BTC-USD   -0.62%       48
2017-10-17 22:00:00  5580.00 BTC-USD   -0.13%       16
2017-10-17 22:30:00  5589.96 BTC-USD   +0.18%       44
---------------------------- STARTING LIVE TRADING ----------------------------
Press  l  to list available commands.
/home/hype/zenbot/extensions/exchanges/cexio/exchange.js:78
        balance.currency = n(body[opts.currency].available).format('0.00000000')

Note The line is moved down one due to a comment I added.

@nedievas
Copy link
Contributor

Check if cexio-api-node module is 1.0.4 version

@avery1227
Copy link
Author

avery@vps130953:/home/hype/zenbot$ npm view cexio-api-node version
1.0.4

@avery1227
Copy link
Author

avery1227 commented Oct 18, 2017

I updated the file and am getting this error.

skipping 10457 hrs of previously collected data

cexio.BTC-USD saved 1000 trades 751 days left
.
error: getTrades() returned duplicate results
{ product_id: 'BTC-USD', from: 376024 }
{ product_id: 'BTC-USD', from: 376024 }
               DATE            PRICE     DIFF            VOL         RSI                         ACTIONS                      BAL                PROFIT
2017-10-17 21:00:00  5621.85 BTC-USD                3
2017-10-17 21:30:00  5587.00 BTC-USD   -0.62%       48
2017-10-17 22:00:00  5580.00 BTC-USD   -0.13%       16
2017-10-17 22:30:00  5589.96 BTC-USD   +0.18%       44
---------------------------- STARTING LIVE TRADING ----------------------------
Press  l  to list available commands.
/home/hype/zenbot/extensions/exchanges/cexio/exchange.js:79
        balance.currency = n(body[opts.currency].available).add(body[opts.currency].orders).format('0.00000000')
                                                 ^

TypeError: Cannot read property 'available' of undefined
    at /home/hype/zenbot/extensions/exchanges/cexio/exchange.js:79:50
    at Request.request [as _callback] (/home/hype/zenbot/node_modules/cexio-api-node/rest.js:67:16)
    at Request.self.callback (/home/hype/zenbot/node_modules/cexio-api-node/node_modules/request/request.js:186:22)
    at emitTwo (events.js:125:13)
    at Request.emit (events.js:213:7)
    at Request.<anonymous> (/home/hype/zenbot/node_modules/cexio-api-node/node_modules/request/request.js:1163:10)
    at emitOne (events.js:115:13)
    at Request.emit (events.js:210:7)
    at IncomingMessage.<anonymous> (/home/hype/zenbot/node_modules/cexio-api-node/node_modules/request/request.js:1085:12)
    at Object.onceWrapper (events.js:314:30)
    at emitNone (events.js:110:20)
    at IncomingMessage.emit (events.js:207:7)
    at endReadableNT (_stream_readable.js:1057:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

Running backfill throws this error

avery@vps130953:/home/hype/zenbot$ sudo ./zenbot.sh backfill cexio.BTC-USD

skipping 10457 hrs of previously collected data

cexio.BTC-USD saved 1000 trades 751 days left
.
error: getTrades() returned duplicate results
{ product_id: 'BTC-USD', from: 376024 }
{ product_id: 'BTC-USD', from: 376024 }

@nedievas
Copy link
Contributor

Looking into it. It backfills to much data. I get error: Rate limit exceeded on BTC-EUR.

@nedievas
Copy link
Contributor

Should be OK now. #644

DeviaVir pushed a commit that referenced this issue Oct 24, 2017
* CEXIO balance and incorrect nonce bugfix

balance undefined and nonce error crash fix. Should fix #641 issue.

* backfill fix

* quick and dirty getTrades() fix

* fix nit whitespace
@FunFR
Copy link
Contributor

FunFR commented Oct 25, 2017

The problem is not linked with error: Rate limit exceeded message.
I got the same error on the same trade 376024.

root@fa4488802bab:/app# node zenbot.js backfill cexio.BTC-USD

skipping 10457 hrs of previously collected data

cexio.BTC-USD saved 1000 trades 757 days left
.
error: getTrades() returned duplicate results
{ product_id: 'BTC-USD', from: 376024 }
{ product_id: 'BTC-USD', from: 376024 }

Can someone reopen the issue plz ? @DeviaVir ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants