Conversation
| size: Optional[str] = None | ||
|
|
||
| # Note: Removed redundant __dict__ and json properties. | ||
| # Use asdict(self) and dumps(asdict(self)) externally for serialization. |
There was a problem hiding this comment.
Bug: Removed property still referenced in hash generation
The json property was removed from OrderBookSummary but is still referenced in utilities.py at line 32 in generate_orderbook_summary_hash. The function attempts to access orderbook.json which no longer exists, causing an AttributeError at runtime when generating orderbook hashes.
| GTC = "GTC" # Good Till Cancelled | ||
| FOK = "FOK" # Fill or Kill | ||
| GTD = "GTD" # Good Till Date (Expiration) | ||
| FAK = "FAK" # Fill and Kill |
There was a problem hiding this comment.
Bug: Enum not JSON serializable in order submission
Changing from the old (incorrect) enumerate base to proper Enum breaks JSON serialization. The OrderType enum is passed directly to order_to_json in utilities.py and placed in a dictionary that gets JSON serialized by httpx. Python's standard json module cannot serialize Enum objects, causing a TypeError when posting orders. The enum value needs to be extracted using .value before serialization.
| # --- ASSET & CONFIGURATION MODELS --- | ||
|
|
||
| class AssetType(Enum): | ||
| """Defines the type of asset used in the exchange.""" |
There was a problem hiding this comment.
Bug: Enum string conversion produces incorrect query parameter
Changing AssetType from enumerate to Enum breaks query parameter generation in helpers.py line 153. The code calls params.asset_type.__str__() which returns "AssetType.COLLATERAL" instead of just "COLLATERAL". This produces malformed API query parameters. The enum value should be accessed using .value instead of .__str__() for proper serialization.
Note
Refactors clob_types.py with Enum-based types, new Base/Limit/Market order args, Optional-typed query models, TickSize/options types, and removes redundant serialization helpers.
enumerateclasses withEnumforOrderTypeand newAssetType.TickSizeLiteraland option structs (CreateOrderOptions,PartialCreateOrderOptions).BaseOrderArgs; split intoOrderArgs(limit) andMarketOrderArgs(market) withorder_typedefaulting toFOK.expirationtoOrderArgs.ApiCreds,RequestArgs,BookParams).TradeParams,OpenOrderParams,DropNotificationParams,BalanceAllowanceParams) to useOptionaltypes.OrderSummaryandOrderBookSummary; remove custom__dict__/jsonproperties in favor ofasdict/dumps.RoundConfig, enhanceContractConfigdocs, and general type/documentation cleanup.Written by Cursor Bugbot for commit 8c51e2b. This will update automatically on new commits. Configure here.