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: 4 additions & 0 deletions py_clob_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,8 @@ def get_balance_allowance(self, params: BalanceAllowanceParams = None):
Requires Level 2 authentication
"""
self.assert_level_2_auth()
if params is None:
raise ValueError("params is required for get_balance_allowance")
Comment thread
cursor[bot] marked this conversation as resolved.
request_args = RequestArgs(method="GET", request_path=GET_BALANCE_ALLOWANCE)
headers = create_level_2_headers(self.signer, self.creds, request_args)
if params.signature_type == -1:
Expand All @@ -949,6 +951,8 @@ def update_balance_allowance(self, params: BalanceAllowanceParams = None):
Requires Level 2 authentication
"""
self.assert_level_2_auth()
if params is None:
raise ValueError("params is required for update_balance_allowance")
request_args = RequestArgs(method="GET", request_path=UPDATE_BALANCE_ALLOWANCE)
headers = create_level_2_headers(self.signer, self.creds, request_args)
if params.signature_type == -1:
Expand Down
35 changes: 35 additions & 0 deletions tests/test_balance_allowance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from unittest import TestCase

from py_clob_client.client import ClobClient
from py_clob_client.clob_types import ApiCreds
from py_clob_client.constants import AMOY

# publicly known private key
private_key = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
creds = ApiCreds(
api_key="test-api-key",
api_secret="test-api-secret",
api_passphrase="test-api-passphrase",
)


class TestBalanceAllowance(TestCase):
def test_get_balance_allowance_requires_params(self):
client = ClobClient(
"https://clob.polymarket.com",
key=private_key,
chain_id=AMOY,
creds=creds,
)
with self.assertRaises(ValueError):
client.get_balance_allowance()

def test_update_balance_allowance_requires_params(self):
client = ClobClient(
"https://clob.polymarket.com",
key=private_key,
chain_id=AMOY,
creds=creds,
)
with self.assertRaises(ValueError):
client.update_balance_allowance()