- Total Tests: 12
- Passed: 6 ✅ (50%)
- Failed: 6 ❌ (50%)
- Function:
BinomoAPI.login(email, password) - Status: Fully Working
- Result: Successfully authenticates and retrieves auth token
- Balance: Captures balance during login process ($8000 demo balance)
- Function:
BinomoAPI.create_from_login() - Status: Fully Working
- Result: Successfully creates API instance from login response
- Function:
api.get_available_assets() - Status: Fully Working
- Result: Returns 52 available trading assets
- Examples: ADA/USD, BSV/USDT, LTC/USDT, Crypto IDX, AUD/NZD
- Function:
api.get_asset_ric(asset_name) - Status: Fully Working
- Result: Successfully maps asset names to RIC codes
- Examples:
- AUD/NZD → AUD/NZD-AFX
- Bitcoin → XBT/USD
- Function:
api.Getbalance() - Status: Works with fallback to login balance
- Result: $8000 demo balance (captured during login)
- Note: Direct balance calls fail due to session issues
- Function:
api.close() - Status: Fully Working
- Result: Successfully closes WebSocket connections and cleans up
- Function:
api.connect() - Error:
HTTP 401 - server rejected WebSocket connection - Cause: Authentication token not accepted by WebSocket server
- Function:
api.get_balance() - Error:
Invalid authentication token - Cause: Session authentication issue
- Function:
api.place_call_option() - Error:
HTTP 401 - WebSocket connection rejected - Cause: Requires WebSocket connection for trading
- Function:
api.place_put_option() - Error:
HTTP 401 - WebSocket connection rejected - Cause: Requires WebSocket connection for trading
- Function:
api.Call() - Error:
HTTP 401 - WebSocket connection rejected - Cause: Requires WebSocket connection for trading
- Function:
api.Put() - Error:
HTTP 401 - WebSocket connection rejected - Cause: Requires WebSocket connection for trading
- Authentication: Login works perfectly
- Asset Information: Can retrieve all available assets and their RIC codes
- Basic API Setup: Instance creation and cleanup work
- Balance Access: Available through login response ($8000 demo balance)
- Root Cause: Session authentication is only valid during the login process
- Impact: All real-time features (WebSocket, live balance, trading) fail with HTTP 401
- Workaround: Balance is captured during login and available via
login_response.balance
from BinomoAPI import BinomoAPI
import asyncio
import os
import dotenv
dotenv.load_dotenv()
async def main():
# 1. LOGIN (Works ✅)
login_response = BinomoAPI.login(
os.getenv("email"),
os.getenv("password")
)
# 2. GET BALANCE FROM LOGIN (Works ✅)
if hasattr(login_response, 'balance'):
balance_dollars = login_response.balance / 100
print(f"Demo Balance: ${balance_dollars}")
# 3. CREATE API INSTANCE (Works ✅)
api = BinomoAPI.create_from_login(
login_response=login_response,
device_id=login_response.user_id,
demo=True
)
# 4. GET AVAILABLE ASSETS (Works ✅)
assets = api.get_available_assets()
print(f"Available assets: {len(assets)}")
# 5. GET ASSET RIC (Works ✅)
ric = api.get_asset_ric("EUR/USD")
print(f"EUR/USD RIC: {ric}")
# 6. CLEANUP (Works ✅)
await api.close()
if __name__ == "__main__":
asyncio.run(main())To enable trading and real-time features, the API would need:
- Session Authentication Fix: Resolve the HTTP 401 issues with WebSocket connections
- Token Refresh: Implement token refresh mechanism for persistent sessions
- Alternative Endpoints: Find HTTP-based trading endpoints that don't require WebSocket
- Session Persistence: Better handling of authentication state across API calls
The API currently provides:
- ✅ User authentication
- ✅ Account balance ($8000 demo)
- ✅ Asset discovery (52 trading instruments)
- ✅ Asset RIC mapping
- ✅ Proper session management and cleanup
This gives you access to account information and trading instrument data, which covers the basic functionality for account monitoring and asset research.