Sizer for CryptoCurrencies
Luca Lach last edited by
I'm currently deciding which backtester to use for testing stragies on trading cryptocurrencies.
So far, I like backtrader a lot, but I still got one question.
One of the characteristics of cryptocurrencies is, that one can buy only a fraction of a coin. With a relatively low capital,
buying partial coins is very interesting.
How can i accomplish that with backtrader? Do I have to write a sizer for this or does one already exist?
Paska Houso last edited by
backtrader uses native floating point. Theoretically you should have no problem, but reality dictates otherwise, because cryptocurrencies tend to have a large amount of digits behind the dot and the actual representation is not exact. There is plenty of literature on that for any programming language, operating system and processor architecture.
But if the amount of decimals is known and fixed in advance, 6 for example, you can actually work by moving the dot 6 places to right until you only have an integer.
The results would need the opposite operation, but this would allow you to work without losing precision.