[ts-gen] Still Having Rounding/Formatting Issues

Ken Feng kfmfe04 at gmail.com
Tue Sep 22 20:08:24 EDT 2009


Hi,

I have been patching some fields to include more decimal points for  
forex.  For example, in src/tags.c,

       Pm01(*new(perm) tag:: Dec(e, t.dec   , "price",      "%11.5f")),
       Pm12(*new(perm) tag:: Dec(e, t.dec   , "price",      "%11.5f")),
       Open(*new(perm) tag:: Dec(e, t.dec   , "open" ,      "%11.5f")),
       High(*new(perm) tag:: Dec(e, t.dec   , "high" ,      "%11.5f")),
        Low(*new(perm) tag:: Dec(e, t.dec   , "low"  ,      "%11.5f")),
       Clos(*new(perm) tag:: Dec(e, t.dec   , "close",      "%11.5f")),

Now, during testing, I noticed that in the Journaling Tables,  
OrderResult.avg_cost, I am only getting four decimal places.  This  
causes reconcilation and commission calculation problems down the line.

I think I traced the problem to this line:

       AvgC(*new(perm) tag:: Dec(e, t.dec   ,  
"avg_cost"           )),   // dba

Now, I suppose, if I add "%11.5f" as the third argument, my problems  
will go away, at least for this case.

However, I would like all my Dec()'s to default to "%11.5f", so I  
don't have to deal with this problem in the future;  I don't want to  
play whack-a-mole with discovering that some other variable only has 4  
decimal points several weeks down the line...

Does anyone know where I can set it for all Dec()'s?  I will continue  
looking for it, but no luck so far...
Thx in advance.

- Ken




More information about the ts-general mailing list