[ts-gen] limits in risk.rb
R P Herrold
herrold at owlriver.com
Mon Sep 1 19:47:21 EDT 2008
On Mon, 1 Sep 2008, Nils Gebhardt wrote:
> when going through the example in exs/risk.rb, I noticed that there is a
> problem getting the decimals in limit orders right. I.e. if I say
>
> src3 = "create item 145 #{take_pos} LMT 3 114.51 0.0;
>
> then, along the lines of risk.rb, I get a resulting order, however the
> limit is turned into 114.00 instead of 114.51. Same with selling orders.
> Any hints?
My first reaction has to be a 'radix point' (decimal point)
difference in your local (one assumes .de) environment -- a
comma rather than a period --
[herrold at centos-5 ~]$ set | grep -i lang
LANG=en_US.UTF-8
is our environment; one assumes that this carries in with it a
decimal point usage of '.' for currency specification; I
would be very tempted either to add a temporary ehift in
environment when using the shim of:
export LANG=en_US.UTF-8
./shim --data
and see if it works, -- or --
try swapping in a value of 114,51 (N.B., we may well need to
enhance 'quoting' for this to work, and the cost v. benefit is
such that for the short term, I would ask that you use the
first path)
> Another thing: with a plain call ./shim --data I get some problem
> reports, probably harmless, for example
> Problem: 414 mysql query evaluation failed
> Error 1452 (23000): Cannot add or update a child row: a foreign key
> constraint fails (`testing/OrderResult`, CONSTRAINT `OrderResult_ibfk_1`
> FOREIGN KEY (`ibc`) REFERENCES `Product` (`ibc`))
> insert ignore
> into OrderResult(
> acc, type, curr, name, expiry, rite, strike, position, price, value,
> avg_cost, un_pnl, real_pnl, ibc)
> values
> ('DU33186', 'FUT', 'EUR', 'GBL', '20080908', '0', 0.00, 71, 114.00,
> 8138729.00, 114818.00, 0.00, 0.00, null);
This is easier to test -- does:
insert ignore into OrderResult(acc, type, curr, name, expiry, rite, strike,
position, price, value, avg_cost, un_pnl, real_pnl, ibc)
values
('DU33186', 'FUT', 'EUR', 'GBL', '20080908', '0', '0,00', 71, '114,00',
'8138729,00', '114818,00', '0,00', '0,00', null);
work? The null FK for ibc should presently work, as I
understand it from Bill.
Please let us know.
-- Russ herrold
More information about the ts-general
mailing list