精度 vs. 限值
不要混淆了精度和限值!精度和最低限值无关。8位精度并不一定意味着最低限值为 0.00000001。反过来也是正确的:最小限值0.0001也不一定意味着精度为4。
示例1
(market['limits']['amount']['min'] == 0.05) && (market['precision']['amount'] == 4)
上面的代码要求任何委托单的数量必须同时满足以下条件:
数量值应当 >= 0.05,例如:
+ good: 0.05, 0.051, 0.0501, 0.0502, ..., 0.0599, 0.06, 0.0601, ... - bad: 0.04, 0.049, 0.0499
精度最高4位小数,例如:
+ good: 0.05, 0.051, 0.052, ..., 0.0531, ..., 0.06, ... 0.0719, ... - bad: 0.05001, 0.05000, 0.06001
示例2
(market['limits']['price']['min'] == 0.0019) && (market['precision']['price'] == 5)
这个例子中要求任何委托单的价格必须同时满足以下条件:
价格应当 >= 0.019,例如:
+ good: 0.019, ... 0.0191, ... 0.01911, 0.01912, ... - bad: 0.016, ..., 0.01699
价格精度最高5位小数,例如:
+ good: 0.02, 0.021, 0.0212, 0.02123, 0.02124, 0.02125, ... - bad: 0.017000, 0.017001, ...
示例3
(market['limits']['amount']['min'] == 50) && (market['precision']['amount'] == -1)
这个示例要求任何委托单的数量同时满足以下条件:
数量应当 >= 50,例如:
+ good: 50, 60, 70, 80, 90, 100, ... 2000, ... - bad: 1, 2, 3, ..., 9
精度为负数表示应当为10的倍数,例如:
+ good: 50, ..., 110, ... 1230, ..., 1000000, ..., 1234560, ... - bad: 9.5, ... 10.1, ..., 11, ... 200.71, ...