{"record":{"id":"bf42f8b81b235d67","repo":"nautechsystems/nautilus_trader","slug":"signed-limit-order-share-quantity-signed-base-qty","errorCode":null,"errorMessage":"Signed limit order share quantity {signed_base_qty} is invalid at instrument size precision {}: {e}","messagePattern":"Signed limit order share quantity (.+?) is invalid at instrument size precision (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/polymarket/src/execution/submitter.rs","lineNumber":475,"sourceCode":"            )\n        } else {\n            self.order_builder.build_limit_order(\n                &request.token_id,\n                side,\n                request.price.as_decimal(),\n                request.quantity.as_decimal(),\n                order_type,\n                &expiration,\n                request.neg_risk,\n                request.tick_decimals,\n            )\n        }\n        .map_err(|e| anyhow::anyhow!(\"{e}\"))?;\n\n        let signed_base_qty = signed_base_quantity(order.maker_amount, order.taker_amount, side);\n        let expected_base_qty =\n            Quantity::from_decimal_dp(signed_base_qty, request.size_precision).map_err(|e| {\n                anyhow::anyhow!(\n                    \"Signed limit order share quantity {signed_base_qty} is invalid at instrument size precision {}: {e}\",\n                    request.size_precision,\n                )\n            })?;\n        anyhow::ensure!(\n            expected_base_qty.as_decimal() == signed_base_qty,\n            \"Signed limit order share quantity {signed_base_qty} cannot be represented exactly at instrument size precision {}\",\n            request.size_precision,\n        );\n\n        let expected_venue_order_id = self\n            .order_builder\n            .expected_order_id(&order, request.neg_risk)?;\n\n        Ok(SignedLimitOrderSubmission {\n            order,\n            order_type,\n            post_only: request.post_only,","sourceCodeStart":457,"sourceCodeEnd":493,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/polymarket/src/execution/submitter.rs#L457-L493","documentation":"Raised in `prepare_limit_order_submission` when converting the signed order's implied share quantity (`signed_base_qty`, derived from maker/taker amounts) into a `Quantity` at the instrument's size_precision fails — e.g. the decimal is malformed, negative, or has too many fractional digits. This is a post-signing consistency check ensuring the venue amounts decode to a valid quantity. Submission is aborted.","triggerScenarios":"Signed amounts whose ratio decodes to a share quantity that cannot be parsed at request.size_precision (e.g. more decimal places than the instrument allows, or an invalid decimal).","commonSituations":"Instruments configured with a size_precision smaller than what the builder's rounding produced; extreme prices causing long decimal expansions; misconfigured size_precision in the instrument definition.","solutions":["Match request.size_precision to the precision the order builder actually rounds to","Verify instrument size_precision against current Polymarket market metadata","Inspect the inner parse error for whether the quantity is invalid vs merely imprecise"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let dp = signed_base_qty.fract().scale();\nif dp > request.size_precision {\n    return Err(anyhow!(\"signed qty has {dp} dp > size_precision {}\", request.size_precision));\n}","typeGuard":null,"tryCatchPattern":"match prepare_limit_order_submission(&req).await {\n    Err(e) if e.to_string().contains(\"is invalid at instrument size precision\") => {\n        // correct instrument size_precision config and resubmit\n    }\n    other => other,\n}","preventionTips":["Verify instrument size_precision matches venue granularity at load time","Add a startup consistency check between config precision and venue metadata"],"tags":["polymarket","precision","decimal","limit-order"],"backgroundTag":"value-out-of-range","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}