nautechsystems/nautilus_trader · error

Limit SELL orders require quote_quantity=false (amount in sh

Error message

Limit SELL orders require quote_quantity=false (amount in shares)

What it means

Raised via anyhow::ensure! in `prepare_limit_order_submission` when a limit SELL order is requested with quote_quantity=true, i.e. the amount is denominated in USDC collateral rather than shares. Polymarket only supports collateral-denominated (quote) amounts on the BUY side, so the adapter rejects quote-denominated SELLs outright. This is a pre-trade validation; nothing is signed or sent.

Source

Thrown at crates/adapters/polymarket/src/execution/submitter.rs:446

        requests: &[LimitOrderSubmitRequest],
    ) -> Vec<anyhow::Result<SignedLimitOrderSubmission>> {
        let futures = requests
            .iter()
            .map(|request| self.prepare_limit_order_submission(request));
        futures_util::future::join_all(futures).await
    }

    pub(crate) async fn prepare_limit_order_submission(
        &self,
        request: &LimitOrderSubmitRequest,
    ) -> anyhow::Result<SignedLimitOrderSubmission> {
        let order_type = PolymarketOrderType::try_from(request.time_in_force)
            .map_err(|e| anyhow::anyhow!("Unsupported time in force: {e}"))?;
        let side = PolymarketOrderSide::from(request.side);
        let expiration = limit_order_expiration(request.expire_time);

        let order = if request.quote_quantity {
            anyhow::ensure!(
                side == PolymarketOrderSide::Buy,
                "Limit SELL orders require quote_quantity=false (amount in shares)"
            );
            self.order_builder.build_limit_order_from_collateral(
                &request.token_id,
                request.price.as_decimal(),
                request.quantity.as_decimal(),
                &expiration,
                request.neg_risk,
                request.tick_decimals,
            )
        } else {
            self.order_builder.build_limit_order(
                &request.token_id,
                side,
                request.price.as_decimal(),
                request.quantity.as_decimal(),
                order_type,

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Set quote_quantity=false for SELL limit orders and express the amount in shares
  2. Flip the sizing logic so SELL quantities are computed in base (share) units
  3. Add a client-side pre-check mirroring this constraint before calling the submitter

Example fix

// before
let req = LimitOrderSubmitRequest { side: OrderSide::Sell, quote_quantity: true, amount: usdc_amount, .. };
// after
let req = LimitOrderSubmitRequest { side: OrderSide::Sell, quote_quantity: false, amount: share_amount, .. };
Defensive patterns

Strategy: validation

Validate before calling

if req.side == OrderSide::Sell && req.quote_quantity {
    return Err(anyhow!("SELL limit orders must be share-denominated"));
}

Try / catch

if let Err(e) = prepare_limit_order_submission(&req).await {
    if e.to_string().contains("Limit SELL orders require quote_quantity=false") {
        // rebuild request with quote_quantity=false and share-denominated amount
    }
}

Prevention

When it happens

Trigger: Constructing a LimitOrderSubmitRequest with side=Sell and quote_quantity=true (amount interpreted as USDC).

Common situations: Copy-pasting BUY-side order construction code for SELLs; risk/sizing engines that uniformly express target exposure in quote currency; adapter upgrades where quote_quantity defaults flipped.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/aaa42f622212b65d. Report an issue: GitHub.