kemargrant / c4d

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

Test failing on my config #10

Closed crypto-maniac closed 6 years ago

crypto-maniac commented 6 years ago

Hello Kemargrant, thank you for your bot

im actually try to test the script but i got 1 error when testing with "npm test"

233 passing (16s) 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. (/Volumes/c4d/test/tests.js)

does someone have an idea for fix it please?

i use node v8.11.3 thanks you very much

EDIT: when i run this command "node main.php" i got this following error and got stuck

node main.js

Database Not Found TypeError: Cannot read property '0' of undefined at CryptoBot.binanceFormatPairs (/Volumes/c4d/c4d.js:732:78) at CryptoBot.binancePrecision.then (/Volumes/c4d/c4d.js:77:8) at at process._tickCallback (internal/process/next_tick.js:188:7)

kemargrant commented 6 years ago

Please don't post any part of your api key here. I am mobile now and will send a full reply later.

crypto-maniac commented 6 years ago

ok no problem thx you

crypto-maniac commented 6 years ago

up please thx you

crypto-maniac commented 6 years ago

here is the log i got when i run command "npm test"

i have tested on a vps & on my mac and it is same problem

root@mail:/var/www/c4d# npm test

@ test /var/www/c4d nyc mocha test/tests.js --exit

bittrexBalance collection created bittrexTrade collection created bittrexOrder collection created bittrexSwing collection created

Arbitrage

##Illiquid Trade

Binance Bot: 99.850% Sun Jul 08 2018 08:07:26 34.1ltc => 626.758 usdt @18.38 626.755152usdt => 0.070932 btc @8836 0.07082570btc => 34.15 ltc @0.002077

Illiquid trade ✓ Should return false (Illiquid Trade) (65ms)

Minimum b1 not satisfied

Binance Bot: 99.850% Sun Jul 08 2018 08:07:26 34.1ltc => 626.758 usdt @18.38 626.755152usdt => 0.070932 btc @8836 0.07082570btc => 34.15 ltc @0.002077

Minimum btc order not satisfied 2018-07-08T12:07:26.941Z ✓ Should return false

Best Trade ? (<100)

Binance Bot: 99.764% Sun Jul 08 2018 08:07:26 0.045ltc => 39.88035 usdt @886.23 39.88151865usdt => 0.003713 btc @10741.05 0.00370413btc => 0.045 ltc @0.082314

Optimal Trade Not Found: 2018-07-08T12:07:26.945Z ✓ Should return false

Minimum u1 not satisfied

Binance Bot: 100.020% Sun Jul 08 2018 08:07:26 0.004889btc => 43.23826711 usdt @8843.99 43.23829284000001usdt => 2.36004 ltc @18.321 2.36ltc => 0.004890 btc @0.002072

Minimum usdt order not satisfied 2018-07-08T12:07:26.946Z ✓ Should return false

Low Balance

Binance Bot: 100.020% Sun Jul 08 2018 08:07:26 0.004889btc => 43.23826711 usdt @8843.99 43.23829284000001usdt => 2.36004 ltc @18.321 2.36ltc => 0.004890 btc @0.002072

Wallet Balance Low: 2018-07-08T12:07:26.949Z ✓ Should return false (wallet balance low)

Trade (>100)

Binance Bot: 100.134% Sun Jul 08 2018 08:07:26 0.000744btc => 7.3968554399999995 usdt @9942.01 7.3945799999999995usdt => 0.009 ltc @821.62 0.009ltc => 0.000745 btc @0.0827523

  ✓ Should return true (64ms)

Sub-Optimal Trade: Binance Bot: 100.009% Sun Jul 08 2018 08:07:27 0.010625btc => 93.84 usdt @8832 93.84051usdt => 0.14919 ltc @629 0.15ltc => 0.010684 btc @0.071225

  ✓ Should return false (sub optimal trade)
##Trade (<100)

Binance Bot: 99.764% Sun Jul 08 2018 08:07:27 0.045ltc => 39.88035 usdt @886.23 39.88151865usdt => 0.003713 btc @10741.05 0.00370413btc => 0.045 ltc @0.082314

  ✓ Should return false
## Best Trade ? (<100)(sub optimal trade)

Sub-Optimal Trade: Binance Bot: 99.971% Sun Jul 08 2018 08:07:27 2.882ltc => 326.47296 usdt @113.28 326.473875usdt => 0.047835 btc @6825 0.04782103btc => 2.883 ltc @0.016593

  ✓ Should return false (sub optimal trade)
## Best Trade ? (>100)(sub optimal trade)
  ✓ Should return false (sub optimal trade)
##Arbitrage Error

Error: false 2018-07-08T12:07:27.103Z ✓ Should thow a promise reject Binance Arbitrage (45ms)

Format Message < 100%

  ✓ Should return a correctly formated string
#Format Message > 100%
  ✓ Should return a correctly formated string
##binanceChecCondition

Optimal Trade Not Found: 2018-07-08T12:07:27.301Z ✓ Should return false

Binance

Listen User Account

  ✓ Should return a connected websocket client (51ms)
#UserStream
  ✓ Should return a connected websocket client (152ms)

WebSocket Client Connected:Listening to Binance User Account: 2018-07-08T12:07:28.067Z ✓ Should open binance user Socket WebSocket Client Connected:Listening to Binance User Account: 2018-07-08T12:07:28.074Z Binance User Account Connect Error: Error 2018-07-08T12:07:28.074Z ✓ Should close binance user Socket ✓ Should parse a user message onMessage

ApiKeys

  ✓ should return true when the apikey and apisecret are present
#Account Data
  ✓ Should return account data
  ✓ Account Data Error

Error Getting Binance Balance: SyntaxError: Unexpected token x in JSON at position 0 at JSON.parse () at MyEmitter.response.on (/var/www/c4d/c4d.js:16:814) at emitNone (events.js:106:13) at MyEmitter.emit (events.js:208:7) at Object.end (/var/www/c4d/test/mock.js:509:54) at Promise (/var/www/c4d/c4d.js:16:1512) at new Promise () at CryptoBot.binanceAccount (/var/www/c4d/c4d.js:16:123) at Context. (/var/www/c4d/test/binance.js:550:22) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Account Data Error parsing data

Precision

  ✓ Should format precision data for ltc/btc/usdt pairs (4906ms)

Binance Pair Error: undefined Binance Pair Error: undefined ✓ Should return true (Binance Pairs Error) (794ms)

Get Orders

  ✓ Should return a list of open orders for btcusdt
  ✓ Should return a empty list
  ✓ Should return an error

Error: SyntaxError: Unexpected token x in JSON at position 0 at JSON.parse () at MyEmitter.response.on (/var/www/c4d/c4d.js:106:921) at emitNone (events.js:106:13) at MyEmitter.emit (events.js:208:7) at Object.end (/var/www/c4d/test/mock.js:509:54) at Promise (/var/www/c4d/c4d.js:106:1406) at new Promise () at CryptoBot.binanceOpenOrders (/var/www/c4d/c4d.js:106:134) at Context. (/var/www/c4d/test/binance.js:607:22) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return a parsing Error

Listen Key

  ✓ Should return a user listen key of 60 characters

ERROR ✓ Should return an Error Error: SyntaxError: Unexpected token x in JSON at position 0 at JSON.parse () at MyEmitter.response.on (/var/www/c4d/c4d.js:92:661) at emitNone (events.js:106:13) at MyEmitter.emit (events.js:208:7) at Object.end (/var/www/c4d/test/mock.js:509:54) at Promise (/var/www/c4d/c4d.js:92:1196) at new Promise () at CryptoBot.binanceListenKey (/var/www/c4d/c4d.js:92:129) at Context. (/var/www/c4d/test/binance.js:628:22) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return an Error ✓ Should return an Error (listen Key missing)

ListenUser

Error ✓ Should return an Error ✓ Should return a websocket client

Keep Alive

  ✓ Should return an empty object
#binanceListenBeat
  ✓ Should return a rejected promise with a "x}"
  ✓ Should return a rejected promise with Error
#ParseUserEvent - outboundAction
  ✓ Should return true
#ParseUserEvent - Error

Error parsing user event: SyntaxError: Unexpected token x in JSON at position 0 at JSON.parse () at CryptoBot.binanceParseUserEvent (/var/www/c4d/c4d.js:110:271) at Context. (/var/www/c4d/test/binance.js:700:16) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) 2018-07-08T12:07:33.960Z ✓ Should return false

ParseUserEvent - execution

trade updated in DB Binance Order Added: mUvoqJxFIILMdfAW5iGSOW 2018-07-08T12:07:33.971Z ✓ Should update new order in database and return true trade updated in DB Binance Order Removed: mUvoqJxFIILMdfAW5iGSOW 2018-07-08T12:07:33.977Z : 0/3 ✓ Should update the status of the order in the database and return true trade updated in DB Binance Order Removed: mUvoqJxFIILMdfAW5iGSOW 2018-07-08T12:07:33.982Z : 1/3 ✓ Should update the status of the order in the database and return true (order in position 2) trade updated in DB Binance Order Removed: mUvoqJxFIILMdfAW5iGSOW 2018-07-08T12:07:33.985Z : 2/3 ✓ Should update the status of the order in the database and return true (order in position 3)

CheckTrade (true)

Checking: [] 2018-07-08T12:07:33.990Z ✓ Should return true

CheckTrade (false)

Checking: [] 2018-07-08T12:07:33.992Z Binance Arbitrage timeout..... 2018-07-08T12:07:33.992Z ✓ Should return false

Reset

  ✓ Should return true
#Save Orders

trade updated in DB ✓ Should return a setTimeout object when percentage < 100% trade updated in DB ✓ Should return a setTimeout object when percentage > 100%

Strategy

  ✓ Should create a Binance Strategy using pair1
  ✓ Should create a Binance Strategy using pair2
  ✓ Should create a Binance Strategy using pair3
#Monitor

Error: closed before the connection is established at WebSocket.close (/var/www/c4d/node_modules/ws/lib/WebSocket.js:271:21) at list.forEach (/var/www/c4d/test/binance.js:838:16) at Array.forEach () at Context. (/var/www/c4d/test/binance.js:836:9) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) Error: closed before the connection is established at WebSocket.close (/var/www/c4d/node_modules/ws/lib/WebSocket.js:271:21) at list.forEach (/var/www/c4d/test/binance.js:838:16) at Array.forEach () at Context. (/var/www/c4d/test/binance.js:836:9) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) Error: closed before the connection is established at WebSocket.close (/var/www/c4d/node_modules/ws/lib/WebSocket.js:271:21) at list.forEach (/var/www/c4d/test/binance.js:838:16) at Array.forEach () at Context. (/var/www/c4d/test/binance.js:836:9) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return a connected websocket

Stream

Error: invalid url at WebSocket.initAsClient (/var/www/c4d/node_modules/ws/lib/WebSocket.js:537:11) at new WebSocket (/var/www/c4d/node_modules/ws/lib/WebSocket.js:72:20) at CryptoBot.binanceStream (/var/www/c4d/c4d.js:140:173) at Context. (/var/www/c4d/test/binance.js:849:28) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) 2018-07-08T12:07:34.062Z ✓ Should return undefined ltcbtc- Binance Connection Closed: 2018-07-08T12:07:34.068Z ✓ Should return a setTimeout Object ltcbtc- Binance Connection Closed: 2018-07-08T12:07:35.012Z ltcbtc- Binance Connection Closed: 2018-07-08T12:07:35.709Z ✓ Should rerun binanceStream if closed (2639ms) TypeError: Cannot read property 'b' of null at WebSocket.client.onmessage.message (/var/www/c4d/c4d.js:140:2349) at WebSocket.onMessage (/var/www/c4d/node_modules/ws/lib/EventTarget.js:99:16) at emitOne (events.js:116:13) at WebSocket.emit (events.js:211:7) at Context. (/var/www/c4d/test/binance.js:880:19) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should catch error processing message

Trade

  ✓ Should return an Error

Error trading: undefined undefined undefined undefined 2018-07-08T12:07:36.722Z ✓ Should return an Error (empty data) Error: SyntaxError: Unexpected token x in JSON at position 0 at JSON.parse () at MyEmitter.response.on (/var/www/c4d/c4d.js:154:1120) at emitNone (events.js:106:13) at MyEmitter.emit (events.js:208:7) at Object.end (/var/www/c4d/test/mock.js:509:54) at Promise (/var/www/c4d/c4d.js:154:1821) at new Promise () at CryptoBot.binanceTrade (/var/www/c4d/c4d.js:154:159) at Context. (/var/www/c4d/test/binance.js:904:22) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return an Error (bad data)

Place and Remove Order

  ✓ Should place and order for 1.00 btcusdt @ 20.00 and return a object with same symbol
  ✓ Should return error parsing cancelOrder response

Error: SyntaxError: Unexpected token x in JSON at position 0 at JSON.parse () at MyEmitter.response.on (/var/www/c4d/c4d.js:55:953) at emitNone (events.js:106:13) at MyEmitter.emit (events.js:208:7) at Object.end (/var/www/c4d/test/mock.js:509:54) at Promise (/var/www/c4d/c4d.js:55:1399) at new Promise () at CryptoBot.binanceCancelOrder (/var/www/c4d/c4d.js:55:138) at Context. (/var/www/c4d/test/binance.js:926:15) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return unexpected syntax error ✓ Should return an empty list

Reject Binance Precision

false ✓ Should reject and resolve false

binanceExchangeInfo

Exchange Info Error: SyntaxError: Unexpected token x in JSON at position 0 at JSON.parse () at MyEmitter.response.on (/var/www/c4d/c4d.js:77:617) at emitNone (events.js:106:13) at MyEmitter.emit (events.js:208:7) at Object.end (/var/www/c4d/test/mock.js:509:54) at Promise (/var/www/c4d/c4d.js:77:946) at new Promise () at CryptoBot.binanceExchangeInfo (/var/www/c4d/c4d.js:77:132) at Context. (/var/www/c4d/test/binance.js:957:22) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) 2018-07-08T12:07:36.741Z ✓ Should reject and resolve false ✓ Should reject and resolve false

Start Bot and catch binancePrecision error

  ✓ Should place and order for 1.00 btcusdt @ 20.00 and return a object with same symbol

TypeError: this.https.request is not a function at Promise (/var/www/c4d/c4d.js:77:230) at new Promise () at CryptoBot.binanceExchangeInfo (/var/www/c4d/c4d.js:77:132) at Promise (/var/www/c4d/c4d.js:114:527) at new Promise () at CryptoBot.binancePrecision (/var/www/c4d/c4d.js:114:136) at new CryptoBot (/var/www/c4d/c4d.js:11:28) at Context. (/var/www/c4d/test/binance.js:973:21) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate._onImmediate (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) false

Server Commands

Binance Server Commands (Offline)
  #binanceB1Minimum

Minimum Binance B1 Order: ltcbtc 1 ✓ Should change minimum B1 value (161ms)

binanceC1Minimum

Minimum Binance ltcbtc Order: 1 ✓ Should change minimum C1 value

binanceLimits

Binance Limits (ltcbtc) Order: { over: { lowerLimit: 1, upperLimit: 0 }, under: { lowerLimit: 0, upperLimit: 0 } } ✓ Should change Binance Limits

binanceOptimal

Binance Optimal Trades (ltcbtc) Order: false ✓ Should change Binance Optimal trading option

binanceMonitor

Binance Monitor Status: { ltcbtc: false } ✓ Should change the Binance monitor state for a selected pair

liquidTradeBinance

liquidTradesBinance: ltcbtc false ✓ Should change the Binance liquid trading option Bittrex Server Commands (Offline)

bittrex_book

View Bittrex Book: true ✓ Should enable the server to send the Bittrex order book

bittrexMonitor

Bittrex Monitor Status: false ✓ Should change the Bittrex monitor state

liquidTrade

liquidTrades: false ✓ Should change Bittrex liquid trading option

lowerLimit

Lower Limit: 99 ✓ Should change Bittrex lowerLimit

Sanity

saneTrades: false ✓ Should change Bittrex sane trading option

SwingPercentage

Swing Percentage: 0.95 ✓ Should change Bittrex swing ercentage

SwingPoll

poll_rate: 120 seconds ✓ Should change Bittrex swing polling rate

SwingReset

swing removed from DB swingTrading has been reset ✓ Should remove Bittrex trade from the database

SwingTrade

Swing Trade: true ✓ Should return true

upperLimit

Upper Limit: 99 ✓ Should change Bittrex upperLimit

update_percentage

    ✓ Should change percentage of Bittrex balance used
General Server Commands (Offline)
  #Invalid message

Error: Malformed UTF-8 data at Object.stringify (/var/www/c4d/node_modules/crypto-js/core.js:478:24) at WordArray.init.toString (/var/www/c4d/node_modules/crypto-js/core.js:215:38) at CryptoBot.serverCommand (/var/www/c4d/c4d.js:381:232) at Context. (/var/www/c4d/test/server_commands.js:156:16) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return false

logLevel

LogLevel: 1 ✓ Should return true Binance Server Commands (Network)

binance_balance

    ✓ Should get Binance balance (105ms)
  #Should activate Binance

Mock listening to user account Starting Binance Socket Connections { type: 'log', log: 'Starting Binance Socket Connections' } ltcbtc- Binance Connection Closed: 2018-07-08T12:07:37.537Z ltcbtc - Binance WebSocket Client Connected: 2018-07-08T12:07:37.754Z { type: 'log', log: 'ltcbtc - Binance WebSocket Client Connected:"2018-07-08T12:07:37.754Z"' } { type: 'binanceStatus', connections: 3, value: { ltcbtc: false }, time: { ltcbtc: false }, ustream: true } btcusdt - Binance WebSocket Client Connected: 2018-07-08T12:07:37.758Z { type: 'log', log: 'btcusdt - Binance WebSocket Client Connected:"2018-07-08T12:07:37.758Z"' } { type: 'binanceStatus', connections: 3, value: { ltcbtc: false }, time: { ltcbtc: false }, ustream: true } ltcusdt - Binance WebSocket Client Connected: 2018-07-08T12:07:37.767Z { type: 'log', log: 'ltcusdt - Binance WebSocket Client Connected:"2018-07-08T12:07:37.767Z"' } { type: 'binanceStatus', connections: 3, value: { ltcbtc: false }, time: { ltcbtc: false }, ustream: true } { type: 'binancePercent', percentage: 99.87953601186945, info: { ltcbtc: { one: [Object], two: [Object] } } } { type: 'binancePercent', percentage: 99.86768228103489, info: { ltcbtc: { one: [Object], two: [Object] } } } { type: 'binancePercent', percentage: 99.81170712081652, info: { ltcbtc: { one: [Object], two: [Object] } } } { type: 'binancePercent', percentage: 99.81185525753618, info: { ltcbtc: { one: [Object], two: [Object] } } } { type: 'binancePercent', percentage: 99.82370236201781, info: { ltcbtc: { one: [Object], two: [Object] } } } ✓ Should activate Binance (2924ms) { type: 'binanceStatus', connections: 0, value: { ltcbtc: 'killed' }, time: { ltcbtc: false }, ustream: true } Binance Socket Connections Closed: [] { type: 'log', log: 'Binance Socket Connections Closed:[]' } ✓ Should deactivate Binance

binance_orders

U2FsdGVkX1+O3QAAqhKbUG9HVCGo4q2L+EQwhmA1FrPpm7U3EXkFgDHUl3RPA5X3r+ORCe7VbQr5bN8/t9IelU3Y5QMY46NPiMl6nxhe+VyPhTMxqjmD/VBNxVgID/qf7LCt+gNhVOe3QG6GuJgPmLrjdRJZTLncU2oQdSvWvj0bvfEdCXk1g1ZxY7oCY6z1h70ywKtf8GgUbmdTcxlIX9DDbaeQ7BAuxKLSCciziUjyX5Fi62DReYABXKE4juN92s3b7Hi+cuDuB9TPYe+MzQ== U2FsdGVkX1+O3QAAqhKbUG9HVCGo4q2L+EQwhmA1FrPpm7U3EXkFgDHUl3RPA5X3r+ORCe7VbQr5bN8/t9IelU3Y5QMY46NPiMl6nxhe+VyPhTMxqjmD/VBNxVgID/qf7LCt+gNhVOe3QG6GuJgPmLrjdRJZTLncU2oQdSvWvj0bvfEdCXk1g1ZxY7oCY6z1h70ywKtf8GgUbmdTcxlIX9DDbaeQ7BAuxKLSCciziUjyX5Fi62DReYABXKE4juN92s3b7Hi+cuDuB9TPYe+MzQ== U2FsdGVkX1+O3QAAqhKbUG9HVCGo4q2L+EQwhmA1FrPpm7U3EXkFgDHUl3RPA5X3r+ORCe7VbQr5bN8/t9IelU3Y5QMY46NPiMl6nxhe+VyPhTMxqjmD/VBNxVgID/qf7LCt+gNhVOe3QG6GuJgPmLrjdRJZTLncU2oQdSvWvj0bvfEdCXk1g1ZxY7oCY6z1h70ywKtf8GgUbmdTcxlIX9DDbaeQ7BAuxKLSCciziUjyX5Fi62DReYABXKE4juN92s3b7Hi+cuDuB9TPYe+MzQ== ✓ Should resolve true

binance_orders - (send error)

Error: send error at Object.send (/var/www/c4d/test/server_commands.js:221:26) at check.forEach.order (/var/www/c4d/c4d.js:381:1507) at Array.forEach () at binanceOpenOrders.then.then (/var/www/c4d/c4d.js:381:1441) at ✓ Should reject an error

binance_orders - (api error)

ERROR ✓ Should reject an error Bittrex Server Commands (Network)

bittrex_balance

    ✓ Should get Bittrex Balance
  #bittrex_control

Starting Bittrex Stream 2018-07-08T12:07:40.140Z ✓ Should should return a bittrex client Bittrex Websocket connected: 2018-07-08T12:07:40.866Z Bittrex Websocket disconnected 2018-07-08T12:07:42.656Z Bittrex Connection closed by user 2018-07-08T12:07:42.657Z Connection Released: 2018-07-08T12:07:42.657Z Bittrex Stream Closed: 2018-07-08T12:07:42.657Z ✓ Should should stop bittrex stream (2508ms)

bittrex_db

U2FsdGVkX1+O3QAAqhKbUALxyuLp9ZjVwRHosdGXBqYexdii1G1mzU4F4gm4IS7Ew5e/eUPqIKchMydSGthmwTo3GnDLKhIH94tn7Iyp6l3/S4E//rCTnZioOYGzS15v ✓ Should return true (43ms) Database Error: TypeError: Cannot read property 'db' of null at MongoClient.connect (/var/www/c4d/c4d.js:345:393) at err (/var/www/c4d/node_modules/mongodb/lib/utils.js:415:14) at executeCallback (/var/www/c4d/node_modules/mongodb/lib/utils.js:404:25) at executeOperation (/var/www/c4d/node_modules/mongodb/lib/utils.js:422:7) at MongoClient.connect (/var/www/c4d/node_modules/mongodb/lib/mongo_client.js:168:10) at Function.MongoClient.connect (/var/www/c4d/node_modules/mongodb/lib/mongo_client.js:371:22) at CryptoBot.database (/var/www/c4d/c4d.js:345:277) at Promise (/var/www/c4d/c4d.js:365:392) at new Promise () at CryptoBot.retrieveDB (/var/www/c4d/c4d.js:365:138) at Promise (/var/www/c4d/c4d.js:381:5465) at new Promise () at CryptoBot.serverCommand (/var/www/c4d/c4d.js:381:5382) at Context. (/var/www/c4d/test/server_commands.js:284:15) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) TypeError: Cannot read property 'find' of undefined at Promise (/var/www/c4d/c4d.js:365:544) at new Promise () at CryptoBot.retrieveDB (/var/www/c4d/c4d.js:365:138) at Promise (/var/www/c4d/c4d.js:381:5465) at new Promise () at CryptoBot.serverCommand (/var/www/c4d/c4d.js:381:5382) at Context. (/var/www/c4d/test/server_commands.js:284:15) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) (node:7996) DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect. Error: send error at Object.send (/var/www/c4d/test/server_commands.js:282:27) at retrieveDB.then.que (/var/www/c4d/c4d.js:381:5549) at at process._tickCallback (internal/process/next_tick.js:188:7) ✓ Should return an Error (72ms)

bittrex_orders

order updated in DB order updated in DB U2FsdGVkX1+O3QAAqhKbUG9HVCGo4q2L+EQwhmA1FrPt3ivU3KBGeEbbFi/WiMIiUCSM1XLtqF6gGW0H3ooWM3id1XPLSdfxkepMbnUnBmWYrqDlR5Tqn0h9+5NrCajzrWnh8CjhaS+fe/OJKXLeoDmu0CCkXlvt/zzSrCK16o837eYZvVXkpgsg2WtO0vUUR6LV1X9FQOz5wMXGGPUUm1TPD/NQz3ZDMb6nSOhZ3vhPnDOOr/fDA+VyuJROrXHGe/DdQzaigSm6gM0gIpwXgX0vH98pfJ1n90aQZdb2WSwdVvUp4szDGekGVUs6naGk U2FsdGVkX1+O3QAAqhKbUG9HVCGo4q2L+EQwhmA1FrPt3ivU3KBGeEbbFi/WiMIiUCSM1XLtqF6gGW0H3ooWM5yblm7JoCfAJVzcU/YIeElJy35aULOMUr2H7NnS0CNSlOY7w1We2eihR/pfaBsbKdcVCJW4jMTZnV8l2SJfmbOvWcXZ/MPBEFxX7RktaEvKrl3aFsn2WgF61PszhvxkgWT4aCJsA546z3amBx0aZJ0hFHVoFCjoRlvNUGBgcvXyXkNCV60x0EvOtSrmr00u5XagbW/0s7m0qMkZk6bvLB2SM0O7neDMVw+6jr0PUJ1tBaUo+uyQtdIDlOF6GTz5zQ== ✓ Should return true Bittrex API Error => ERROR 2018-07-08T12:07:42.798Z ERROR ERROR ✓ Should return an Error Server Commands (Network)

Connect

U2FsdGVkX1+O3QAAqhKbUO48cS8VNGYNOA7wDD/DnMcK1abOf1dc+l3ZMkkH+jlGO2VjNskczbhpiBAjrCo0Sw== U2FsdGVkX1+O3QAAqhKbUD6sCIDyL7Og5RZBMk8oY+S47UKfDytsGioo/Zb3oaklAq0DTOvC6frwk1xOG4KYQIT+Y7jfAbDmBKyqmwtIKTQwbiE7pMSIi8HwgzAZp3UBsLuydICYZXhGhIXRcWC2Zaw/57TfKvQ54VIW1NSosngiIjUcuySkT75WUCKbbJqBakUfsBarPKqG0tZa8xxfplch4sc3b8JhUY0YhrCOfdfxAughFnNBQjDx0npUvslFxSxJy8czOetHe40o0RzAKy/mi2EeC8vNT11geSjeUPfgMw9p236IFoDgFBiudN2Y U2FsdGVkX1+O3QAAqhKbUCWnxtOrjpdWQwKA/tqClfC6LOaYoqS2j9gILqp4poNufKS2/e2uL9H5O9yUpfy/vT6Wl2DHOEVw7Un6VUa6DLRbmGjQge/jDlELknv6J/Un U2FsdGVkX1+O3QAAqhKbUHHW8cl4If+q7uAFGxuA4cCLQjMktJCrx8kN4OoQfowiqp9VrDW28qzE97S4BVRfw3ZtlTjMwKn5YGxdKrVfT+xymATffvTwwcx3Xed2wMYD7x0SWrJZPkN5ofM/9s6aNiPXe1VjVsxWxkDGIurOdH0m1dycRKgxC1wvGmQ8Ei744kXxqNeudzJ2A/Af9AVZKtYMq7n77Db7RMGGo8beorWi3a3fh2Qc7EdV+fFdcUAZXfBKxOCTOuSThsnUJuOku38zEpW0yZ3nExN00E2J8gnJlFpQBWElXfDRKMF1p6WGO4xhbALzcTg67JGOfBtr8II0CqFAqXbqchTRvnu9dA4HJTLi+Vfdg+gBDTW+ufylwpHJeGDRkRa46EqETpNYUlHEWYhISc4ZYUIhQkvha0TOfn+rTixzJur1N5VINSSN7X0w/tjQEjBELOUIw/atw6/UHzJI2B3JDM/xPyuNJiYBvoZDMvGi9i4ms/mHydSQ11865c6eAZsTM2iA3DrKqYjM+fWrI9yuLBnu37mnBdbipSyH8GUFJdgo4zMNJ4qiaMp3jsxa01FqgywzJ0LjxA/07nc3OcpEJ5MaNvPiE5AhFYqzt4IFQk0+6ErBJ4t1F+HgKXeJcjJgSV60lELFv0ZtPx/y0zt5goXZiwYGje6yYjjulzZmtgOcdBgdaaty/O2FC8/doIb7U0gGVSqj0RjHQuZn1n7CDn1xtPpN3k2fXZEL0HU1lr90Y7JiPB2fQnKkj5Ar5pP6XRMj4mlIj2eZfpE6cfXu3ziq7TrkzzkultgeI9VGW89Dtlo3a23x ✓ Should return true

Utilities

BubbleSort

  ✓ Should sort in decreasing order
#Solve > 100%
  ✓ Should return the ideal solution when ratio > 100%
#Solve < 100%
  ✓ Should return the ideal solution when ratio < 100%
#Solve < 100 wasm vs js
  ✓ Should return the ideal solution faster than js
#Solve > 100 wasm vs js
  ✓ Should return the ideal solution faster than js
#Enable Wasm
  ✓ Should enable wasm code

Bittrex

ApiKeys

  ✓ should return true when the apikey and apisecret are present
#Api

Bittrex API Error => ERROR 2018-07-08T12:07:42.832Z ✓ Should catch an Api Error Body: x} 2018-07-08T12:07:42.870Z Bittrex API Error: SyntaxError: Unexpected token x in JSON at position 0 at JSON.parse () at MyEmitter.response.on (/var/www/c4d/c4d.js:160:1206) at emitNone (events.js:106:13) at MyEmitter.emit (events.js:208:7) at Object.end (/var/www/c4d/test/mock.js:505:52) at Promise (/var/www/c4d/c4d.js:160:1805) at new Promise () at CryptoBot.bittrexAPI (/var/www/c4d/c4d.js:160:135) at Context. (/var/www/c4d/test/bittrex.js:32:15) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should catch error parsing API response (38ms)

Account Data

  ✓ Should return account data

Error getting Bittrex account info ✓ Should catch error getting account data

Get Open Orders

order updated in DB order updated in DB ✓ Should return open orders list Bittrex API Error => ERROR 2018-07-08T12:07:42.967Z ERROR ✓ Should catch an error

Market Depth

using prox { host: 'bittrex.com', path: '/api/v1.1/public/getorderbook?market=USDT-BTC&type=both', method: 'GET' } ✓ Should return an object with bid and ask price ERROR ✓ Should return an error ✓ Should return an error (empty data) ✓ Should return an error (bad data)

Cancel Order

Bittrex API Error => ERROR 2018-07-08T12:07:42.993Z Error Canceling Bittrex Order: ERROR undefined ✓ Should return false (error) Error Canceling Bittrex Order: undefined ✓ Should return false (empty data)

Place and Remove Order

Order:buy,USDT-BTC 1@20 { uuid: '614c34e4-8d71-11e3-94b5-425861b86ab6' } 2018-07-08T12:07:43.004Z ✓ Should place an order for 1.00 btcusdt @ 20.00 and return a object with same symbol Order:buy,USDT-BTC 1@20 { uuid: 'not-a-real-uuid' } 2018-07-08T12:07:43.010Z ✓ Should place an order for 1.00 btcusdt @ 20.00 and save it in the db

Trades

Bittrex API Error => ERROR 2018-07-08T12:07:43.015Z Error Placing Order: ERROR 2018-07-08T12:07:43.016Z Trade Error:buy/USDT-BTC/1/20 Slack Webhook Error: ERROR ✓ Should return an Error (API Error) Order:buy,USDT-BTC 1@20 false 2018-07-08T12:07:43.019Z Error Placing Order: 2018-07-08T12:07:43.020Z Trade Error:buy/USDT-BTC/1/20 ✓ Should return an Error - (Undefined Trade)

Swing Orders

  #Reset a swing order

swing removed from DB ✓ Should return true

Swing

TypeError: Cannot read property 'OrderUuid' of undefined at CryptoBot.bittrexSwingSupervisor (/var/www/c4d/c4d.js:321:321) at retrieveDB.then.trades (/var/www/c4d/c4d.js:311:670) at ✓ Should return 2 ✓ Should return 0 ✓ Should return 2

Prepare Swing Order

Unable to find order:order-does-not-exist Swing Error. Unable to find:order-does-not-exist ✓ Should return a setTimeout Object > 0 (Unable to find Order) swing updated in DB Order:1234 Filled Error Getting Bittrex balance: TypeError: list.forEach is not a function at bittrexAPI.then.list (/var/www/c4d/c4d.js:164:562) at at process._tickCallback (internal/process/next_tick.js:188:7) ✓ Should return a setTimeout Object > 0 (Order is filled) (node:7996) UnhandledPromiseRejectionWarning: TypeError: list.forEach is not a function at bittrexAPI.then.list (/var/www/c4d/c4d.js:164:562) at at process._tickCallback (internal/process/next_tick.js:188:7) (node:7996) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 31) (node:7996) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. swing updated in DB ✓ Should return a setTimeout Object > 0 (Order is not filled) Error: API Error at Promise (/var/www/c4d/test/bittrex.js:256:19) at new Promise () at CryptoBot.bot.bittrexAPI (/var/www/c4d/test/bittrex.js:255:39) at Promise (/var/www/c4d/c4d.js:316:224) at new Promise () at CryptoBot.bittrexSwingOrder (/var/www/c4d/c4d.js:316:135) at Context. (/var/www/c4d/test/bittrex.js:258:15) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate._onImmediate (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return a setTimeout Object > 0 (Api Error) order added to DB: 2018-07-08T12:07:43.082Z

Create Bittrex swing order

false ✓ Should return a setTimeout Object > 0 (API Error) Bittrex swing order error ✓ Should return a setTimeout Object > 0 (Error placing order) swing updated in DB ✓ Should return a setTimeout Object > 0 (Order Complete)

Supervise Bittrex swing order

    ✓ Should return a object with a status of 2

using prox { host: 'bittrex.com', path: '/api/v1.1/public/getorderbook?market=BTC-USDT&type=both', method: 'GET' } Buying (Target/Price): NaN/0.0254 ✓ Should return a object with a status of 2 Buying (Target/Price): 0.95/0.5 Notify: BTC-USDT Buying undefined @0.5 Order:buy,BTC-USDT undefined@0.5 { uuid: '614c34e4-8d71-11e3-94b5-425861b86ab6' } 2018-07-08T12:07:43.105Z swing updated in DB ✓ Should return a object with a status of 1 using prox { host: 'bittrex.com', path: '/api/v1.1/public/getorderbook?market=BTC-USDT&type=both', method: 'GET' } Selling (Target/Price): 1.02/0.02525 ✓ Should return a object with a status of 2 Selling (Target/Price): 0.9450000000000001/2.5 BTC-USDT Selling undefined @2.5 Order:sell,BTC-USDT undefined@2.5 { uuid: '614c34e4-8d71-11e3-94b5-425861b86ab6' } 2018-07-08T12:07:43.129Z swing updated in DB ✓ Should return a object with a status of 1 Unable to find order:1234 Swing Error. Unable to find:1234 { buy: 2.5 } ✓ Should return a object with a status of 2 ✓ Should return a object with a status of 2 (Undefined Order - Low account balance) { buy: 2.5 } ✓ Should return a object with a status of 2 (Undefined Order - Low account balance) Order:buy,BTC-USDT NaN@undefined { uuid: '614c34e4-8d71-11e3-94b5-425861b86ab6' } 2018-07-08T12:07:43.161Z swing updated in DB ✓ Should return a object with a status of 2 (Undefined Order - Low account balance) Unable to find order:123422 Swing Error. Unable to find:123422 Unable to find order:2233 Swing Error. Unable to find:2233

UpdateBittrexSocketStatus

2018-07-08T12:07:43.181Z ✓ Should update Bittrex socket status to false

BittrexStream

  ✓ Should return a signal-r client

Bittrex Websocket connected: 2018-07-08T12:07:43.192Z Bittrex AuthContext Error: No Hub 2018-07-08T12:07:43.194Z ✓ Should update bittrexSocketStatus (connected) Unable to find order:614c34e4-8d71-11e3-94b5-425861b86ab6 Notify: Swing Error. Unable to find:614c34e4-8d71-11e3-94b5-425861b86ab6 Bittrex Websocket disconnected 2018-07-08T12:07:43.200Z Bittrex Connection closed by user 2018-07-08T12:07:43.200Z ✓ Should update bittrexSocketStatus (disconnected) Bittrex Connection Error: test error 2018-07-08T12:07:43.207Z ✓ Should send error message (onerror) Bittrex Websocket disconnected 2018-07-08T12:07:43.213Z Restarting Bittrex Websocket: 2018-07-08T12:07:43.213Z ✓ Should update bittrexSocketStatus (disconnected -> reconnect) ✓ Should test bittrex client message received (false) ✓ Should test bittrex client message received (Exchange Delta) ✓ Should test bittrex client message received (Parse User Event) Error processing Bittrex message: TypeError: Cannot read property 'utf8Data' of null at Object.messageReceived (/var/www/c4d/c4d.js:280:2796) at Context. (/var/www/c4d/test/bittrex.js:600:40) at callFnAsync (/var/www/c4d/node_modules/mocha/lib/runnable.js:400:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:342:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should test bittrex client message received (Error parsing data)

BittrexReset

  ✓ Should reset Bittrex Settings
#BittrexArbitrage

Bittrex Bot:99.160% 50xvg => 3.33165usdt @0.0668 3.33165usdt => 0.00047462btc @7002 0.00047462btc => 50.04629563xvg @0.00000946 Bittrex Bot:99.160% 50xvg => 3.33165usdt @0.0668 3.33165usdt => 0.00047462btc @7002 0.00047462btc => 50.04629563xvg @0.00000946 {BTC-XVG:{Bids:{0.00000935:177736.67607308,0.00000934:168406.20040576,0.00000941:246247.11347046,0.00000933:806153.72096553,0.0000094:130311.9584391,0.00000937:57715.97429635,0.00000932:56893.97801209,0.00000944:52588.24727826,0.00000931:5418.8456638,0.0000093:325259.39485015,0.00000929:21993.5475581,0.00000939:1488.41551863,0.00000928:6144.35042782,0.00000943:62335.77491848,0.00000942:194422.68953821,0.00000936:6156.32661058,0.00000945:9224.24046306,0.00000938:54447.0523079,0.00000437:30591.58258601,0.00000804:75488.29386194,0.00000946:5000,0.00000923:152234.80161826},Asks:{0.00001067:139628.86374338,0.00000957:12704.936,0.00000958:1206.98995182,0.00000959:203234.48913872,0.00001107:13252.61668382,0.00001321:34410.23134784,0.00001069:541137.88663137,0.00001079:23418.00605597,0.00001109:54851.23771928,0.00001139:61587.35093591,0.00001169:551958.61609209,0.00001199:207714.14892068,0.00001229:13993.50731628,0.00000972:68521.45603638,0.00000954:19139.23,0.00001099:380339.20418425,0.00000964:31549.63358153,0.00001129:30308.0324902,0.00000999:1608201.04788848,0.00000956:938.94736842,0.00001048:189869.80293133,0.00001026:614956.96984732,0.00001159:9384.16459402,0.00000963:64529.78917268,0.00001189:73699.54974228,0.0000099:1358029.58117685,0.00000965:989205.51850482,0.00001219:17262.25076961,0.00000993:39489.89366525,0.00001008:7635.64584503,0.00000962:3981.43298708,0.00001249:497678.91588004,0.00001:4678053.28676305,0.00001279:18519.48158389,0.000011:9227787.02394865,0.0000096:21201.00872878,0.00000998:1352172.45440375,0.00000952:8505,0.0000095:3934.27346341,0.00000973:117461.64691699,0.00000975:206787.19418613,0.0000105:2019367.53492326,0.00000949:185693.34306734,0.00000955:4786.66653039,0.00001005:738364.06061029,0.0000102:777740.30671606,0.0000098:1275054.5914987,0.00001462:44147.2731254,0.00000961:134543.62394627,0.00001463:125,0.00001066:63539.1632226,0.00000953:50957.064},Sorted:[[0.00000975,0.00000973,0.00000972,0.00000965,0.00000964,0.00000963,0.00000962,0.00000961,0.0000096,0.00000959,0.00000958,0.00000957,0.00000956,0.00000955,0.00000954,0.00000953,0.00000952,0.0000095,0.00000949],[0.00000946,0.00000945,0.00000944,0.00000943,0.00000942,0.00000941,0.0000094,0.00000939,0.00000938,0.00000937,0.00000936,0.00000935,0.00000934,0.00000933,0.00000932,0.00000931,0.0000093,0.00000929,0.00000928,0.00000923,0.00000804,0.00000437]]},USDT-BTC:{Bids:{6440:0.68762682,6900:5.40428237,6905:0.13603731,6935:5,7000:0.49209678,7001:11.00245642,7002:13.17295996,6927.37450694:0.71377587,6967.985:0.00640777,6965.001:0.3,6924.44201232:0.01427144,6962.9439:2,6968.424:0.3,6947.29003697:1.10977961,7000.49000099:1,6965.98300001:0.2,6954.237:0.35539,6931.7:0.0156,6965.98248789:0.2,6863.42020097:0.40227639,6912.143:3.5539,6861.96:0.85068099,6442.1:1.03},Asks:{7035:2,7250:1.23283052,7048.99999999:1.22934544,7015.49000095:1.12017797,7046.99999999:0.2,7455.4362112:1.0228233,7455.70762252:0.8913986,7015.48888899:0.16546088,7013.49000099:0.91574102,7042.77618474:0.2,7046.22638225:1.13036081,7456.24335735:0.25,7456.74567456:0.1,7013.48888899:0.99784135,7175.118:1.6739,7022.482965:0.95042382,7127.99999999:0.81599489,7038.404:0.3,7455.86542235:0.93265874,7042.77618475:0.2,7080.243:3.5539,7066.47096:0.71377587,7129.99999999:0.81599489},Sorted:[[7175.118,7129.99999999,7127.99999999,7080.243,7066.47096,7048.99999999,7046.99999999,7046.22638225,7042.77618475,7042.77618474,7038.404,7035,7022.482965,7015.49000095,7015.48888899,7013.49000099,7013.48888899],[7002,7001,7000.49000099,7000,6968.424,6967.985,6965.98300001,6965.98248789,6965.001,6962.9439,6954.237,6947.29003697,6935,6931.7,6927.37450694,6924.44201232,6912.143,6905,6900,6863.42020097,6861.96,6442.1,6440]]},USDT-XVG:{Bids:{0.062:279022.77852304,0.06205:125000,0.06475063:24262.16727698,0.06550001:532118,0.0621:501710.27265467,0.06426766:532118,0.06585:137.14743216,0.06630008:5863.22266923,0.06570001:53212},Asks:{0.07:175574.59159383,0.0668:163136.33725674,0.072:216572.24829475,0.0669:3900},Sorted:[[0.0669,0.0668],[0.06630008,0.06585,0.06570001,0.06550001,0.06475063,0.06426766,0.0621,0.06205,0.062]]}} ------------> ✓ Should return valid trades (converting percentage to < 100%) Unable to find order:614c34e4-8d71-11e3-94b5-425861b86ab6 Swing Error. Unable to find:614c34e4-8d71-11e3-94b5-425861b86ab6 Unable to find order:614c34e4-8d71-11e3-94b5-425861b86ab6 Swing Error. Unable to find:614c34e4-8d71-11e3-94b5-425861b86ab6 Error getting Bittrex account info Error: Error getting Bittrex account info at bittrexAPI.then.list (/var/www/c4d/c4d.js:164:453) at at process._tickCallback (internal/process/next_tick.js:188:7) Bittrex Bot:94.186% 70xvg => 8849.14219945usdt @126.73315001 8849.14219945usdt => 1.16914163btc @7550 1.16914163btc => 73.76462877xvg @0.01581 Bittrex Bot:94.186% 70xvg => 8849.14219945usdt @126.73315001 8849.14219945usdt => 1.16914163btc @7550 1.16914163btc => 73.76462877xvg @0.01581 {BTC-XVG:{Bids:{0.015695:34.3302,0.0156676:69.14763243,0.01568212:0.19986397,0.01566761:3.1734637},Asks:{0.01581:23.5128,0.01583974:31.56617868},Sorted:[[0.01583974,0.01581],[0.015695,0.01568212,0.01566761,0.0156676]]},USDT-BTC:{Bids:{7550:10.24736956},Asks:{8100:0.47976607},Sorted:[[],[7550]]},USDT-XVG:{Bids:{126.73315001:12.89646924,126.131565:7.8462142},Asks:{2247:0.6},Sorted:[[],[126.73315001,126.131565]]}} ✓ Should return valid trades (< 100%) Bittrex Bot:100.845% 0.0046btc => 31.926783usdt @6958 31.926783usdt => 486.88981303xvg @0.06540898 486.88981303xvg => 0.00460418btc @0.00000948 Bittrex Bot:100.845% 0.0046btc => 31.926783usdt @6958 31.926783usdt => 486.88981303xvg @0.06540898 486.88981303xvg => 0.00460418btc @0.00000948 {BTC-XVG:{Bids:{0.00000926:2151.40394194,0.0000093:23723.73894797,0.00000931:17782.02792092,0.00000929:805424.03642088,0.00000925:144652.83167159,0.00000934:626903.61429171,0.00000932:6725.36400531,0.00000935:97026.03483044,0.00000936:42966.19325215,0.00000927:423.84348644,0.00000928:27925.22182831,0.0000094:4446,0.00000933:2781.0386194,0.00000941:77295.56168966,0.00000942:600,0.00000943:21126.39385958,0.00000946:4315.48419012,0.00000937:2768.65297759,0.00000911:189967.13895557,0.00000947:764699.07004213,0.00000917:6482.90294982,0.00000919:29756.21904679,0.00000938:207.17120735,0.0000092:344468.49384478,0.00000948:320255.62279944},Asks:{0.00001:4302403.25760144,0.00001081:124396.60844481,0.00000967:217083.87848411,0.00000968:1084990.55927296,0.00000955:342783.61995143,0.00001414:56812.66750839,0.00001057:30646.84443991,0.00001044:424225.75201431,0.00001449:69650.75299448,0.0000145:378842.09026772,0.0000095:951540.53857042,0.00000982:47642.02130445,0.00000975:359686.49409538,0.00001451:4000,0.00000979:132307.07322413,0.00000951:146234.01798573,0.00001452:166896.36555556,0.00000953:158973.81440678,0.00001453:903.16767691,0.00000952:29383.22847591,0.00001008:31124.03845864,0.0000143:120002.22534416,0.00001066:83754.62180738,0.00001454:4403.56181928,0.0000125:1753455.27601092,0.0000105:1962464.53514945,0.00001455:6001.9,0.00001456:20485.1999267,0.00001457:25006.90162722,0.00001031:5465.00836993,0.00000966:209964.06152264,0.00000957:157756.07923367,0.0000096:968078.62370724,0.00000949:142725.65251417,0.00000999:1858169.14673934,0.00000997:233894.99327188,0.00000994:114979.90228104,0.00001458:2770.30667405,0.00001148:15695.42168497,0.00001018:25604.72018923,0.00000959:551472.74226511,0.00000995:323520.55671123,0.00000991:30300.26882981,0.00001459:12000,0.0000097:553021.91524797,0.0000146:217078.40738137,0.00000961:26592.61701879,0.00000965:361242.38612578,0.00001461:7500,0.00000962:18157.19005026,0.00001462:44147.2731254,0.00000963:47778.0010685,0.00001463:125,0.00000964:81448.48724614,0.00001464:2602.82106453},Sorted:[[0.00000979,0.00000975,0.0000097,0.00000968,0.00000967,0.00000966,0.00000965,0.00000964,0.00000963,0.00000962,0.00000961,0.0000096,0.00000959,0.00000957,0.00000955,0.00000953,0.00000952,0.00000951,0.0000095,0.00000949],[0.00000948,0.00000947,0.00000946,0.00000943,0.00000942,0.00000941,0.0000094,0.00000938,0.00000937,0.00000936,0.00000935,0.00000934,0.00000933,0.00000932,0.00000931,0.0000093,0.00000929,0.00000928,0.00000927,0.00000926,0.00000925,0.0000092,0.00000919,0.00000917,0.00000911]]},USDT-BTC:{Bids:{6900:1.33351737,6905:0.00696175,6909:0.01876911,6910:0.1682451,6911:1.07045154,6935:0.0878917,6958:0.78627814,6935.00100001:3.98847995,6935.00500001:1.618,6935.011:0.35539,6910.243:0.71845839,6938.001:0.3,6938.00000002:0.04246449,6955.39499999:5.82785475,6510.03000008:0.13128223,6942.60000001:1.736,6932.00000002:0.35865371,6902.99999999:0.00299086,6901.7341379:1.39249854,6901.73413791:0.02405074,6511.53500031:0.16976473,6511.5:14.26464667,6875.11309635:0.01437194,6924.76683868:1.87022146,6935.01100001:0.35849799},Asks:{6965:3.26876863,6970:0.00107701,6990:5.59671907,7066:0.07140629,7090:0.50705786,7098:0.11981035,7400:19.6113837,7001.64882775:1.19968095,7004.85148933:1.19968095,7004.59994339:1.19968095,7004.78157517:1.19968095,7216.5:0.15,7415.38721055:0.01649583,7016.356:0.35539,7058.84091909:0.00759757,6988.8:0.00572595,7007.685:0.3,7006.98419417:1.19626461,7089.03092192:0.09886516,7042.82:0.71845839,7004.99999999:0.169,7007.68499999:1.592,7054.67352459:0.71845839,7415.39870889:0.00179634,7010.45040499:1.19626461,7023.82590084:1.78535048,7064.99999998:0.81603094},Sorted:[[7098,7090,7089.03092192,7066,7064.99999998,7058.84091909,7054.67352459,7042.82,7023.82590084,7016.356,7010.45040499,7007.685,7007.68499999,7006.98419417,7004.99999999,7004.85148933,7004.78157517,7004.59994339,7001.64882775,6990,6988.8,6970,6965],[6958,6955.39499999,6942.60000001,6938.001,6938.00000002,6935.01100001,6935.011,6935.00500001,6935.00100001,6935,6932.00000002,6924.76683868,6911,6910.243,6910,6909,6905,6902.99999999,6901.73413791,6901.7341379,6900,6875.11309635,6511.53500031,6511.5,6510.03000008]]},USDT-XVG:{Bids:{0.0641:31123.2449298,0.05709007:5940.93300853,0.06413059:532118,0.06:169266.17839427,0.06451002:77313.57082202,0.06451025:100070.82711346,0.057:571006.11653107,0.06451047:21613.489,0.06451063:77313.57082202,0.06485983:29055.268,0.06485985:77313.57082202,0.06429639:3527.28526795,0.0642992:775.67546285,0.06429921:24408.29414109,0.06451:1725.71983651,0.06451001:53212,0.06486:236.17234,0.06486003:76896.49893131,0.06486002:72877.049,0.06486008:74354.812,0.0648601:17598.125,0.0301001:10000,0.06486012:76896.49893131},Asks:{0.06569733:7569.97343839,0.06691:21716.29126637,0.06569731:53211,0.072:198428.99688064,0.06569713:30202.963,0.06569682:32500,0.06616788:219008,0.18629008:86858.05676626,0.06540898:8448.92897305,0.18637116:7903.69912212,0.18796:42790.78609125,0.06598999:53211},Sorted:[[0.06691,0.06616788,0.06598999,0.06569733,0.06569731,0.06569713,0.06569682,0.06540898],[0.06486012,0.0648601,0.06486008,0.06486003,0.06486002,0.06486,0.06485985,0.06485983,0.06451063,0.06451047,0.06451025,0.06451002,0.06451001,0.06451,0.06429921,0.0642992,0.06429639,0.06413059,0.0641,0.06,0.05709007,0.057,0.0301001]]}} ✓ Should return valid trades (> 100%) ✓ Should return an array with length < 3 (Illiquid Trade) ✓ Should return an array with length < 3 (In processs) Bittrex Bot:99.160% 5000xvg => 333.165usdt @0.0668 333.165usdt => 0.04746245btc @7002 0.04746245btc => 5004.62956342xvg @0.00000946 Bittrex Bot:99.160% 5000xvg => 333.165usdt @0.0668 333.165usdt => 0.04746245btc @7002 0.04746245btc => 5004.62956342xvg @0.00000946 {BTC-XVG:{Bids:{0.00000935:177736.67607308,0.00000934:168406.20040576,0.00000941:246247.11347046,0.00000933:806153.72096553,0.0000094:130311.9584391,0.00000937:57715.97429635,0.00000932:56893.97801209,0.00000944:52588.24727826,0.00000931:5418.8456638,0.0000093:325259.39485015,0.00000929:21993.5475581,0.00000939:1488.41551863,0.00000928:6144.35042782,0.00000943:62335.77491848,0.00000942:194422.68953821,0.00000936:6156.32661058,0.00000945:9224.24046306,0.00000938:54447.0523079,0.00000437:30591.58258601,0.00000804:75488.29386194,0.00000946:5000,0.00000923:152234.80161826},Asks:{0.00001067:139628.86374338,0.00000957:12704.936,0.00000958:1206.98995182,0.00000959:203234.48913872,0.00001107:13252.61668382,0.00001321:34410.23134784,0.00001069:541137.88663137,0.00001079:23418.00605597,0.00001109:54851.23771928,0.00001139:61587.35093591,0.00001169:551958.61609209,0.00001199:207714.14892068,0.00001229:13993.50731628,0.00000972:68521.45603638,0.00000954:19139.23,0.00001099:380339.20418425,0.00000964:31549.63358153,0.00001129:30308.0324902,0.00000999:1608201.04788848,0.00000956:938.94736842,0.00001048:189869.80293133,0.00001026:614956.96984732,0.00001159:9384.16459402,0.00000963:64529.78917268,0.00001189:73699.54974228,0.0000099:1358029.58117685,0.00000965:989205.51850482,0.00001219:17262.25076961,0.00000993:39489.89366525,0.00001008:7635.64584503,0.00000962:3981.43298708,0.00001249:497678.91588004,0.00001:4678053.28676305,0.00001279:18519.48158389,0.000011:9227787.02394865,0.0000096:21201.00872878,0.00000998:1352172.45440375,0.00000952:8505,0.0000095:3934.27346341,0.00000973:117461.64691699,0.00000975:206787.19418613,0.0000105:2019367.53492326,0.00000949:185693.34306734,0.00000955:4786.66653039,0.00001005:738364.06061029,0.0000102:777740.30671606,0.0000098:1275054.5914987,0.00001462:44147.2731254,0.00000961:134543.62394627,0.00001463:125,0.00001066:63539.1632226,0.00000953:50957.064},Sorted:[[0.00000975,0.00000973,0.00000972,0.00000965,0.00000964,0.00000963,0.00000962,0.00000961,0.0000096,0.00000959,0.00000958,0.00000957,0.00000956,0.00000955,0.00000954,0.00000953,0.00000952,0.0000095,0.00000949],[0.00000946,0.00000945,0.00000944,0.00000943,0.00000942,0.00000941,0.0000094,0.00000939,0.00000938,0.00000937,0.00000936,0.00000935,0.00000934,0.00000933,0.00000932,0.00000931,0.0000093,0.00000929,0.00000928,0.00000923,0.00000804,0.00000437]]},USDT-BTC:{Bids:{6440:0.68762682,6900:5.40428237,6905:0.13603731,6935:5,7000:0.49209678,7001:11.00245642,7002:13.17295996,6927.37450694:0.71377587,6967.985:0.00640777,6965.001:0.3,6924.44201232:0.01427144,6962.9439:2,6968.424:0.3,6947.29003697:1.10977961,7000.49000099:1,6965.98300001:0.2,6954.237:0.35539,6931.7:0.0156,6965.98248789:0.2,6863.42020097:0.40227639,6912.143:3.5539,6861.96:0.85068099,6442.1:1.03},Asks:{7035:2,7250:1.23283052,7048.99999999:1.22934544,7015.49000095:1.12017797,7046.99999999:0.2,7455.4362112:1.0228233,7455.70762252:0.8913986,7015.48888899:0.16546088,7013.49000099:0.91574102,7042.77618474:0.2,7046.22638225:1.13036081,7456.24335735:0.25,7456.74567456:0.1,7013.48888899:0.99784135,7175.118:1.6739,7022.482965:0.95042382,7127.99999999:0.81599489,7038.404:0.3,7455.86542235:0.93265874,7042.77618475:0.2,7080.243:3.5539,7066.47096:0.71377587,7129.99999999:0.81599489},Sorted:[[7175.118,7129.99999999,7127.99999999,7080.243,7066.47096,7048.99999999,7046.99999999,7046.22638225,7042.77618475,7042.77618474,7038.404,7035,7022.482965,7015.49000095,7015.48888899,7013.49000099,7013.48888899],[7002,7001,7000.49000099,7000,6968.424,6967.985,6965.98300001,6965.98248789,6965.001,6962.9439,6954.237,6947.29003697,6935,6931.7,6927.37450694,6924.44201232,6912.143,6905,6900,6863.42020097,6861.96,6442.1,6440]]},USDT-XVG:{Bids:{0.062:279022.77852304,0.06205:125000,0.06475063:24262.16727698,0.06550001:532118,0.0621:501710.27265467,0.06426766:532118,0.06585:137.14743216,0.06630008:5863.22266923,0.06570001:53212},Asks:{0.07:175574.59159383,0.0668:163136.33725674,0.072:216572.24829475,0.0669:3900},Sorted:[[0.0669,0.0668],[0.06630008,0.06585,0.06570001,0.06550001,0.06475063,0.06426766,0.0621,0.06205,0.062]]}} ✓ Should return an array with length < 3 (try/catch) ✓ Should return an array with length < 3 (Percentage != Number) ✓ Should return an array with length < 3 (Failed to generate a strategy) Bittrex Arbitrage Error: TypeError: Cannot read property 'BTC-XVG' of null at CryptoBot.bittrexArbitrage (/var/www/c4d/c4d.js:180:524) at Context. (/var/www/c4d/test/bittrex.js:760:21) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return an array with length < 3 (try/catch error)

BittrexStartArbitrage

  ✓ Should return false

Starting Trades: 2018-07-08T12:07:44.221Z 0 0 0 0 0 0 undefined ✓ Should return a promise Bittrex Orders Made: [ { uuid: 1531051664222 }, { uuid: 1531051664222 }, { uuid: 1531051664222 } ] Starting Trades: 2018-07-08T12:07:44.225Z 0 0 0 0 0 0 undefined Bittrex Orders Made: [ { uuid: 1531051664225 }, { uuid: 1531051664225 }, { uuid: 1531051664225 } ] ✓ Should resolve and return true Starting Trades: 2018-07-08T12:07:44.227Z 0 0 0 0 0 0 undefined Error at Promise (/var/www/c4d/test/bittrex.js:793:12) at new Promise () at CryptoBot.bot.bittrexTrade (/var/www/c4d/test/bittrex.js:792:41) at CryptoBot.bittrexStartArbitrage (/var/www/c4d/c4d.js:276:655) at Context. (/var/www/c4d/test/bittrex.js:795:15) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate._onImmediate (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) Error ✓ Should reject and return false Bittrex Websocket disconnected 2018-07-08T12:07:44.248Z Bittrex Connection closed by user 2018-07-08T12:07:44.249Z Connection Released: 2018-07-08T12:07:44.249Z

Bittrex Save Orders

trade updated in DB ✓ Should return a setTimeout object

Bittrex Check Trades

Timing out Bittrex orders: [] 2018-07-08T12:07:44.253Z ✓ Should return true Timing out Bittrex orders: [] 2018-07-08T12:07:44.255Z Bittrex Arbitrage timeout..... 2018-07-08T12:07:44.255Z ✓ Should return false Error Message: Parse Error Exception: TypeError: done is not a function at WebSocket.connected (/var/www/c4d/test/bittrex.js:475:5) at /var/www/c4d/node_modules/signalr-client-kg/signalR.js:599:57 at IncomingMessage. (/var/www/c4d/node_modules/signalr-client-kg/signalR.js:476:25) at emitNone (events.js:111:20) at IncomingMessage.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1064:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9) Error Data: { "Response": "started" } Bittrex Websocket disconnected 2018-07-08T12:07:44.289Z Bittrex Connection closed by user 2018-07-08T12:07:44.290Z Connection Released: 2018-07-08T12:07:44.290Z

Subscribe to market

Subscribed to Bittrex Account Data:true 2018-07-08T12:07:44.295Z Subscribed to Bittrex market:undefined 2018-07-08T12:07:44.295Z Subscribed to Bittrex market:undefined 2018-07-08T12:07:44.295Z Subscribed to Bittrex market:undefined 2018-07-08T12:07:44.296Z ✓ Should return return true Bittrex Authenticate Error: true 2018-07-08T12:07:44.315Z Subscribed to Bittrex market:undefined 2018-07-08T12:07:44.316Z Subscribed to Bittrex market:undefined 2018-07-08T12:07:44.316Z Subscribed to Bittrex market:undefined 2018-07-08T12:07:44.317Z ✓ Should return return true (Fail to authenticate)

Update Market

  ✓ Should update local order book

Bittrex Websocket disconnected 2018-07-08T12:07:44.331Z Bittrex Connection closed by user 2018-07-08T12:07:44.332Z Connection Released: 2018-07-08T12:07:44.332Z

SortBook

  ✓ Should sort Bittrex order book
#Bittrex Conditions
  ✓ Should return false NAN
  ✓ Should return false Insane Trade(<100)
  ✓ Should return false Insane Trade(<100)
  ✓ Should return false illiquid book (<100)
  ✓ Should return false illiquid book (>100)
  ✓ Should return false low wallet balance
  ✓ Should return false minimum btc amount not met
  ✓ Should return true, all conditions met
#Format Message
  ✓ Should format Transactions object and return a message (>100)
  ✓ Should format Transactions object and return a message (<100)
#Generate Strategy pair 1

TypeError: Cannot read property 'BTC-LTC' of null at CryptoBot.bittrexGenerateStrategy (/var/www/c4d/c4d.js:240:1597) at Context. (/var/www/c4d/test/bittrex.js:946:20) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return false Error getting Bittrex account info Error: Error getting Bittrex account info at bittrexAPI.then.list (/var/www/c4d/c4d.js:164:453) at at process._tickCallback (internal/process/next_tick.js:188:7) Bittrex Websocket disconnected 2018-07-08T12:07:44.355Z Bittrex Connection closed by user 2018-07-08T12:07:44.355Z Connection Released: 2018-07-08T12:07:44.355Z ✓ Generate a valid strategy for pair 1 ✓ Should output correct Transaction Amount for pair 1

Generate Strategy pair 2

  ✓ Generate a valid strategy for pair 2
  ✓ Should output correct Transaction Amount for pair 2

Bittrex Websocket disconnected 2018-07-08T12:07:44.377Z Bittrex Connection closed by user 2018-07-08T12:07:44.378Z Connection Released: 2018-07-08T12:07:44.378Z

Generate Strategy pair 3

  ✓ Generate a valid strategy for pair 3
  ✓ Should output correct Transaction Amount for pair 3
#Generate Strategy - Ordered Book
  ✓ Validate book for pair 3
  ✓ Validate book for pair 2
  ✓ Validate book for pair 1
#ParseUserEvent - account delta

Bittrex Balance Updated: LTC : 1 ✓ Should return true

ParseUserEvent - Error

Error parsing user event: TypeError: Cannot read property 'o' of undefined at CryptoBot.bittrexParseUserEvent (/var/www/c4d/c4d.js:249:166) at Context. (/var/www/c4d/test/bittrex.js:1020:16) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) 2018-07-08T12:07:44.398Z ✓ Should return false

ParseUserEvent - execution

  ✓ Should broadcastMessage and return true

trade updated in DB Bittrex Order Removed: fd15d-9eb60 2018-07-08T12:07:44.403Z : 0/3 ✓ Should update the status of the order in the database and return true trade updated in DB Bittrex Order Removed: fd15d-9eb60 2018-07-08T12:07:44.408Z : 2/3 ✓ Should update the status of the order in the database and return true (order in position 2) trade updated in DB Bittrex Order Removed: fd15d-9eb60 2018-07-08T12:07:44.411Z : 2/3 ✓ Should update the status of the order in the database and return true (order in position 3)

General Functions

Connect To Database

{ createIndex: [Function: createIndex], find: [Function: find], insert: [Function: insert], remove: [Function: remove], update: [Function: update] } { createIndex: [Function: createIndex], find: [Function: find], insert: [Function: insert], remove: [Function: remove], update: [Function: update] } ✓ Should return a db connection with trade and balance collections ✓ Should return empty DB

Connect To Empty Database

  ✓ Should return a db connection with trade and balance collections
#Connect To Database Error

Unable to connect to the database: true ✓ Should return an empty db Database Not Found ✓ Should return an empty db

Save to Database

Bittrex Websocket disconnected 2018-07-08T12:07:44.445Z Bittrex Connection closed by user 2018-07-08T12:07:44.445Z Connection Released: 2018-07-08T12:07:44.445Z MongoDB setting error ✓ Should return an error Bittrex Websocket disconnected 2018-07-08T12:07:44.449Z Bittrex Connection closed by user 2018-07-08T12:07:44.449Z Connection Released: 2018-07-08T12:07:44.449Z trade added to DB: 2018-07-08T12:07:44.450Z trade removed from DB ✓ Should save and delete record from the database Error adding trade to DB: Error: insert error at Object.insert (/var/www/c4d/test/mock.js:639:12) at Promise (/var/www/c4d/c4d.js:372:794) at new Promise () at CryptoBot.saveDB (/var/www/c4d/c4d.js:372:138) at Context. (/var/www/c4d/test/general.js:75:15) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return an insert error Error Removing trade in DB: Error: remove error at Object.remove (/var/www/c4d/test/mock.js:642:12) at Promise (/var/www/c4d/c4d.js:372:1339) at new Promise () at CryptoBot.saveDB (/var/www/c4d/c4d.js:372:138) at Context. (/var/www/c4d/test/general.js:82:15) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return a remove error Bittrex Websocket disconnected 2018-07-08T12:07:44.458Z Bittrex Connection closed by user 2018-07-08T12:07:44.459Z Connection Released: 2018-07-08T12:07:44.459Z Error updating trade in DB: Error: update error at Object.update (/var/www/c4d/test/mock.js:644:39) at Promise (/var/www/c4d/c4d.js:372:1797) at new Promise () at CryptoBot.saveDB (/var/www/c4d/c4d.js:372:138) at Context. (/var/www/c4d/test/general.js:89:15) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return an update error TypeError: this.database is not a function at Promise (/var/www/c4d/c4d.js:372:642) at new Promise () at CryptoBot.saveDB (/var/www/c4d/c4d.js:372:138) at Context. (/var/www/c4d/test/general.js:97:15) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return a general error

Retrieve database

  ✓ Should retrieve records from the database

Error: find error at Object.toArray (/var/www/c4d/test/mock.js:634:43) at Promise (/var/www/c4d/c4d.js:365:553) at new Promise () at CryptoBot.retrieveDB (/var/www/c4d/c4d.js:365:138) at Context. (/var/www/c4d/test/general.js:115:15) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return error retrieving from the database ✓ Should retrieve records from the database (options) Error: find error at Object.toArray (/var/www/c4d/test/mock.js:634:43) at Promise (/var/www/c4d/c4d.js:365:917) at new Promise () at CryptoBot.retrieveDB (/var/www/c4d/c4d.js:365:138) at Context. (/var/www/c4d/test/general.js:131:15) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return error retrieving from the database (options) TypeError: this.database is not a function at Promise (/var/www/c4d/c4d.js:365:392) at new Promise () at CryptoBot.retrieveDB (/var/www/c4d/c4d.js:365:138) at Context. (/var/www/c4d/test/general.js:140:15) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return error retrieving (general error)

Log

Hello World ✓ Should log a message ✓ Should return undefined ✓ Should return true

NiceOrderChain

  ✓ Should slow chain a series of functions
#NiceOrderChain - CB Error

Error: cb error at CryptoBot.bot.cb (/var/www/c4d/test/general.js:189:11) at functions.(anonymous function).apply.then.val (/var/www/c4d/c4d.js:355:529) at at process._tickCallback (internal/process/next_tick.js:188:7) ✓ Should return an error Bittrex Websocket disconnected 2018-07-08T12:07:44.493Z Bittrex Connection closed by user 2018-07-08T12:07:44.493Z Connection Released: 2018-07-08T12:07:44.494Z

NiceOrderChain - 2

  ✓ Should return a promise
#NiceOrderChain - 2 Function Error

Error: func error at Promise (/var/www/c4d/test/general.js:213:72) at new Promise () at CryptoBot.bot.add (/var/www/c4d/test/general.js:213:35) at Promise (/var/www/c4d/c4d.js:355:780) at new Promise () at Object.chain (/var/www/c4d/c4d.js:355:211) at Context. (/var/www/c4d/test/general.js:215:63) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate._onImmediate (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return an error Bittrex Websocket disconnected 2018-07-08T12:07:44.509Z Bittrex Connection closed by user 2018-07-08T12:07:44.509Z Connection Released: 2018-07-08T12:07:44.509Z

Send Email

  ✓ Should send an email message

Error Sending Email: Error: Test sending email error at Object.send (/var/www/c4d/test/general.js:232:11) at Promise (/var/www/c4d/c4d.js:377:634) at new Promise () at CryptoBot.sendEmail (/var/www/c4d/c4d.js:377:138) at Context. (/var/www/c4d/test/general.js:237:24) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should return false(email Error)

Should send Slack message

  ✓ Should send a slack message

Slack Webhook Error: ERROR ✓ Should get error sending Slack message

Notify

Error: error at CryptoBot.error (/var/www/c4d/test/general.js:259:33) at CryptoBot.notify (/var/www/c4d/c4d.js:359:233) at Context. (/var/www/c4d/test/general.js:263:18) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) Error: error at CryptoBot.error (/var/www/c4d/test/general.js:259:33) at CryptoBot.notify (/var/www/c4d/c4d.js:359:467) at Context. (/var/www/c4d/test/general.js:263:18) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should catch errors notify user

Should broadcast a message

  ✓ Should send a message to a websocket client

Error: Error at Object.send (/var/www/c4d/test/general.js:288:23) at wss.clients.forEach.client (/var/www/c4d/c4d.js:341:827) at Array.forEach () at CryptoBot.broadcastMessage (/var/www/c4d/c4d.js:341:379) at Context. (/var/www/c4d/test/general.js:295:18) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should catch error broadcasting message TypeError: this.wss.clients.forEach is not a function at CryptoBot.broadcastMessage (/var/www/c4d/c4d.js:341:379) at Context. (/var/www/c4d/test/general.js:304:16) at callFn (/var/www/c4d/node_modules/mocha/lib/runnable.js:372:21) at Test.Runnable.run (/var/www/c4d/node_modules/mocha/lib/runnable.js:364:7) at Runner.runTest (/var/www/c4d/node_modules/mocha/lib/runner.js:455:10) at /var/www/c4d/node_modules/mocha/lib/runner.js:573:12 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:369:14) at /var/www/c4d/node_modules/mocha/lib/runner.js:379:7 at next (/var/www/c4d/node_modules/mocha/lib/runner.js:303:14) at Immediate. (/var/www/c4d/node_modules/mocha/lib/runner.js:347:5) at runCallback (timers.js:810:20) at tryOnImmediate (timers.js:768:5) at processImmediate [as _immediateCallback] (timers.js:745:5) ✓ Should catch error broadcasting message

Setup WebSocket

Websocket connection created: 2018-07-08T12:07:44.566Z WebSocket Closed: 1006 2018-07-08T12:07:44.570Z ✓ Should setup a web socket server and catch error event Websocket connection created: 2018-07-08T12:07:45.651Z SyntaxError: Unexpected end of JSON input at JSON.parse () at CryptoBot.serverCommand (/var/www/c4d/c4d.js:381:173) at WebSocket.ws.on.message (/var/www/c4d/c4d.js:385:854) at emitOne (events.js:121:20) at WebSocket.emit (events.js:211:7) at Receiver._receiver.onmessage (/var/www/c4d/node_modules/ws/lib/WebSocket.js:141:47) at Receiver.dataMessage (/var/www/c4d/node_modules/ws/lib/Receiver.js:389:14) at Receiver.getData (/var/www/c4d/node_modules/ws/lib/Receiver.js:330:12) at Receiver.startLoop (/var/www/c4d/node_modules/ws/lib/Receiver.js:165:16) at Receiver.add (/var/www/c4d/node_modules/ws/lib/Receiver.js:139:10) at Socket._ultron.on (/var/www/c4d/node_modules/ws/lib/WebSocket.js:138:22) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at Socket.Readable.push (_stream_readable.js:208:10) at TCP.onread (net.js:597:20) WebSocket Error: Error: Dummy Error at WebSocket.ws.on (/var/www/c4d/test/general.js:334:32) at emitOne (events.js:121:20) at WebSocket.emit (events.js:211:7) at Receiver._receiver.onmessage (/var/www/c4d/node_modules/ws/lib/WebSocket.js:141:47) at Receiver.dataMessage (/var/www/c4d/node_modules/ws/lib/Receiver.js:389:14) at Receiver.getData (/var/www/c4d/node_modules/ws/lib/Receiver.js:330:12) at Receiver.startLoop (/var/www/c4d/node_modules/ws/lib/Receiver.js:165:16) at Receiver.add (/var/www/c4d/node_modules/ws/lib/Receiver.js:139:10) at Socket._ultron.on (/var/www/c4d/node_modules/ws/lib/WebSocket.js:138:22) at emitOne (events.js:116:13) at Socket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at Socket.Readable.push (_stream_readable.js:208:10) at TCP.onread (net.js:597:20) 2018-07-08T12:07:45.660Z ✓ Should setup a web socket server, send a message and close (1086ms) WebSocket Closed: 1000 2018-07-08T12:07:45.667Z

234 passing (19s)

---------- ---------- ---------- ---------- ---------- ------------------- File % Stmts % Branch % Funcs % Lines Uncovered Line #s
All files 98.05 92.63 92.24 100
c4d.js 98.05 92.63 92.24 100 ... 2337,2359,2367
---------- ---------- ---------- ---------- ---------- -------------------

root@mail:/var/www/c4d#

crypto-maniac commented 6 years ago

when i run the bot on my mac also it get stuck x5chjs 2 i do not see more logs to see what wrong

kemargrant commented 6 years ago

There are 234 tests... and 234 passed.