[ts-gen] Still Having Rounding/Formatting Issues

Ken Feng kfmfe04 at gmail.com
Fri Sep 25 02:06:23 EDT 2009


Hi Russ,

Thanks for the quick reply.  I changed all my 10,4 columns to 11,5 for  
safety, but I guess 10,5 should be fine.

While going through this, I ran into a tricky problem of partial  
fills.  Here is an actual trade from my paper account.

I tried to buy 207,000 EURGBP and the fill comes back as:

100,000 at 0.9137
107,000 at 0.91375

On average that comes out to:
207,000 at 0.913725845...

So any order level table that has an avg_cost field listed to 10,4 or  
even 10,5 or 11,5 would be truncated badly.

To do it correctly, you almost need to store the trade/fill level  
information and have the avg_cost at the order level be computed off  
the trade/fill tables.  I don't know an easy way around this, but it  
causes problems during reconciliation.

For now, I will code around the validation, but I thought I would  
point this out so you can consider this issue when you and Bill work  
on revising the formatting.

Thanks.

- Ken


On Sep 25, 2009, at 2:40 PM, R P Herrold wrote:

> On Fri, 25 Sep 2009, Ken Feng wrote:
>
>> 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...
>
> Hi, Ken
>
> We have not traded in that space, and so had not been alert to the  
> issues you raise.  The scaling change in displayed results is on the  
> docket for us, along the lines Bill previously outlined. The obvious  
> short term is a 'sed' one on the load scripts to handle '10,4' to  
> '10,5'
>
> -- Russ herrold



More information about the ts-general mailing list