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)
# Production
host='https://proxy.opinion.trade:8443'apikey
Type: str Description: API authentication key provided by Opinion Labs Default: No default (required)
How to obtain: fill out this short application form
apikey='________'⚠️ 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)
# Mainnet
chain_id=56rpc_url
Type: str Description: Blockchain RPC endpoint URL Default: No default (required)
Common providers:
- BNB Chain Mainnet: - https://bsc-dataseed.binance.org
- BNB Chain (Nodereal): - https://bsc.nodereal.io
# Public RPC (rate limited)
rpc_url='https://bsc-dataseed.binance.org'
# Private RPC (recommended for production)
rpc_url='https://bsc.nodereal.io'private_key
Type: str (HexStr) Description: Private key for signing orders and transactions Format: 64-character hex string (with or without 0x prefix)
private_key='0x1234567890abcdef...'  # With 0x prefix
# or
private_key='1234567890abcdef...'    # 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)
multi_sig_addr='0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb'Relationship to private_key:
- private_key→ Signer address (signs orders/transactions)
- multi_sig_addr→ Assets 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)
# Default for BNB Chain - no need to specify
client = Client(chain_id=56, ...)
# Custom deployment
conditional_tokens_addr='0xYourConditionalTokensContract...'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)
# Default for BNB Chain - no need to specify
client = Client(chain_id=56, ...)
# Custom deployment
multisend_addr='0xYourMultiSendContract...'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 ∞
# Default: check approval status every hour
enable_trading_check_interval=3600
# Check every time (no caching)
enable_trading_check_interval=0
# Check daily
enable_trading_check_interval=86400Impact:
- 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 ∞
# Default: cache for 1 hour
quote_tokens_cache_ttl=3600
# No caching (always fresh)
quote_tokens_cache_ttl=0
# Cache for 6 hours
quote_tokens_cache_ttl=21600Impact:
- Quote tokens rarely change 
- Higher values improve performance 
- Recommended: - 3600or higher
market_cache_ttl
Type: int Description: Cache duration (in seconds) for market data Default: 300 (5 minutes) Range: 0 to ∞
# Default: cache for 5 minutes
market_cache_ttl=300
# No caching (always fresh)
market_cache_ttl=0
# Cache for 1 hour
market_cache_ttl=3600Impact:
- Markets change frequently (prices, status) 
- Lower values → More current data 
- Recommended: - 300for balance of performance and freshness
Environment Variables
Using .env Files
Create a .env file in your project root:
# .env
API_KEY=opn_prod_abc123xyz789
RPC_URL=____
PRIVATE_KEY=0x1234567890abcdef...
MULTI_SIG_ADDRESS=0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb
CHAIN_ID=56Load in your Python code:
import os
from dotenv import load_dotenv
from opinion_clob_sdk import Client
# Load .env file
load_dotenv()
# Use environment variables
client = Client(
    host='https://api.opinion.trade',
    apikey=os.getenv('API_KEY'),
    chain_id=int(os.getenv('CHAIN_ID', 56)),
    rpc_url=os.getenv('RPC_URL'),
    private_key=os.getenv('PRIVATE_KEY'),
    multi_sig_addr=os.getenv('MULTI_SIG_ADDRESS')
)Using System Environment Variables
Set in shell:
# Linux/macOS
export API_KEY="opn_prod_abc123xyz789"
export RPC_URL=___
export PRIVATE_KEY="0x..."
export MULTI_SIG_ADDRESS="0x..."
# Windows (Command Prompt)
set API_KEY=opn_prod_abc123xyz789
set RPC_URL=___
# Windows (PowerShell)
$env:API_KEY="opn_prod_abc123xyz789"
$env:RPC_URL=___Then access in Python:
import os
client = Client(
    host='https://proxy.opinion.trade:8443',
    apikey=os.environ['API_KEY'],  # Raises error if not set
    # ... or ...
    apikey=os.getenv('API_KEY', 'default_value'),  # Returns default if not set
    # ...
)Configuration Patterns
Multi-Environment Setup
Manage different environments (dev, staging, prod):
import os
from opinion_clob_sdk import Client
ENVIRONMENTS = {
    'production': {
        'host': 'https://proxy.opinion.trade:8443',
        'chain_id': 56,  # BNB Chain Mainnet
        'rpc_url': 'https://bsc-dataseed.binance.org'
    }
}
def create_client(env='production'):
    config = ENVIRONMENTS[env]
    return Client(
        host=config['host'],
        apikey=os.getenv(f'{env.upper()}_API_KEY'),
        chain_id=config['chain_id'],
        rpc_url=config['rpc_url'],
        private_key=os.getenv(f'{env.upper()}_PRIVATE_KEY'),
        multi_sig_addr=os.getenv(f'{env.upper()}_MULTI_SIG_ADDRESS')
    )
# Usage
dev_client = create_client('development')
prod_client = create_client('production')Configuration Class
Organize configuration in a class:
from dataclasses import dataclass
import os
from opinion_clob_sdk import Client
@dataclass
class OpinionConfig:
    api_key: str
    rpc_url: str
    private_key: str
    multi_sig_address: str
    chain_id: int = 56
    host: str = 'https://proxy.opinion.trade:8443'
    market_cache_ttl: int = 300
    @classmethod
    def from_env(cls):
        """Load configuration from environment variables"""
        return cls(
            api_key=os.environ['API_KEY'],
            rpc_url=os.environ['RPC_URL'],
            private_key=os.environ['PRIVATE_KEY'],
            multi_sig_address=os.environ['MULTI_SIG_ADDRESS'],
            chain_id=int(os.getenv('CHAIN_ID', 56))
        )
    def create_client(self):
        """Create Opinion Client from this configuration"""
        return Client(
            host=self.host,
            apikey=self.api_key,
            chain_id=self.chain_id,
            rpc_url=self.rpc_url,
            private_key=self.private_key,
            multi_sig_addr=self.multi_sig_address,
            market_cache_ttl=self.market_cache_ttl
        )
# Usage
config = OpinionConfig.from_env()
client = config.create_client()Read-Only Client
For applications that only read data (no trading):
# Minimal configuration for read-only access
client = Client(
    host='https://proxy.opinion.trade:8443',
    apikey=os.getenv('API_KEY'),
    chain_id=56,
    rpc_url='',           # Empty if not doing contract operations
    private_key='0x00',   # Dummy key if not placing orders
    multi_sig_addr='0x0000000000000000000000000000000000000000'
)
# Can use all GET methods
markets = client.get_markets()
market = client.get_market(123)
orderbook = client.get_orderbook('token_123')
# Cannot use trading or contract methods
# client.place_order(...)  # Would fail
# client.split(...)        # Would failPerformance Tuning
High-Frequency Trading
For trading bots with frequent API calls:
client = Client(
    # ... required params ...
    market_cache_ttl=60,           # 1-minute cache for faster updates
    quote_tokens_cache_ttl=3600,   # 1-hour cache (rarely changes)
    enable_trading_check_interval=7200  # 2-hour cache (already approved)
)Analytics/Research
For data analysis with less frequent updates:
client = Client(
    # ... required params ...
    market_cache_ttl=1800,         # 30-minute cache
    quote_tokens_cache_ttl=86400,  # 24-hour cache
    enable_trading_check_interval=0  # Not trading
)Real-Time Monitoring
For dashboards requiring fresh data:
client = Client(
    # ... required params ...
    market_cache_ttl=0,            # No caching
    quote_tokens_cache_ttl=0,      # No caching
    enable_trading_check_interval=0
)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:
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:
- ConditionalTokens: View on BscScan 
- MultiSend: View on BscScan 
Next Steps
- API Reference: All Supported Methods 
- Configuration Guide: Configuration 
- Core Concepts: Architecture 
- Troubleshooting: Common Issues 
Last updated

