ctubio / tribeca

Self-hosted crypto trading bot (automated high frequency market making) in node.js, angular, typescript and c++
https://127.0.0.1:3000
Other
95 stars 26 forks source link

Bug fixing + Ak 47 debroken but reopening #69 #78

Closed Camille92 closed 7 years ago

Camille92 commented 7 years ago

Hello,

This pull request corrects the last bugs we have seen in the past days #76 #71 #70

After a big bunch of tries, I found out that two commits were prokoving the issues, so it's just reverting them.

https://github.com/ctubio/tribeca/commit/57d6c282d1abe79622b62150e1aca44df2d4bec3 and https://github.com/ctubio/tribeca/commit/4505416bfc2b3ddc5f26f7b597837b99ea100b10

But it reopens issue https://github.com/ctubio/tribeca/issues/69

However, as this is "cosmetic" I prefer to have fake orders on the UI but the bot functioning well than contrary.

On the plus side "fake orders" have a quantity of 0 and can easily be spotted and suppress. :)

capture d ecran 2017-05-12 a 20 48 31

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 54.276% when pulling 8011e5dc146a49d2b4226328b90fea445b6fe649 on Camille92:Camille92-patch-1 into d71a90cb25d4152752b6d9cd8408c3bef8feb83e on ctubio:master.

Camille92 commented 7 years ago

The Coinbase thing is a Work in progress, Ak47 is not working only there !

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 54.276% when pulling 2883d9b38374753e3e69f1d0c3bb64139fe3c56b on Camille92:Camille92-patch-1 into d71a90cb25d4152752b6d9cd8408c3bef8feb83e on ctubio:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 54.276% when pulling 61dd5870b58894b5d198f8810543f2d546d7c531 on Camille92:Camille92-patch-1 into d71a90cb25d4152752b6d9cd8408c3bef8feb83e on ctubio:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 54.276% when pulling 61dd5870b58894b5d198f8810543f2d546d7c531 on Camille92:Camille92-patch-1 into d71a90cb25d4152752b6d9cd8408c3bef8feb83e on ctubio:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 54.276% when pulling 61dd5870b58894b5d198f8810543f2d546d7c531 on Camille92:Camille92-patch-1 into d71a90cb25d4152752b6d9cd8408c3bef8feb83e on ctubio:master.

ctubio commented 7 years ago

did you check how many orders end up accumulated at this._orderCache.allOrders and this._orderCache.exchIdsToClientIds? im sure with this modifications it will have an incremental (never decrementing) amount of orders :sob:

because done is not set to true anywhere in the gateways, only in the broker when an order is attempted to be canceled but it doesnt exists; in all other situations orders are not set to done so never deleted.

anyway, i would not recommend to recover this workarround of done flags, instead the gateway workflow should be corrected if its wrong (keeping forever or cleanning to early orders from memory)

ctubio commented 7 years ago

i think i found the error you were chasing about getting on top of market, im sorry i coulnd find you previous comment about it, the error is:

{"name":"main","hostname":"ip-172-31-0-119","pid":12047,"level":50,"err":{"message":"Cannot read property 'size' of undefined","name":"TypeError","stack":"TypeError: Cannot read property 'size' of undefined\n    at Object.getQuoteAtTopOfMarket (/home/admin/tribeca/app/server/quoting-styles/helpers.js:25:39)\n    at computeBoomerangQuote (/home/admin/tribeca/app/server/quoting-styles/ping-pong.js:65:30)\n    at BoomerangQuoteStyle.GenerateQuote (/home/admin/tribeca/app/server/quoting-styles/ping-pong.js:18:20)\n    at QuotingEngine.computeQuote (/home/admin/tribeca/app/server/quoting-engine.js:106:59)\n    at EventEmitter.QuotingEngine.recalcQuote (/home/admin/tribeca/app/server/quoting-engine.js:63:32)\n    at EventEmitter.emit (/home/admin/tribeca/node_modules/eventemitter3/index.js:150:33)\n    at Evt.trigger (/home/admin/tribeca/app/server/utils.js:12:46)\n    at MarketFiltration.set latestFilteredMarket [as latestFilteredMarket] (/home/admin/tribeca/app/server/market-filtration.js:44:36)\n    at EventEmitter.MarketFiltration.filterFullMarket (/home/admin/tribeca/app/server/market-filtration.js:20:39)\n    at EventEmitter.emit (/home/admin/tribeca/node_modules/eventemitter3/index.js:129:35)\n    at Evt.trigger (/home/admin/tribeca/app/server/utils.js:12:46)\n    at EventEmitter.MarketDataBroker.handleMarketData (/home/admin/tribeca/app/server/broker.js:25:29)\n    at EventEmitter.emit (/home/admin/tribeca/node_modules/eventemitter3/index.js:129:35)\n    at Evt.trigger (/home/admin/tribeca/app/server/utils.js:12:46)\n    at CoinbaseMarketDataGateway.raiseMarketData (/home/admin/tribeca/app/server/gateways/coinbase.js:257:33)\n    at CoinbaseMarketDataGateway.onOrderBookChanged (/home/admin/tribeca/app/server/gateways/coinbase.js:234:18)\n    at CoinbaseMarketDataGateway.onOpen (/home/admin/tribeca/app/server/gateways/coinbase.js:188:18)\n    at CoinbaseMarketDataGateway._client.on.m (/home/admin/tribeca/app/server/gateways/coinbase.js:263:43)"},"msg":"Unhandled exception!","time":"2017-05-13T19:44:46.732Z","v":0}

will fix soOn'¡

Camille92 commented 7 years ago

Hey you're right,

I think it's bad to go back to a previous version. But I realized that Tribeca is functioning differently and I wanted to know why and when it happened.

Basically, the downgrade of coinbase gateway does nothing well.

But the downgrade of broker.ts does fix #71 as orders are sent all the time. So I guess there is a bug there :).

Thanks for the error, I was finding that weird as well!

ctubio commented 7 years ago

closing because https://github.com/ctubio/tribeca/commit/29306353681af1a966eb0fbb8fc89c1a4272c44c