Skip to content
This repository was archived by the owner on May 25, 2026. It is now read-only.
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions py_clob_client/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
import json
import time
from typing import Optional
from typing import Literal, Optional

from py_builder_signing_sdk.config import BuilderConfig

Expand Down Expand Up @@ -1060,7 +1060,7 @@ def get_builder_trades(self, params: TradeParams = None, next_cursor="MA=="):
return results

def calculate_market_price(
self, token_id: str, side: str, amount: float, order_type: OrderType
self, token_id: str, side: Literal["BUY", "SELL"], amount: float, order_type: OrderType
) -> float:
"""
Calculates the matching price considering an amount and the current orderbook
Expand Down
6 changes: 3 additions & 3 deletions py_clob_client/clob_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class RequestArgs:
@dataclass
class BookParams:
token_id: str
side: str = ""
side: Literal["BUY", "SELL", ""] = ""


@dataclass
Expand All @@ -59,7 +59,7 @@ class OrderArgs:
Size in terms of the ConditionalToken
"""

side: str
side: Literal["BUY", "SELL"]
"""
Side of the order
"""
Expand Down Expand Up @@ -98,7 +98,7 @@ class MarketOrderArgs:
SELL orders: Shares to sell
"""

side: str
side: Literal["BUY", "SELL"]
"""
Side of the order
"""
Expand Down
6 changes: 4 additions & 2 deletions py_clob_client/order_builder/builder.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import Literal

from py_order_utils.builders import OrderBuilder as UtilsOrderBuilder
from py_order_utils.signer import Signer as UtilsSigner
from py_order_utils.model import (
Expand Down Expand Up @@ -49,7 +51,7 @@ def __init__(self, signer: Signer, sig_type=None, funder=None):
self.funder = funder if funder is not None else self.signer.address()

def get_order_amounts(
self, side: str, size: float, price: float, round_config: RoundConfig
self, side: Literal["BUY", "SELL"], size: float, price: float, round_config: RoundConfig
):
raw_price = round_normal(price, round_config.price)

Expand Down Expand Up @@ -83,7 +85,7 @@ def get_order_amounts(
raise ValueError(f"order_args.side must be '{BUY}' or '{SELL}'")

def get_market_order_amounts(
self, side: str, amount: float, price: float, round_config: RoundConfig
self, side: Literal["BUY", "SELL"], amount: float, price: float, round_config: RoundConfig
):
raw_price = round_normal(price, round_config.price)

Expand Down
4 changes: 2 additions & 2 deletions py_clob_client/rfq/rfq_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class RfqUserRequest:
price: float
"""Price per token (0 < price < 1)."""

side: str
side: Literal["BUY", "SELL"]
"""Order side: "BUY" or "SELL"."""

size: float
Expand All @@ -54,7 +54,7 @@ class RfqUserQuote:
price: float
"""Price per token (0 < price < 1)."""

side: str
side: Literal["BUY", "SELL"]
"""Quoter's side: "BUY" or "SELL"."""

size: float
Expand Down