[ts-gen] Still Having Rounding/Formatting Issues

Ken Feng kfmfe04 at gmail.com
Fri Sep 25 00:33:13 EDT 2009


Hi Bill,

I need help with bug fix patch in the MySQL schema.    After patching  
the shim below with the following code, I was still only getting four  
decimal points for fills.

When I checked the OrderStatus table, I see that both avg_fill and  
last_fill are defined as DECIMAL(10,4).

This is insufficient for forex trading.  For example, when I compared  
TWS with OrderStatus today, I had a fill for a EURGBP trade for  
0.91373 in TWS, but 0.9137 in OrderStatus.

I have altered my own OrderStatus table's avg_fill and last_fill to  
DECIMAL(11,5), but I see that DECIMAL(10,4) is all over the place in  
the system...

- Ken

On Sep 23, 2009, at 9:08 AM, Ken Feng wrote:

> 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