kemargrant / c4d

A crypto trading robot that performs triangular arbitrage
Other
47 stars 9 forks source link

TypeError: Cannot read property 'split' of undefined #14

Closed Memoi closed 5 years ago

Memoi commented 5 years ago

Hi,

First, thanks for your great project ;)

After executed node main.js I have this error:

TypeError: Cannot read property 'split' of undefined at getPrec (C:\c4d\engines\binance.js:605:29) at binanceExchangeInfo.then (C:\c4d\engines\binance.js:612:65) at processTicksAndRejections (internal/process/task_queues.js:86:5)

########### When I use the C4DC :

Websocket connection created: 2019-04-07T14:33:31.234Z Error getting Bittrex account info Error: Error getting Bittrex account info at bittrexAPI.then (C:\c4d\engines\bittrex.js:76:19) at processTicksAndRejections (internal/process/task_queues.js:86:5) Starting Binance Socket Connections vetbtc - Binance WebSocket Client Connected: 2019-04-07T14:33:38.773Z vetusdt - Binance WebSocket Client Connected: 2019-04-07T14:33:38.778Z btcusdt - Binance WebSocket Client Connected: 2019-04-07T14:33:38.781Z WebSocket Client Connected:Listening to Binance User Account: 2019-04-07T14:33:39.083Z TypeError: Cannot read property 'one' of undefined at CryptoBot.engine.generateStrategy [as binanceGenerateStrategy] (C:\c4d\engines\binance.js:334:29) at CryptoBot.engine.Arbitrage [as binanceArbitrage] (C:\c4d\engines\binance.js:62:7) at WebSocket.client.onmessage (C:\c4d\engines\binance.js:752:10) at WebSocket.onMessage (C:\c4d\node_modules\ws\lib\EventTarget.js:99:16) at WebSocket.emit (events.js:193:13) at Receiver._receiver.onmessage (C:\c4d\node_modules\ws\lib\WebSocket.js:141:47) at Receiver.dataMessage (C:\c4d\node_modules\ws\lib\Receiver.js:389:14) at perMessageDeflate.decompress (C:\c4d\node_modules\ws\lib\Receiver.js:349:40) at _decompress (C:\c4d\node_modules\ws\lib\PerMessageDeflate.js:306:9) at _inflate.flush (C:\c4d\node_modules\ws\lib\PerMessageDeflate.js:386:7) TypeError: Cannot read property 'one' of undefined at CryptoBot.engine.generateStrategy [as binanceGenerateStrategy] (C:\c4d\engines\binance.js:322:29) at CryptoBot.engine.Arbitrage [as binanceArbitrage] (C:\c4d\engines\binance.js:62:7) at WebSocket.client.onmessage (C:\c4d\engines\binance.js:752:10) at WebSocket.onMessage (C:\c4d\node_modules\ws\lib\EventTarget.js:99:16) at WebSocket.emit (events.js:193:13) at Receiver._receiver.onmessage (C:\c4d\node_modules\ws\lib\WebSocket.js:141:47) at Receiver.dataMessage (C:\c4d\node_modules\ws\lib\Receiver.js:389:14) at perMessageDeflate.decompress (C:\c4d\node_modules\ws\lib\Receiver.js:349:40) at _decompress (C:\c4d\node_modules\ws\lib\PerMessageDeflate.js:306:9) at _inflate.flush (C:\c4d\node_modules\ws\lib\PerMessageDeflate.js:386:7) TypeError: Cannot read property 'one' of undefined at CryptoBot.engine.generateStrategy [as binanceGenerateStrategy] (C:\c4d\engines\binance.js:328:29) at CryptoBot.engine.Arbitrage [as binanceArbitrage] (C:\c4d\engines\binance.js:62:7) at WebSocket.client.onmessage (C:\c4d\engines\binance.js:752:10) at WebSocket.onMessage (C:\c4d\node_modules\ws\lib\EventTarget.js:99:16) at WebSocket.emit (events.js:193:13) at Receiver._receiver.onmessage (C:\c4d\node_modules\ws\lib\WebSocket.js:141:47) at Receiver.dataMessage (C:\c4d\node_modules\ws\lib\Receiver.js:389:14) at perMessageDeflate.decompress (C:\c4d\node_modules\ws\lib\Receiver.js:349:40) at _decompress (C:\c4d\node_modules\ws\lib\PerMessageDeflate.js:306:9) at _inflate.flush (C:\c4d\node_modules\ws\lib\PerMessageDeflate.js:386:7) ########### After executed npm test :

233 passing (15s) 1 failing

1) Binance

Precision

     Should format precision data for ltc/btc/usdt pairs:
 Uncaught AssertionError [ERR_ASSERTION]: undefined == '[6,2,2,2,6,5]'
  at Timeout.setTimeout [as _onTimeout] (test\binance.js:562:12)
  at listOnTimeout (internal/timers.js:535:17)
  at processTimers (internal/timers.js:479:7)
------------- ---------- ---------- ---------- ---------- ------------------- File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 96.99 92 92.24 98.93
c4d 99.34 95.33 97.14 100
c4d.js 99.34 95.33 97.14 100 ... 60,676,698,706
c4d/engines 95.81 90.46 90.12 98.38
binance.js 94.61 87.79 94.81 96.56 ... 45,646,647,653
bittrex.js 96.88 92.27 85.88 100 ... 11,612,622,626
------------- ---------- ---------- ---------- ---------- -------------------

npm ERR! Test failed. See above for more details.

my conf :

"Binance":
    {
        "apikey":"xxx",
        "secretkey":"xxx",
        "enabled":true,
        "pairs":[{
        "liquidTrades":true,
        "lowerLimit1":100.2,
        "lowerLimit2":99,
        "optimalTrades":true,
        "pair1":"vet_btc",
        "pair2":"btc_usdt",
        "pair3":"vet_usdt",
        "upperLimit1":100.5,
        "upperLimit2":99.99
        }]
    },

Thanks for your help :)

kemargrant commented 5 years ago

Binance was naughty and updated their api response :sweat_smile: I have updated the relevant function parsing their exchange data.

Memoi commented 5 years ago

Thanks :)

now I have this for npm test:

233 passing (17s) 1 failing

1) Binance

Stream

     Should rerun binanceStream if closed:
 Error: Timeout of 3000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (C:\c4d\test\tests.js)
------------- ---------- ---------- ---------- ---------- ------------------- File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 98.09 92.42 92.24 100
c4d 99.34 95.33 97.14 100
c4d.js 99.34 95.33 97.14 100 ... 60,676,698,706
c4d/engines 97.47 91.08 90.12 100
binance.js 98.13 89.31 94.81 100 ... 48,749,751,769
bittrex.js 96.88 92.27 85.88 100 ... 11,612,622,626
------------- ---------- ---------- ---------- ---------- -------------------

npm ERR! Test failed. See above for more details.

kemargrant commented 5 years ago

To keep this clean and tidy please open a separate issue as I am closing this one.

Memoi commented 5 years ago

I re-install all and it's ok now :), thanks

kemargrant commented 5 years ago

Awesome!