Dear Mr cb888trader,
if you're going to make a point of being rude to people that offer valuable time trying to help you,
you're going to have to smarten up and work out how to solve
simple problems on your own!!
Everything you need to know is not "various URLs" away but right here on this very page.
With respect to currencies:"1" means 1 million currency units (1,000,000) - 7 significant digits.
"0.000001" (7 significant digits) means 1 currency unit.
"0.001000" (the MINIMUM) means 1000 currency units - 0.001
Without clicking any of the URLs above it's clear that the quote you have provided:
that rounds the given amount (0.00123456789) into a rounded amount (0.0012345)
makes no sense as the minimum tradeable unit is 1000 currency units or 0.001000
meaning rounding your given 0.00123456789 produces 0.001234 (truncated) or 0.001235 (rounded up/traditional) or 0.001234 (rounded down).
With respect to gold (xau/usd):"1" means 1 million ounces (1,000,000) - 7 significant digits.
"0.000001" (7 significant digits) means 1 ounce.
"0.000001" (the MINIMUM) means 1 ounce - 0.000001
With respect to silver (xag/usd):"1" means 1 million ounces (1,000,000) - 7 significant digits.
"0.000001" (7 significant digits) means 1 ounce.
"0.000050" (the MINIMUM) means 50 ounces - 0.00005
IN ALL CASES MINIMAL INCREMENTS ABOVE THE MINIMUMS IS ONE UNIT0.000001 - 7 significant digitsIf one sticks to this minimal increment rule there is no chance to generate more than 7 significant digits and therefore no rounding issue.
Rounding of course meaning having to deal with cutting away extra digits provided.
So no increments of 0.00000101 (more than 0.000001 sure but less than 0.000002 the next valid amount)
In elementary school we are often thought to "round up" such that if the digit following the last significant digit we are looking at is a 5 or more,
we should add a 1 to the last significant digit we are interested in.
E.g. 1.23447 rounded to 5 significant digits yields 1.2345 as the 6th digit we are not interested in is 5 or more.
Support has told you that there is a need
IN YOUR CASE to "
round down" at your end.
This means contrary to what we are initially taught, when the digit following the last significant digit we are interested in is 5 or more,
we do not add a 1 to the last significant digit we are interested in.
If that extra digit is >= 5, we leave all alone and truncate.
So 1.23445 rounded down to 5 significant digits yields 1.2344
and 1.23446 rounded down to 5 significant digits yields 1.2344
The reason you round down is because 1234 currency units is 1234 currency units
until it becomes 1235 (minimum increments of 1 unit no fractional increases).
If you order 1234.56789 units (which is what "0.00123456789") looks like to the trading server, if it's left to the standard java maths libraries
this becomes 1235 when rounded to the 7 significant digits needed (0.001235).
Acceptable parameters to avoid this are all over the wiki, docs and forum chats.
If you parse the order amounts yourself, you have the chance to round it down if your
strategies works in a any that it might generate fractional order amounts that do
not follow guidelines. This means even if the 8th significant digit is 5, 6, 7, 8 or 9
you don't add any 1 to the 7th digit before it - that's your order amount filter.
ORDER AMOUNT FILTERSo in java you just want the floor() after multiply by 1,000,000 then you
divide by 1,000,000 again
//turn orderamt 0.00123456789 into 1234.56789 and floor it to get 1234
long check = Math.floor(orderamt * 1000000);
//turn 1234 into 0.001234 ready for use.
orderamt = check / 1000000;
//turn orderamt 2500 ($2.5B) into 2500000000 and floor it to get 2500000000
long check = Math.floor(orderamt * 1000000);
//turn 2500000000 into 2500.0 ready for use.
orderamt = check / 1000000;
or the round down BigDecimal things support mentioned.
I'm writing this stuff off the top of my head so just take the general idea.MINIMUM CURRENCY TESTif order amount < "0.001000"
WILL THERE BE A SERVER ROUNDING EVENT ON CURRENCY ORDER TESTif order amount contains more than 7 significant digits and the 8th digit is >= 5
OR
if order amount * 1000000 contains a fractional component >= 0.5
OR
use some function that lets you know if it will or won't round a given number up when returned to N=7 significant digits
0.000009 - Minimum Fail / Rounding doesn't matter
0.00000900 - Minimum Fail / Rounding doesn't matter
0.00000990 - Minimum Fail / Rounding doesn't matter but would round to 0.000010
0.009000 - Minimum Pass / No Rounding
0.00900923 - Minimum Pass / No Rounding becomes 9009 units
0.00900925 - Minimum Pass / No Rounding becomes 9009 units
0.00900953 - Minimum Pass / Rounding becomes 9010 units
0.00099965 - Minimum Fail / Rounding doesn't matter but
would round to 0.001000 hit the minimum and generate an orderMINIMUM GOLD TESTif order amount < "0.000001"
WILL THERE BE A SERVER ROUNDING EVENT ON GOLD ORDER TESTif order amount contains more than 7 significant digits and the 8th digit is >= 5
OR
if order amount * 1000000 contains a fractional component >= 0.5
OR
use some function that lets you know if it will or won't round a given number up when returned to N=7 significant digits
0.00000010 - Minimum Fail / Rounding doesn't matter
0.00000015 - Minimum Fail / Rounding doesn't matter but would round to 0.000000[20]
0.00000092 - Minimum Fail / Rounding doesn't matter but
would round to 0.000001 hit the minimum and generate an order0.000009 - Minimum Pass / No Rounding
0.00000901 - Minimum Pass / No Rounding becomes 9 units
0.00000923 - Minimum Pass / No Rounding becomes 9 units
0.00000953 - Minimum Pass / Rounding becomes 10 units
0.00049905 - Minimum Pass / No Rounding becomes 499 units
0.00049950 - Minimum Pass / Rounding becomes 500 units
MINIMUM SILVER TESTif order amount < "0.000050"
WILL THERE BE A SERVER ROUNDING EVENT ON SILVER ORDER TESTif order amount contains more than 7 significant digits and the 8th digit is >= 5
OR
if order amount * 1000000 contains a fractional component >= 0.5
OR
use some function that lets you know if it will or won't round a given number up when returned to N=7 significant digits
0.000009 - Minimum Fail / Rounding doesn't matter
0.00000900 - Minimum Fail / Rounding doesn't matter
0.00000990 - Minimum Fail / Rounding doesn't matter but would round to 0.000010
0.000060 - Minimum Pass / No Rounding
0.00006923 - Minimum Pass / No Rounding becomes 69 units
0.00005048 - Minimum Pass / No Rounding becomes 50 units
0.00005050 - Minimum Pass / Rounding becomes 51 units
0.00004994 - Minimum Fail / Rounding doesn't matter but
would round to 0.000050 hit the minimum and generate an orderExcuse all typos - If everything here is all wrong the mango rum is still wearing off, at least I tried 