Configuration

This guide covers how to configure the Opinion CLOB SDK for different environments and use cases.

Client Configuration

The Client class accepts multiple configuration parameters during initialization:

from opinion_clob_sdk import Client

client = Client(
    host='https://proxy.opinion.trade:8443',
    apikey='your_api_key',
    chain_id=56,
    rpc_url='your_rpc_url',
    private_key='0x...',
    multi_sig_addr='0x...',
    conditional_tokens_addr='0xAD1a38cEc043e70E83a3eC30443dB285ED10D774',
    multisend_addr='0x998739BFdAAdde7C933B942a68053933098f9EDa',
    enable_trading_check_interval=3600,
    quote_tokens_cache_ttl=3600,
    market_cache_ttl=300
)

Required Parameters

host

Type: str Description: Opinion API host URL Default: No default (required)

apikey

Type: str Description: API authentication key provided by Opinion Labs Default: No default (required)

How to obtain: fill out this short application form

⚠️ Security: Store API keys in environment variables, never in source code.

chain_id

Type: int Description: Blockchain network chain ID Supported values:

  • 56 - BNB Chain Mainnet (production)

rpc_url

Type: str Description: Blockchain RPC endpoint URL Default: No default (required)

Common providers:

private_key

Type: str (HexStr) Description: Private key for signing orders and transactions Format: 64-character hex string (with or without 0x prefix)

⚠️ Critical Security:

  • Never commit private keys to version control

  • Use environment variables or secure key management systems

  • Ensure the associated address has BNB for gas fees

  • This is the signer address, may differ from multi_sig_addr

multi_sig_addr

Type: str Description: Multi-signature wallet address (your assets/portfolio wallet) Format: Ethereum address (checksummed or lowercase)

Relationship to private_key:

  • private_keySigner address (signs orders/transactions)

  • multi_sig_addrAssets address (holds funds/positions)

  • Can be the same address or different (e.g., hot wallet signs for cold wallet)

Where to find:

  • Check your Opinion platform "My Profile" section

  • Or use the wallet address where you hold USDT/positions

Optional Parameters

conditional_tokens_addr

Type: ChecksumAddress (str) Description: ConditionalTokens contract address Default: 0xAD1a38cEc043e70E83a3eC30443dB285ED10D774 (BNB Chain mainnet)

When to set: Only if using a custom deployment

multisend_addr

Type: ChecksumAddress (str) Description: Gnosis Safe MultiSend contract address Default: 0x998739BFdAAdde7C933B942a68053933098f9EDa (BNB Chain mainnet)

When to set: Only if using a custom Gnosis Safe deployment

enable_trading_check_interval

Type: int Description: Cache duration (in seconds) for trading approval checks Default: 3600 (1 hour) Range: 0 to

Impact:

  • Higher values → Fewer RPC calls → Faster performance

  • 0 → Always check → Slower but always current

  • Recommended: 3600 (approvals rarely change)

quote_tokens_cache_ttl

Type: int Description: Cache duration (in seconds) for quote token data Default: 3600 (1 hour) Range: 0 to

Impact:

  • Quote tokens rarely change

  • Higher values improve performance

  • Recommended: 3600 or higher

market_cache_ttl

Type: int Description: Cache duration (in seconds) for market data Default: 300 (5 minutes) Range: 0 to

Impact:

  • Markets change frequently (prices, status)

  • Lower values → More current data

  • Recommended: 300 for balance of performance and freshness

Environment Variables

Using .env Files

Create a .env file in your project root:

Load in your Python code:

Using System Environment Variables

Set in shell:

Then access in Python:

Configuration Patterns

Multi-Environment Setup

Manage different environments (dev, staging, prod):

Configuration Class

Organize configuration in a class:

Read-Only Client

For applications that only read data (no trading):

Performance Tuning

High-Frequency Trading

For trading bots with frequent API calls:

Analytics/Research

For data analysis with less frequent updates:

Real-Time Monitoring

For dashboards requiring fresh data:

Smart Contract Addresses

BNB Chain Mainnet (Chain ID: 56)

The following smart contract addresses are used by the Opinion CLOB SDK on BNB Chain mainnet:

Contract
Address
Description

ConditionalTokens

0xAD1a38cEc043e70E83a3eC30443dB285ED10D774

ERC1155 conditional tokens contract for outcome tokens

MultiSend

0x998739BFdAAdde7C933B942a68053933098f9EDa

Gnosis Safe MultiSend contract for batch transactions

These addresses are automatically used by the SDK when you specify chain_id=56. You only need to provide custom addresses if you're using a custom deployment.

Verification:

Next Steps

Last updated