模拟交易 XIACY.US ,提交限价单时,出现了 (code=602035) Wrong bid size, please change the price 错误
小米集团(ADR) (XIACY.US) price: 32.676 amount: 224
交易时间,北京2025.5.29 14:31,小米ADR盘后价格32.66
不知道这个错误的具体原因是什么,谢谢
价格位数不对,试试调用一下 decimal 的 normalize 方法
谢谢。我的正式账户,提交LO订单的时候,提示了下面的错误,这个是什么原因呢?
OpenApiException: (code=602007, trace_id=00000000000000003cfbc371f800a277) Your account has no trading rights for this market, please contact customer service for assistance.
小米集团(ADR) (XIACY.US) price: 32.676 amount: 224
交易时间,北京2025.5.29 14:31,小米ADR盘后价格32.66
不知道这个错误的具体原因是什么,谢谢
使用double变量会有精度问题,你可以把Decimal变量通过to_string方法打印出来看看,会发现该变量后边还有很多微小的数值,该数值是系统地址原因产生的,提交订单之前,在保证单价格符合交易所的最小报价单位规则情况下,严格限制在两位小数
std::string toTwoDecimalString(double value) { std::ostringstream oss; oss << std::fixed << std::setprecision(2); oss << value; return oss.str(); }
然后再进行归一化处理: longport::Decimal normalize_price(toTwoDecimalString(price)); normalize_price.normalize();
这样子提交的价格就不会再报错。
由于没有活动,此问题已关闭。如果您仍遇到此问题,请打开一个新问题并附上此问题的链接。 This issue was closed due to inactivity. If you still encounter this issue, please open a new issue and link to this issue. Thank you.