Skip to content
This repository was archived by the owner on May 25, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions py_clob_client/clob_types.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from enum import Enum
from typing import Any
from dataclasses import dataclass, asdict
from json import dumps
Expand All @@ -9,7 +10,7 @@
from .constants import ZERO_ADDRESS


class OrderType(enumerate):
class OrderType(str, Enum):
GTC = "GTC"
FOK = "FOK"
GTD = "GTD"
Expand Down Expand Up @@ -184,7 +185,7 @@ def json(self):
return dumps(self.__dict__, separators=(",", ":"))


class AssetType(enumerate):
class AssetType(str, Enum):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AssetType.__str__() returns enum name, not value

High Severity

Inheriting from (str, Enum) causes Enum.__str__ to take MRO priority over str.__str__, so AssetType.COLLATERAL.__str__() returns "AssetType.COLLATERAL" instead of "COLLATERAL" across all Python versions. This breaks add_balance_allowance_params_to_url in helpers.py, which calls params.asset_type.__str__() to build query parameters — the server will receive asset_type=AssetType.COLLATERAL instead of asset_type=COLLATERAL. The existing test at test_helpers.py:89 would also fail. A __str__ override returning self.value on both enum classes would fix this.

Additional Locations (1)
Fix in Cursor Fix in Web

COLLATERAL = "COLLATERAL"
CONDITIONAL = "CONDITIONAL"

Expand Down