Skip to content
This repository was archived by the owner on May 25, 2026. It is now read-only.

fix: use is not None to check neg_risk option value#322

Open
maraple8 wants to merge 1 commit into
Polymarket:mainfrom
maraple8:fix/neg_risk_false_bug
Open

fix: use is not None to check neg_risk option value#322
maraple8 wants to merge 1 commit into
Polymarket:mainfrom
maraple8:fix/neg_risk_false_bug

Conversation

@maraple8
Copy link
Copy Markdown

@maraple8 maraple8 commented Apr 3, 2026

Overview

Fix bug where neg_risk=False incorrectly triggers a call to get_neg_risk(), causing unnecessary network requests.

Description

In create_order and create_market_order methods, the original code used truthiness check on options.neg_risk. When neg_risk=False, the condition evaluates to falsy, incorrectly falling through to call get_neg_risk(). Fixed by using is not None check to explicitly distinguish between "not set" and "set to False".

Testing instructions

don't need

Types of changes

  • Refactor/enhancement
  • Bug fix/behavior correction
  • New feature
  • Breaking change
  • Other, additional

Notes

  • Affects py_clob_client/client.py lines 519 and 574
  • Before fix: neg_risk=False triggers network call
  • After fix: neg_risk=False uses the value directly without calling get_neg_risk()

Status

  • Prefix PR title with [WIP] if necessary (changes not yet made).
  • Add tests to cover changes as needed.
  • Update documentation/changelog as needed.
  • Verify all tests run correctly in CI and pass.
  • Ready for review/merge.

Note

Low Risk
Low risk behavior fix limited to order creation option handling; it only changes how neg_risk=False is interpreted to avoid an unnecessary get_neg_risk() network call.

Overview
Fixes create_order and create_market_order so an explicitly provided options.neg_risk=False is honored.

The truthiness check is replaced with an is not None guard, preventing unintended fallback to get_neg_risk() and eliminating unnecessary network requests when neg_risk is set to False.

Written by Cursor Bugbot for commit 45e3481. This will update automatically on new commits. Configure here.

@maraple8 maraple8 requested a review from a team as a code owner April 3, 2026 15:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant