You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importasynciofromBinomoAPIimportBinomoAPI, AuthenticationErrorasyncdefmain():
try:
# Loginlogin_response=BinomoAPI.login("email@example.com", "password")
# Use API with context managerasyncwithBinomoAPI(
auth_token=login_response.authtoken,
device_id="your-device-id",
demo=True,
enable_logging=True
) asapi:
# Check balancebalance=awaitapi.get_balance()
print(f"Balance: ${balance.amount:.2f}")
# Place tradesresult=awaitapi.place_call_option("EUR/USD", 60, 1.0)
print(f"Trade result: {result}")
exceptAuthenticationErrorase:
print(f"Login failed: {e}")
asyncio.run(main())
📋 Common Operations
Authentication
# Login and get auth datalogin_response=BinomoAPI.login(email, password, device_id)
Balance Management
# Get current balancebalance=awaitapi.get_balance()
# Get specific account balancedemo_balance=awaitapi.get_balance("demo")
real_balance=awaitapi.get_balance("real")
Asset Management
# Get all assetsassets=api.get_available_assets()
# Get asset RICric=api.get_asset_ric("EUR/USD")
login_response.authtoken# Authentication tokenlogin_response.user_id# User ID
Balance
balance.amount# Balance amount (float)balance.currency# Currency codebalance.account_type# "demo" or "real"
Asset
asset.name# Asset name (e.g., "EUR/USD")asset.ric# RIC codeasset.is_active# Boolean
🔄 Legacy Compatibility
# Old methods still work but are deprecatedbalance=awaitapi.Getbalance()
awaitapi.Call("EUR", 60, 5.0, True)
awaitapi.Put("GBP", 120, 10.0, False)
# Use new methods insteadbalance=awaitapi.get_balance()
awaitapi.place_call_option("EUR/USD", 60, 5.0, use_demo=True)
awaitapi.place_put_option("GBP/USD", 120, 10.0, use_demo=False)