michaelgrosner / tribeca

A high frequency, market making cryptocurrency trading platform in node.js
Other
4.01k stars 948 forks source link

Error: unexpected server response (200) - fresh install #120

Open tomhatzer opened 7 years ago

tomhatzer commented 7 years ago

Hi everybody!

I'm currently trying to get tribeca up and running on my server. When starting tribeca using forever, I'm receiving the error message below. API Key and secret were generated a few minutes ago.

I replaced all unnecessary data with <censored>, I hope that's ok. I triple checked if the api key and secret match the details from the api key website, and they do.

Do you possibly know, what's wrong?

Thanks and best wishes Tom

OS: Ubuntu Xenial

$ npm -v
4.2.0
$ node -v
v7.10.0

Exchange: HitBtc

Exception (the last few lines are the ones with the error messages):

{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"TradedPair = BTC/USD","time":"2017-05-24T23:20:31.430Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"WebClientUsername = <censored>","time":"2017-05-24T23:20:31.436Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"WebClientPassword = <censored>","time":"2017-05-24T23:20:31.436Z","v":0}
{"name":"tribeca:main","hostname":"<censored>","pid":28490,"level":30,"msg":"Requiring authentication to web client","time":"2017-05-24T23:20:31.436Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"WebClientListenPort = 3000","time":"2017-05-24T23:20:31.439Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"EXCHANGE = hitbtc","time":"2017-05-24T23:20:31.441Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"MongoDbUrl = mongodb://localhost:27017/tribeca","time":"2017-05-24T23:20:31.441Z","v":0}
{"name":"tribeca:main","hostname":"<censored>","pid":28490,"level":30,"msg":"Listening to admins on *: 3000","time":"2017-05-24T23:20:31.453Z","v":0}
{"name":"persister:osr","hostname":"<censored>","pid":28490,"level":30,"selector":{"exchange":1,"pair":{"base":1,"quote":0},"source":{"$gte":2}},"limit":10000,"nLoaded":0,"dbName":"osr","msg":"load docs completed","time":"2017-05-24T23:20:31.511Z","v":0}
{"name":"persister:trades","hostname":"<censored>","pid":28490,"level":30,"selector":{"exchange":1,"pair":{"base":1,"quote":0}},"limit":10000,"nLoaded":0,"dbName":"trades","msg":"load docs completed","time":"2017-05-24T23:20:31.511Z","v":0}
{"name":"persister:mt","hostname":"<censored>","pid":28490,"level":30,"selector":{"exchange":1,"pair":{"base":1,"quote":0}},"limit":100,"nLoaded":0,"dbName":"mt","msg":"load docs completed","time":"2017-05-24T23:20:31.511Z","v":0}
{"name":"persister:rfv","hostname":"<censored>","pid":28490,"level":30,"selector":{"exchange":1,"pair":{"base":1,"quote":0}},"limit":50,"nLoaded":0,"dbName":"rfv","msg":"load docs completed","time":"2017-05-24T23:20:31.512Z","v":0}
{"name":"persister:msg","hostname":"<censored>","pid":28490,"level":30,"selector":{"exchange":1,"pair":{"base":1,"quote":0}},"limit":50,"nLoaded":0,"dbName":"msg","msg":"load docs completed","time":"2017-05-24T23:20:31.512Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"HitBtcPullUrl = http://demo-api.hitbtc.com","time":"2017-05-24T23:20:31.512Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"HitBtcOrderDestination = HitBtc","time":"2017-05-24T23:20:31.554Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"HitBtcApiKey = <censored>","time":"2017-05-24T23:20:31.556Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"HitBtcSecret = <censored>","time":"2017-05-24T23:20:31.556Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"HitBtcOrderEntryUrl = ws://demo-api.hitbtc.com:8080","time":"2017-05-24T23:20:31.556Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"HitBtcApiKey = <censored>","time":"2017-05-24T23:20:31.562Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"HitBtcSecret = <censored>","time":"2017-05-24T23:20:31.562Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"HitBtcPullUrl = http://demo-api.hitbtc.com","time":"2017-05-24T23:20:31.562Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"HitBtcPullUrl = http://demo-api.hitbtc.com","time":"2017-05-24T23:20:31.566Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"HitBtcMarketDataUrl = ws://demo-api.hitbtc.com:80","time":"2017-05-24T23:20:31.568Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"HitBtcSocketIoUrl = http://demo-api.hitbtc.com:8081","time":"2017-05-24T23:20:31.568Z","v":0}
{"name":"tribeca:gateway:HitBtcMD","hostname":"<censored>","pid":28490,"level":30,"msg":"socket.io: http://demo-api.hitbtc.com:8081/trades/BTCUSD","time":"2017-05-24T23:20:31.568Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"HitBtcSocketIoUrl = http://demo-api.hitbtc.com:8081","time":"2017-05-24T23:20:31.568Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"HitBtcPullUrl = http://demo-api.hitbtc.com","time":"2017-05-24T23:20:31.576Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"HitBtcPullUrl = http://demo-api.hitbtc.com","time":"2017-05-24T23:20:31.577Z","v":0}
{"name":"tribeca:config","hostname":"<censored>","pid":28490,"level":30,"msg":"TRIBECA_MODE = dev","time":"2017-05-24T23:20:31.578Z","v":0}
{"name":"tribeca:main","hostname":"<censored>","pid":28490,"level":30,"pair":"BTC/USD","minTick":0.01,"hasSelfTradePrevention":false,"msg":"using the following exchange details","time":"2017-05-24T23:20:31.583Z","v":0}
{"name":"tribeca:qpr","hostname":"<censored>","pid":28490,"level":30,"msg":"Starting parameter: QuotingParameters {\n  width: 0.3,\n  size: 0.05,\n  mode: 0,\n  fvModel: 0,\n  targetBasePosition: 3,\n  positionDivergence: 0.8,\n  ewmaProtection: false,\n  autoPositionMode: 0,\n  aggressivePositionRebalancing: false,\n  tradesPerMinute: 2.5,\n  tradeRateSeconds: 300,\n  longEwma: 0.095,\n  shortEwma: 0.19,\n  quotingEwma: 0.095,\n  aprMultiplier: 3,\n  stepOverSize: 0.1 }","time":"2017-05-24T23:20:31.588Z","v":0}
{"name":"tribeca:active","hostname":"<censored>","pid":28490,"level":30,"msg":"Starting saved quoting state:  false","time":"2017-05-24T23:20:31.592Z","v":0}
{"name":"ewma","hostname":"<censored>","pid":28490,"level":30,"msg":"Unable to compute EMWA value","time":"2017-05-24T23:20:31.594Z","v":0}
{"name":"mt:broker","hostname":"<censored>","pid":28490,"level":30,"msg":"loaded 0 market trades","time":"2017-05-24T23:20:31.611Z","v":0}
{"name":"tribeca:gateway:HitBtcMD","hostname":"<censored>","pid":28490,"level":50,"err":{"message":"unexpected server response (200)","name":"Error","stack":"Error: unexpected server response (200)\n    at ClientRequest.response (/home/trading/tribeca/node_modules/ws/lib/WebSocket.js:694:15)\n    at Object.onceWrapper (events.js:293:19)\n    at emitOne (events.js:96:13)\n    at ClientRequest.emit (events.js:191:7)\n    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:522:21)\n    at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)\n    at Socket.socketOnData (_http_client.js:411:20)\n    at emitOne (events.js:96:13)\n    at Socket.emit (events.js:191:7)\n    at readableAddChunk (_stream_readable.js:178:18)"},"msg":"unexpected server response (200)","time":"2017-05-24T23:20:31.648Z","v":0}
{"name":"tribeca:main","hostname":"<censored>","pid":28490,"level":50,"err":{"message":"unexpected server response (200)","name":"Error","stack":"Error: unexpected server response (200)\n    at ClientRequest.response (/home/trading/tribeca/node_modules/ws/lib/WebSocket.js:694:15)\n    at Object.onceWrapper (events.js:293:19)\n    at emitOne (events.js:96:13)\n    at ClientRequest.emit (events.js:191:7)\n    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:522:21)\n    at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)\n    at Socket.socketOnData (_http_client.js:411:20)\n    at emitOne (events.js:96:13)\n    at Socket.emit (events.js:191:7)\n    at readableAddChunk (_stream_readable.js:178:18)"},"msg":"Unhandled exception!","time":"2017-05-24T23:20:31.648Z","v":0}
{"name":"tribeca:main","hostname":"<censored>","pid":28490,"level":30,"msg":"persisting active to false","time":"2017-05-24T23:20:31.648Z","v":0}
{"name":"tribeca:main","hostname":"<censored>","pid":28490,"level":30,"msg":"All exiting event handlers have fired, exiting application.","time":"2017-05-24T23:20:31.652Z","v":0}
{"name":"tribeca:main","hostname":"<censored>","pid":28490,"level":30,"msg":"Exiting with code 0","time":"2017-05-24T23:20:31.652Z","v":0}
error: Forever detected script exited with code: 0
rcmorano commented 7 years ago

+1

Using 'demo-api.hitbtc.com' as address for the ws endpoints and having created a full-access API key via the demo webui, I'm receiving the same error.

'hitbtc.com' API dashboard shows correct "Last use" time for the API and 'tribeca' logs show a HTTP 200 OK. I've tried 'wss' for the demo-api websocket endpoints, but it didn't work either.

I'm using the latest code available (ee50c64) and I have been diggin on it, but I couldn't find any reasonable reason for the problem of receiving a 200; Until I sniffed the requests (the showing API key, it's already revoked).

It seems that the api endpoint on port 80 is not implementing GET on '/' but is returning 200. I don't know if this is something expected in someway from part of 'hitbtc.com', I haven't tried its API natively.

My two cents!