DeviaVir / zenbot

Zenbot is a command-line cryptocurrency trading bot using Node.js and MongoDB.
MIT License
8.22k stars 2.04k forks source link

Paper mode, several issues #1183

Open firepol opened 6 years ago

firepol commented 6 years ago

Running on Ubuntu Linux, node v8.9.4 zenbot "unstable" branch, at this commit: 542d588a973ec4021a0e751050c2744743114cbf

To reproduce:

My settings (from conf-sample.js I modified the following):

c.buy_pct = 100
c.sell_pct = 100
c.order_type = 'taker'

c.cexio = {}
c.cexio.username = 'bla'
c.cexio.key = 'bla'
c.cexio.secret = 'bla'
c.notifiers = {}
c.notifiers.telegram = {}
c.notifiers.telegram.on = true
c.notifiers.telegram.bot_token = 'i configured my token'
c.notifiers.telegram.chat_id = 'my telegram chat it'

Yesterday evening at around midnight CET time (UTC+1), so "2018-01-18T00:58:00" UTC+1 I did run this command: ./zenbot.sh trade cexio.XRP-USD --paper --period 3m --currency_capital 1000 --reset_profit

Here all the notifications I received on telegram, sorry I copied pasted from the web, the time (buy ordered completed shows after the order itself but I think it's easily understandable):

zenbot notifications Buying CEXIO: placing buy order at 1.63130 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.63130 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.63130 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.63130 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.63130 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.63130 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.63130 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.63130 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.63130 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.63130 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.63130 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.63130 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.63130 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.64000 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.64000 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.64000 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.64000 USD, 0.00000000 USD under best bid Buy CEXIO: buy order completed at 2018-01-20 00:58:40:

611.47551032 XRP at 1.64000 USD total 1002.81 USD 0.5333% slippage (orig. price 1.63130 USD) execution: a minute zenbot notifications Buying CEXIO: placing buy order at 1.63110 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.63270 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.63270 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.63270 USD, 0.00000000 USD under best bid Buy CEXIO: buy order completed at 2018-01-20 02:34:19:

1.52887622 XRP at 1.63270 USD total 2.49619 USD 0.0980% slippage (orig. price 1.63110 USD) execution: 4 minutes Buying CEXIO: placing buy order at 1.63270 USD, 0.00000000 USD under best bid Buy CEXIO: buy order completed at 2018-01-20 02:34:19:

0.00381845 XRP at 1.63270 USD total 0.00623438 USD 0.0000% slippage (orig. price 1.63270 USD) execution: a few seconds zenbot notifications Buying CEXIO: placing buy order at 1.60710 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.60810 USD, 0.00000000 USD under best bid Buying CEXIO: placing buy order at 1.60810 USD, 0.00000000 USD under best bid Buy CEXIO: buy order completed at 2018-01-20 03:42:21:

0.00000970 XRP at 1.60810 USD total 0.00001559 USD 0.0622% slippage (orig. price 1.60710 USD) execution: a few seconds zenbot notifications Buying CEXIO: placing buy order at 1.61980 USD, 0.00000000 USD under best bid Buy CEXIO: buy order completed at 2018-01-20 04:36:12:

0.00000001 XRP at 1.61980 USD total 0.00000001 USD 0.0000% slippage (orig. price 1.61980 USD) execution: a few seconds

Here how the terminal looked in the morning when I checked it:

cexio screenshot from 2018-01-20 07-51-10

See attached zip file containing cexio_paper.zip:

Issues

currency capital not respected

I gave the bot 1000 USD -with the parameter --currency_capital 1000, how come in the first order it was able to spend 1002.81 USD. And still it had a few dollars to make more buy orders later...

Something is wrong with the math.

Expected result: first order I spend 100% and it should spend 100%, don't allow it to make subsequent orders for 1 USD or even worse for a few cents. Spam orders. Actualy those mess up everything, e.g. if the bot compares the last order only and not the real one. If the last 1 cent order was purchased really low, 10% up could be still lower than the initial order, resulting in a big loss.

Also, the minimum amount on cexio is for sure more than 1 USD. The next orders should not have been allowed. I will update the product.json in a second. It was not updated and it's wrong.

Notifications spam on telegram

Did you notice how many times I received this message at the beginning: Buying CEXIO: placing buy order at 1.63130 USD, 0.00000000 USD under best bid

At best show within the "buy order completed" message something like (add "retried 16 times" for information) buy order completed at 2018-01-20 00:58:40 - INFO: retried order 16 times

Buying CEXIO: placing buy order at 1.63130 USD, 0.00000000 USD under best bid

Exiting the program with X results in a (not expected, not displayed, not notified) sell order

In my history I see 0 sell orders, but in the paper_result_cexio.XRP-USD_180120_065131_UTC.html I see one sell order, but I never received a telegram notification for it. I assume it was created when exiting the program. This is unexpected and wrong.

Expected result: when I close, pressing X, there should be no sell order. Just show in the stats 1 trade to buy and that's it. 0 win, 0 loss.

Wrong stats

I kept zenbot open from 00:58 UTC+1 time till 7:48 UTC+1. This makes around 7 hours of runtime.

The stats show: 6 trades over 2 days (avg 3.00 trades/day)

This is wrong: do the math correctly, calculate the amount of minutes to have proper stats. E.g. if I keep the program running for 1 hour, and it does 1 trade, the average is not 1 trade/day, but rather 24 trades/day, since 1 hour multiplied 24 makes 24. If in 24 hours there was 1 trade then yes, it's 1 trade/day. And if it's 24 hours (or 24 hours and and 30 mins), it still makes an average of 1 trade/day, not 0.5 trades/day.

In my case, 6 trades (in reality 5 (because 1 was a sell order that never happened), but assuming 6 was correct) within 7 hours of runtime makes it around 23 trades/day in average.

ttrd06 commented 6 years ago

Same issue for me and this is why i don't use the paper mode anymore until it will be fixed. i had more than 450 msg in 1 hour !