๐งฑBuilder Codes
How It Works
Key Characteristics
Using Builder Fees with the Python SDK
Basic Example with Builder Fee
import asyncio
from ostium_python_sdk import OstiumSDK
from ostium_python_sdk.config import NetworkConfig
async def main():
# Initialize SDK
config = NetworkConfig.testnet()
sdk = OstiumSDK(config, private_key, rpc_url, verbose=True)
# Get current price
latest_price, _, _ = await sdk.price.get_price("BTC", "USD")
# Define trade parameters with builder fee
trade_params = {
'collateral': 300,
'leverage': 50,
'asset_type': 0, # BTC-USD
'direction': True, # Long
'order_type': 'MARKET',
'builder_address': '0x_YOUR_EVM_ADDRESS',
'builder_fee': 0.1 # 0.1%
}
# Execute trade
trade_result = sdk.ostium.perform_trade(trade_params, at_price=latest_price)
print(f"Order ID: {trade_result['order_id']}")
print(f"Transaction: {trade_result['receipt']['transactionHash'].hex()}")
if __name__ == "__main__":
asyncio.run(main())Trade Without Builder Fee
Direct Contract Interaction
Contract Interface
Web3.py Example
Without Builder Fee (Direct Contract Call)
Last updated