BinomoAPI

API Reference

Support

donate in paypal: Paypal.me
help us in patreon: Patreon
👉 Join us on Discord
Get our services here
Let us create your bot here
Contact us in Telegram

Complete reference documentation for the BinomoAPI Python client.

🔐 Authentication

BinomoAPI.login

@staticmethod
def login(email: str, password: str) -> LoginResponse:
    """
    Authenticate with Binomo platform.
    
    Args:
        email (str): Your Binomo account email
        password (str): Your Binomo account password
    
    Returns:
        LoginResponse: Object containing authtoken and user_id
        
    Raises:
        AuthenticationError: If login fails
    """

BinomoAPI Constructor

def __init__(
    self,
    auth_token: str,
    device_id: str,
    demo: bool = True,
    enable_logging: bool = False,
    log_level: str = "INFO"
) -> None:
    """
    Initialize BinomoAPI client.
    
    Args:
        auth_token (str): Authentication token from login
        device_id (str): Unique device identifier
        demo (bool): Use demo account if True
        enable_logging (bool): Enable debug logging
        log_level (str): Logging level (DEBUG/INFO/WARNING/ERROR)
    """

💰 Balance Operations

get_balance

async def get_balance(
    self,
    account_type: Optional[str] = None
) -> Balance:
    """
    Get account balance.
    
    Args:
        account_type (str, optional): "demo" or "real"
    
    Returns:
        Balance: Current balance information
        
    Raises:
        ConnectionError: On network issues
    """

📈 Trading Operations

place_call_option

async def place_call_option(
    self,
    asset: str,
    duration_seconds: int,
    amount: float,
    use_demo: Optional[bool] = None
) -> Dict[str, Any]:
    """
    Place a CALL option trade.
    
    Args:
        asset (str): Asset name (e.g., "EUR/USD")
        duration_seconds (int): Option duration in seconds
        amount (float): Trade amount
        use_demo (bool, optional): Override default account type
        
    Returns:
        dict: Trade result information
        
    Raises:
        TradeError: If trade fails
        InsufficientBalanceError: If balance too low
    """

place_put_option

async def place_put_option(
    self,
    asset: str,
    duration_seconds: int,
    amount: float,
    use_demo: Optional[bool] = None
) -> Dict[str, Any]:
    """
    Place a PUT option trade.
    
    Args:
        asset (str): Asset name (e.g., "EUR/USD")
        duration_seconds (int): Option duration in seconds
        amount (float): Trade amount
        use_demo (bool, optional): Override default account type
        
    Returns:
        dict: Trade result information
        
    Raises:
        TradeError: If trade fails
        InsufficientBalanceError: If balance too low
    """

🎯 Asset Management

get_available_assets

def get_available_assets(self) -> List[Asset]:
    """
    Get list of available trading assets.
    
    Returns:
        List[Asset]: Available assets and their properties
    """

get_asset_ric

def get_asset_ric(
    self,
    asset_name: str
) -> str:
    """
    Get RIC code for an asset.
    
    Args:
        asset_name (str): Asset name (e.g., "EUR/USD")
        
    Returns:
        str: RIC code for the asset
        
    Raises:
        InvalidParameterError: If asset not found
    """

⚙️ Configuration Management

get_config

@staticmethod
def get_config() -> Config:
    """
    Get configuration manager instance.
    
    Returns:
        Config: Configuration manager object
    """

Config Methods

class Config:
    def get(self, section: str, key: str) -> Any: ...
    def set(self, section: str, key: str, value: Any) -> None: ...
    def save(self) -> None: ...

🚨 Exception Hierarchy

BinomoAPIException
├── AuthenticationError   # Login/auth issues
├── ConnectionError      # Network problems
├── InvalidParameterError # Bad input
├── TradeError          # Trade execution fails
└── InsufficientBalanceError # Not enough funds

📊 Data Models

LoginResponse

@dataclass
class LoginResponse:
    authtoken: str  # Authentication token
    user_id: str    # User identifier

Balance

@dataclass
class Balance:
    amount: float       # Balance amount
    currency: str       # Currency code
    account_type: str   # "demo" or "real"

Asset

@dataclass
class Asset:
    name: str          # Asset name
    ric: str          # RIC code
    is_active: bool   # Trading availability

🔄 Constants

TRADE_DIRECTIONS = {
    "CALL": "call",
    "PUT": "put"
}

ACCOUNT_TYPES = {
    "DEMO": "demo",
    "REAL": "real"
}

OPTION_TYPES = {
    "TURBO": "turbo",
    "BINARY": "binary"
}

📝 Logging

import logging

# Configure logging
logging.basicConfig(
    level=logging.INFO,
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
    handlers=[
        logging.FileHandler('trading.log'),
        logging.StreamHandler()
    ]
)

🔗 WebSocket Client

class WebSocketClient:
    async def connect(self) -> None: ...
    async def subscribe(self, channels: List[str]) -> None: ...
    async def send_message(self, message: Dict[str, Any]) -> None: ...
    async def close(self) -> None: ...

Remember to handle all operations within an async context manager for proper resource management:

async with BinomoAPI(...) as api:
    # Your trading code here
    pass  # Resources automatically cleaned up