Overview
Last updated
from opinion_clob_sdk import Client
from opinion_clob_sdk.chain.py_order_utils.model.order import PlaceOrderDataInput
from opinion_clob_sdk.chain.py_order_utils.model.sides import OrderSide
client = Client(host='https://proxy.opinion.trade:8443', apikey='your_key', ...)
# Place a limit order
order = PlaceOrderDataInput(
marketId=123,
tokenId='token_yes',
side=OrderSide.BUY,
orderType=LIMIT_ORDER,
price='0.55',
makerAmountInQuoteToken=100
)
result = client.place_order(order)# Get all active markets
markets = client.get_markets(status=TopicStatusFilter.ACTIVATED, limit=100)
# Analyze orderbook depth
orderbook = client.get_orderbook(token_id='token_123')
print(f"Best bid: {orderbook.bids[0]['price']}")
print(f"Best ask: {orderbook.asks[0]['price']}")# Get user positions
positions = client.get_my_positions(limit=50)
# Get balances
balances = client.get_my_balances()
# Get trade history
trades = client.get_my_trades(market_id=123)βββββββββββββββββββββββββββββββββββββββββββββββ
β Application Layer β
β (Your Python Code) β
ββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββββββββββββββββββ
β Opinion CLOB SDK β
β ββββββββββββββββ βββββββββββββββββββ β
β β Client API β β Contract Caller β β
β β (REST) β β (Blockchain) β β
β ββββββββ¬ββββββββ ββββββββββββ¬βββββββ β
βββββββββββΌβββββββββββββββββββββββΌβββββββββββββ
β β
βββββββββββΌβββββββββββ ββββββββ-βΌββββββββββββ
β Opinion API β β Blockchain β
β (CLOB Exchange) β β (Smart Contracts) β
ββββββββββββββββββββββ ββββββββββββββββββββββ