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

Changing decimals of Tribeca #39

Closed Camille92 closed 7 years ago

Camille92 commented 7 years ago

(Related to https://github.com/ctubio/tribeca/issues/31)

Hello Carles,

i discovered that trading with LTC, now tribeca can only trade with 2 decimals but the LTC / USD market allows for 3 decimals.

It means that Tribeca only put orders on round cents and consequently doesn't manage to "get on top of the market" very often.

Solution is to: Allow for 3 decimals when trading LTC Allow for 5 decimals for future LTC/BTC and ETH/BTC market.

Ps: I encourage you to try to trade on those markets as well, width is 5 to 10 times bigger!

Camille92 commented 7 years ago

If this the tol value we find in models ?

ctubio commented 7 years ago

some are the tol value (http://www.c-jump.com/bcc/c157c/Week05/W05_0040_scientific_notation.htm) , others are because Utils.roundFloat and many other rounding functions everywhere working only with 2 decimals, and others are unkown; sorry i dont have more details/solutions now, i never used to trade LTC before so i never experiencied this before

Camille92 commented 7 years ago

Thanks for the details.

Yes same I didn't think about before!

ctubio commented 7 years ago

my dog hit the close butoon sorry xD

but let me take profit and say: will need to rewrite everything in order to implement concurrent exchanges in a single app, so that may be the time to fix the decimals everywhere too; im a bit lazy about it but is in the roadmap definitely, some day, maybe!

Camille92 commented 7 years ago

I ididn't realize everything needs to be rewritten for that. Do you think it's worth ?

ctubio commented 7 years ago

ouYea, evolution worth the time it takes, always

trek_6

Camille92 commented 7 years ago

I just thought about that for a quick and easy fix at my level before the big change:

What if i trick tribeca in the wrapper by telling it to multiply by 10 all the quotes it's receiving from the market and then dividing it by 10 before it goes out ?

Would that work?

ctubio commented 7 years ago

yea it could work by translating the values in and out of the bridge of okcoin.ts gateway, but i would not do this just because of the confusion that it generates, instead i will go for the fix of the whole app. (i mean, you are left alone here i think'¡ :P)

Camille92 commented 7 years ago

Haha I have no chance to manage to fix the whole app, I'm going to give a try at translating the values!

ctubio commented 7 years ago

not only the btc side, but also the usd side should have 8 decimals, because when trading btc/ltc, will need 8 decimals in both sides, no?

Camille92 commented 7 years ago

Did not think about it, but yes you're right !

ctubio commented 7 years ago

Ok so ima add some internal variables to not only allow for the curencies to have a symbol, but also to have a defined decimal quantity; so this will be spread everywhere and used to round accordingly everywhere (cos i dont wanna have 8 decimals in eur or usd xD).

Camille92 commented 7 years ago

Sounds to be a clever way to do! Can we use data sent by the exchange to define the decimal ?

ctubio commented 7 years ago

see michaelgrosner:more_currencies branch

Camille92 commented 7 years ago

Seen! Good work :)

Camille92 commented 7 years ago

Still not working but soon!

https://github.com/michaelgrosner/tribeca/issues/100

ctubio commented 7 years ago

just saying, i just merged from upstream the latest modifications, i didn't apply these modifications in the parts of the code that only exists in this fork yet (but will do soOn'¡ [maybe some issue are because of this discrepancy])

let me reopen this meanwhile the new rounding is not everywhere

Camille92 commented 7 years ago

Haha ok it makes sense as this version was not able to see the market correctly. :p

ctubio commented 7 years ago

finally https://github.com/michaelgrosner/tribeca/issues/100 redirects to https://github.com/michaelgrosner/tribeca/pull/102, that was just merged at https://github.com/ctubio/tribeca/pull/49, so closing'¡

(hope your issue is fixed, cos i was only able to test with EUR/USD/BTC)

Camille92 commented 7 years ago

Hello, I was testing it today on OkCoin LTC/USD.

It doesn't seems to work as tribeca still uses 2 decimals and not the 3 the market offers.

Do you know if it's due from some parts of the code here?

I can have a look and help if you can orientate me where to look.

Best and nice weekend,

Camille

PS: Totally non related question but do you have access to your tip address, I would have think that you would use the money for tribeca trading and not letting it there. Well anyway it's yours!

ctubio commented 7 years ago

morning Camille'' i think even if the roundings are new, all quote values are still 2 decimals (and base values 8 decimals); will review it and try to apply minimum 3 decimals to quote values'¡

PS: yes i have access to the private key of the git tip address, didnt wanted to invest the funds cos are lovely donations that deserve some respect xD thanks again'¡!

ctubio commented 7 years ago

eeep Camille''' sorry are you trying LTC on Coinbase or in what exchange? ty'¡ (is for try to reproduce asap your very same situation; and fix the rest later :P)

Camille92 commented 7 years ago

I was trying in OkCoin this time :)

Thanks for helping :)

Camille92 commented 7 years ago

capture d ecran 2017-05-01 a 14 34 28

Sadly not working yet :/

ctubio commented 7 years ago

sorry can you please briefly explain again your problem/situation? (i see all ok in your image and in my test i was able to send 3 decimals to okcoin [but i got error 10011 Amount too low because i was using usd; maybe i should really use ltc xD])

Camille92 commented 7 years ago

Yes no problem.

Well basically, I should see the detail of the price for instance in the image we have several times 15.55 because one order is at 15.552 another 15.554 and the last one at 15.555.

And tribeca doesn't send orders with details smaller than 2 zeros after the coma at least in the trade logs I have orders are always at a round cent : 15.48, 15.49, 15.5 ...

The issue is that is makes "get on top of the market" useless: other traders can easily overcome Tribeca by sending orders of a 1/10 of a cent above it and tribeca would not see it or send orders a cent above (which is big in ltc terms).

I'm going to try to see if Michael's version work with it and if yes try to find where is the difference in the code.

[but i got error 10011 Amount too low because i was using usd; maybe i should really use ltc xD])

Yes i got this error too, it comes from the fact that Tribeca's default settings is to send 0.01 orders and the LTC/USD market allows only for minimum trade size of 0.1 LTC ;)

Camille92 commented 7 years ago

Working on LTC/USD ! Thank you very much!

I did not try with the others market does it work as well ? :D

ctubio commented 7 years ago

I think now LTC is niiiice, but donno other alts.

Camille92 commented 7 years ago

Haha Ok I'll tell you :) I let it run for now and let you come back with some details in case of !

Camille92 commented 7 years ago

I tried this version and Michael's version and yours is not working with the alts on Gdax while the other do work.

Any idea why ?

Cheers! capture d ecran 2017-05-01 a 20 49 27