Skip to content

Unknown format '', attempted to normalize to '0x' #203

@dekacypher

Description

@dekacypher

Hi,

I've tried adding both maker and taker as parameters to the OrderArgs but then i just get balance/allowance error and it seems like this is a cycle no matter how much i've tried its still not working. Any help would be deeply appreciated!

I've tried updating the pyclient-clob package to newest version


                # Create OrderArgs - Include maker address to fix "Unknown format" error
                # Some versions of py-clob-client require maker to be explicitly set
                order_args = OrderArgs(
                    token_id=str(final_token_id).strip(),
                    price=float(final_price),
                    size=int(final_shares),
                    side=BUY
        
                )

                # 🔥 CRITICAL FIX: Explicitly set maker attribute on OrderArgs object
                # The PyClob library expects order_args.maker to be set
                order_args.maker = maker_address

                # Extra debug print right before sending
                log("   🧾 ORDER PAYLOAD (pre-send):")
                log(f"      maker: {maker_address!r} (len={len(maker_address)})")
                log(f"      taker: {order_args.taker!r} (len={len(order_args.taker)})")
                log(f"      token_id: {order_args.token_id!r} (len={len(order_args.token_id)})")
                log(f"      price: {order_args.price!r} size: {order_args.size!r} side: {order_args.side!r}")

                log(f"   📍 ATTEMPT {attempt + 1}/{MAX_RETRIES + 1}: {shares:.1f} shares @ ${float(market_price)}")
                log(f"   ✅ OrderArgs created with maker address: {maker_address[:10]}...")

                signed = client.create_order(order_args)
                resp = client.post_order(signed, OrderType.GTC)

            except Exception as order_err:
[11:29:30 AM ET]    ❌ Parameter formatting error: Unknown format '', attempted to normalize to '0x'
[11:29:30 AM ET] Traceback: Traceback (most recent call last):  
  File "/home/azureuser/real_trader.py", line 2100, in place_order
    signed = client.create_order(order_args)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/azureuser/rl_env/lib/python3.12/site-packages/py_clob_client/client.py", line 494, in create_order
    return self.builder.create_order(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/azureuser/rl_env/lib/python3.12/site-packages/py_clob_client/order_builder/builder.py", line 156, in create_order
    return order_builder.build_signed_order(data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/azureuser/rl_env/lib/python3.12/site-packages/py_order_utils/builders/order_builder.py", line 68, in build_signed_order
    order = self.build_order(data)
            ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/azureuser/rl_env/lib/python3.12/site-packages/py_order_utils/builders/order_builder.py", line 45, in build_order
    maker=normalize_address(data.maker),
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/azureuser/rl_env/lib/python3.12/site-packages/py_order_utils/utils.py", line 18, in normalize_address
    return to_checksum_address(address)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/azureuser/rl_env/lib/python3.12/site-packages/eth_utils/address.py", line 129, in to_checksum_address
    norm_address = to_normalized_address(value)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/azureuser/rl_env/lib/python3.12/site-packages/eth_utils/address.py", line 79, in to_normalized_address
    raise ValueError(
ValueError: Unknown format '', attempted to normalize to '0x'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions