[ts-gen] limits in risk.rb
Nils Gebhardt
mail at ngebhardt.de
Tue Sep 2 02:28:51 EDT 2008
On Mon, 2008-09-01 at 19:47 -0400, R P Herrold wrote:
> 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
>
actually I have set it to the same value (also
LC_NUMERIC="en_US.UTF-8"). TWS itself displays numbers with a dot as
well.
> 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)
>
with ',' in place mysql breaks:
Problem: 414 mysql query evaluation failed
Error 1064 (42000): You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near ', NULL, NULL, NULL)' at line 1
call OrderUpdate('take-pos-aa-080902-08-02-24', 1, 2734, 48, 2, 8, 44,
null, 'create', 'LMT', 2, 20, ,, NULL, NULL, NULL);
Problem: 417 CreateEvent tuple not found following insert
Problem: 500 transient error was not handled properly
Exiting
create item 6 exit-pos-aa-080902-08-02-24 LMT 2 30.00 0.0; wait 1;
modify item exit-pos-aa-080902-08-02-24 MKT 1 0.0 0.0; wait 1;
select open; wait 1;
./exs/risk.rb:69:in `write': Broken pipe (Errno::EPIPE)
from ./exs/risk.rb:69:in `print'
from ./exs/risk.rb:69
Thanks
Nils
More information about the ts-general
mailing list