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

BIG MATH ERROR -> NEEDS TO BE MERGED ASAP! (easy ewma mod explained) #105

Closed Camille92 closed 7 years ago

Camille92 commented 7 years ago

I just bumped into this one after I've seen EWMA basic acting super weird on ETC!!!

Factor is just the worst idea ever!!!

Here you're looking to have a % easily comparable for all markets. Not something depending on MinTICK that gives stupid results if you're not trading with 2 decimal.

IE: ECT -> Min TICK 0.001 -> Factor = 1/Mintick = 1000 So let's say EWMA short = 10.1 and EWMA long = 10 (so a 1% increase).

Instead of getting 1% the good result you get: (10.1 * 1000 / 10) - 1000 = 10..... 10 times bigger.

And the issue was multiplied by 10 for each mintick you went down !!!

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 49.452% when pulling 450fc5f29b23cc7f28b59e9ca5ffb592b659f14c on Camille92:patch-17 into a69cd2bef551a1d664604d2cb9f6939e1dc2351e on ctubio:master.

ctubio commented 7 years ago

(i hate math) so 100 is better than a varaible factor? ok many thanks'¡

Camille92 commented 7 years ago

Well if you use a variable factor you don't calculate %. :p

ctubio commented 7 years ago

i promise to come back when is non-friday to understand the formula :D seriously many thanks'''''

ctubio commented 7 years ago

btw im still trying to understand if this is normal or not (in Coinbase at least):

tbp recalculated 6.948680956887514
tbp recalculated 7.437444025010691
tbp recalculated 6.949255014072926
tbp recalculated 7.472768355383038
tbp recalculated 6.954083578212703
tbp recalculated 6.944079204066764
tbp recalculated 7.129722552861222
tbp recalculated 6.94797891584547
tbp recalculated 0

and it keeps in 0 for loooooong time (happens since several months ago) maybe normal because the market move, but not sure

Camille92 commented 7 years ago

Well, today it's a bad day for trading, BTC is down by 10%, ETH by 12 and LTC by 13.

So yep it should be normal!

Remember that we look at the difference between EWMA 100 and EWMA 200 so 1h40mn and 3h20 min. So it's quite a "long" time.

If it's 0 it means that EWMA 100 is down by more than 0.20% from ewma 200.

You can change the sensibility by changing the *5 in the formula (higher number, higher sensibility, lower number, lower sensibility).

So if you change it by 2 for instance, you'll get 0 only if EWMA 100 is 0.5% lower than EWMA 200.

ctubio commented 7 years ago

well is not that bad if you sold all yesterday :P

many thanks for the explanation, will not mess with the values, but maaaay allow to customize it someday

Camille92 commented 7 years ago

Yes sure but it's still not going down, so EWMA is still protecting you from entering!

ctubio commented 7 years ago

i belive this is when the snipper feature comes into play, cos i found myself making Buy orders manually when i consider best (today), and this should be automatic xD lets not mess topics, i shut up and move to https://github.com/ctubio/tribeca/issues/100

Camille92 commented 7 years ago

Well no strategy can be perfect!

So you have to accept that you're never going to get everything right.

But I would personally recommend you not to buy in now. It looks like a falling rock and we might go down to $1800 before moving a bit.

ctubio commented 7 years ago

noworry i buy based on what i sold (and yesterday was everything xDD)

i say this cos that was the main (failed) idea of PingPong/Boomerang/AK47, track what you buy/sell and only make oppossite trades, but yea i realized that 100% of the time this is impossible (thats why StopPings is not an internal value always enabled [cos funds are limited]) so as you said, there is no perfect strategy (so i vote for support them all and allow to mix them :D [so it becomes fault of the user xD])

and then comes the biggest realization: not all cleaned pings are bad trades xDD

i say this cos im still looking for a correct "bank financing" strategy, if i ever understand what that means xD

ctubio commented 7 years ago

since i can't come up with the perfect strategy, my next plan is HamelinRat quoting mode, that is expected to look the market for the order with greater quantity in the book (if any), then supose that behind this huge order there is a human with a computer running an unkown algorithm that we want to take profit of too, so we follow this human by placing orders right near the greater order in the book xD how feels in your body? xDD

Camille92 commented 7 years ago

I don't really understand how HamelinRat is supposed to make you money :p. Do you mean that you suppose that where there is a big buyer the market will probably going up ? and vice versa?

For me what I find great with Tribeca is that it includes two strategies. 1) Market-making to get most of the market and its spread. 2) Ewma basic (and maybe new ones) that focus on the technicals of the charts to try to guess where the price is going.

So you have 2 axes for improvement :)

ctubio commented 7 years ago

i understand is stupid idea xD mainly because 0 math are involved, but in Coinbase im not sure if are self-coinbase orders or a big trader, but there is some one that knows what is doing, and is doing it non-stop in huge quanitites

but yea, the main propose of the app should be math related trading, not abusive banking solutions (cos we don't have ppl to abuse from) nor stupid trading strategies xD (i just need to test HamelinRat in Coinbase :P [i dont forget about Clustering_illusion no worry xD])

many thanks for your PR! :dancer:

Camille92 commented 7 years ago

Don't throw the idea away there is for maybe money to be made out of it and surely a way to statistically test this theory / explain it and write it down.

But I don't understand it for now.

Don't hesitate to post a long post (or comment on #100 if you feel like it's related and I'll have a deeper look at it to see if it can be related to and existing strategy :).