ctubio / Krypto-trading-bot

Self-hosted crypto trading bot (automated high frequency market making) written in C++
https://127.0.0.1:3000
Other
3.37k stars 823 forks source link

Small Bug (Bitfinex) K can't place orders with more than 6 digits after the decimal place #403

Closed Camille92 closed 6 years ago

Camille92 commented 6 years ago

Hi Carles,

I recently reopened my BTC denominated markets and I noticed a small bug, the price is displayed correctly (even for very low values like DAT) but the bot cannot place orders with more than 6 digits after the decimal place.

Meaning that for instance on the XRP/BTC market trading at around 0.00003 BTC the bot can place orders at 0.000031 but not at 0.0000312.

It's a bit of an issue as it limits the possibilities to buy or sell.

Here are a few images to illustrate:

DAT/BTC: capture d ecran 2017-11-17 a 17 05 48

XRP/BTC capture d ecran 2017-11-17 a 17 06 29

On a side note, according to what I can see, Bitfinex maximun digits after the decimal place is 8. (0.00000000).

Can you have a look at that?

Do you think it can be easily fixed?

Ps: The formula we've been working on this summer is great, but just need to accept 2 more zeroes!

Have a nice day,

Camille

Camille92 commented 6 years ago

I don't know why but when I launch the bot , here for DAT/BTC because it's the smallest asset you can find I get that!

│ - minTick: 0.00000000 │ - minSize: 158.00000000 │ - makeFee: 0.00000000 │ - takeFee: 0.00000000.

ctubio commented 6 years ago

many thanks for the report''

lemme try a fix in next commit :dancer:

Camille92 commented 6 years ago

Thank you :)

ctubio commented 6 years ago

wtf that file was not that file xDDD lemme try a second commit :(

this happens when you use a "professional ide" instead of just vim. long life to vim!

Camille92 commented 6 years ago

Haha I'm still using nano ^^.

Thanks for the fix, will try and let you know.

Camille92 commented 6 years ago

Sadly the problem is not fixed,

I still get:

│ - symbols: xrpbtc │ - minTick: 0.00000000 │ - minSize: 52.00000000 │ - makeFee: 0.00000000 │ - takeFee: 0.00000000.

Can you make me a sandbox with the mintick formula, please? I'll try to see what's wrong.

ctubio commented 6 years ago

http://cpp.sh/3c3y im looking at it too against xrpbtc market :S

ctubio commented 6 years ago

took the price from https://api.bitfinex.com/v1/pubticker/xrpbtc

Camille92 commented 6 years ago

Ok it seems that we need to add more digit to the result of the formula, but I don't know how to

ctubio commented 6 years ago

but can you confirm the correct minTick for xrpbtc?

ctubio commented 6 years ago

should be 0.0000001?

Camille92 commented 6 years ago

Yes easy: It SHOULD be: 0.000000001 according to Bitfinex's formula (9 digits after the decimal place).

But according to what you can see on the exchange, it is ACTUALLY 0.00000001 (8 digits after the decimal change).

Basically, the formula we have is good but Bitfinex system doesn't support its own rule and have a built-in min tick of 8 digits after the decimal change. (see on the exchange ALL trades finishing by a 0 because of that)

ctubio commented 6 years ago

xDD thanks for the research; iSee, so lets try to limit it to 8; anyway i do believe 8 should be the standard design limit

Camille92 commented 6 years ago

So as the formula is working well for all numbers but the very small and that the rule changes for the very small assets, why not saying: if price < 0.001 Min tick = 0.00000001 (8 digits, minimum of Bitifnex)

That should solve the issue :D

Camille92 commented 6 years ago

and keep the formula if price >= 0.001

Camille92 commented 6 years ago

ok if we do that we still have a problem for the price denominated with 0.001 (min tick = 7 digits after the decimal place) but that's only them and only for one digit.

Because the formula works until 6 digits after the decimal place with no maximum and the fix for 8 (and lower).

So just the price that would need 7 digits will get 6, but I think that's an ok deal instead of working a lot in something that would take forever to fix :)

ctubio commented 6 years ago

works good for me in the next commit, hope for you works too, i limited the precision to 8, so the minimum possible minTick should be now 0.00000001

Camille92 commented 6 years ago

Yes it sounds good to me, I'll try it when it's out :)

ctubio commented 6 years ago

c5d5b517c9a526eb953dd4fd121667040b3512959c8de616ec8f2f01190d3540

Camille92 commented 6 years ago

Sadly it's not working, I do see the correct min tick when the bot starts, but the orders sent are still with 6 digits after the decimal place.

Could that be because of "float" used somewhere? I read that the maximum of digits of "float" is 7 digits, so 0 + the 6 digits. Maybe here is the bottleneck?

ctubio commented 6 years ago

well at least we fixed the first step; we dont use floats, let me trade a bit on xrpbtc and see

Camille92 commented 6 years ago

yes thanks! If I can do something to help, tell me!

tammycamp commented 6 years ago

@Camille92 or @ctubio - We'd love to get some of your time to help us figure out how to work this bot. We have already installed it, but the how to operate isn't that well documented. If one of you help, I'm will to make a basic how to youtube video.

Camille92 commented 6 years ago

Hi @tammycamp it's true that's something we have to do, but for now I don't really have the time.

Experience a bit the options with a small capital, it's both a market making and a TA bot using ema as a base. :)

@ctubio did you manage to see what's wrong? Is the bot able to send orders with more than 6 digits after the decimal point in other exchange like Polo ?

ctubio commented 6 years ago

i lost the time trying to fix displays of 0 balances :D still i didnt placed any xrp order but but soOn

ima leave this here https://github.com/ctubio/Krypto-trading-bot/pull/407

ctubio commented 6 years ago

image

to me looks OK the price of the order placed in XRP/BTC

Camille92 commented 6 years ago

Hey Carles,

It's not look at your screenshot you're placing order at 0.000029 while it should be 0.00002932. :p

The problem is not to send orders but to respect the correct mintick of 8 digits after the decimal and not 6.

Le 18 nov. 2017 21:04, "Carles Tubio" notifications@github.com a écrit :

Closed #403 https://github.com/ctubio/Krypto-trading-bot/issues/403.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ctubio/Krypto-trading-bot/issues/403#event-1348519245, or mute the thread https://github.com/notifications/unsubscribe-auth/AGizFkBIA3hBtG1t7fuFKbNW6mVFuO5-ks5s3zhDgaJpZM4QiQzl .

Camille92 commented 6 years ago

Can you please reopen the issue?

The problem is huge for those markets, you can only buy XRP/BTC at 0.00029 then to make a profit you can sell them at 0.00003 minimum or if you're at a loss, at 0.00028.

The min tick on this market is over 3%!

Camille92 commented 6 years ago

https://www.tradingview.com/x/6VQRyesk/

See here, if you can only sell with a maximum of 6 digits, you can wait for over a day to make a sell!

Camille92 commented 6 years ago

The bug affects at least the following markets on Bitfinex!

LTC/BTC, ETC/BTC, RRT/BTC, XRP/BTC, IOTA/BTC, EOS/BTC, SAN/BTC, OMG/BTC, NEO/BTC, ETP/BTC, QTM/BTC, AVT/BTC, EDO/BTC, DAT/BTC

ctubio commented 6 years ago

let me put it easy: :+1: 0.00002932 :koala: 0.000029

Camille92 commented 6 years ago

Thank you :)

Le 19 nov. 2017 15:55, "Carles Tubio" notifications@github.com a écrit :

Reopened #403 https://github.com/ctubio/Krypto-trading-bot/issues/403.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ctubio/Krypto-trading-bot/issues/403#event-1348795858, or mute the thread https://github.com/notifications/unsubscribe-auth/AGizFqMSe6qABfoXFZfY7vsDmKt_cGopks5s4EF5gaJpZM4QiQzl .