For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

decimal.Decimal in BT



  • I am seeing large discrepancies between computations in my actual system, which uses Decimals throughout, and my results in BT.

    How hard would it be to go through the codebase and convert everything to a Decimal?

    I would like to get a handle on the size of the task to see whether it is worth my time.

    Kind Regards


  • administrators

    @deedy said in decimal.Decimal in BT:

    I am seeing large discrepancies between computations in my actual system

    I see large discrepancies between a blank statement like that one, backed by an anonymous id in a forum in the internet, and ... well who knows where the discrepancies are what you mean and ... and ...



  • @backtrader

    Floating point arithmetic.

    I have written a system which uses high precision Decimals. Backtrader uses Floats.

    I run a backtest through my system to verify the output of BT.

    To do this, I must convert the source prices used in BT from Floats into Decimals.

    After some iterations, with spreads involving subtraction and division, my indicators begin to diverge, presumably due to the increased rounding accuracy.

    I would prefer to convert BT to use Decimals and this is why I asked the question.

    Without searching the entire codebase for occurences of all numbers, I would like to ask the creator of this library for his view on how best to do this.


Log in to reply
 

});