Getting Started
Getting Started with BinomoAPI
Installation
Prerequisites
- Python 3.7 or higher
- pip (Python package manager)
- A Binomo trading account
Install from PyPI
pip install BinomoAPIInstall from Source
git clone https://github.com/yourname/BinomoAPI.git
cd BinomoAPI
pip install -e .Basic Setup
Environment Variables
Set up your credentials securely using environment variables:
export BINOMO_EMAIL="your_email@example.com"
export BINOMO_PASSWORD="your_password"
export BINOMO_DEMO_MODE="true" # Use demo account by defaultConfiguration File
Create a binomo_config.json file (optional):
{
"api": {
"demo_mode": true,
"enable_logging": true,
"log_level": "INFO"
},
"trading": {
"default_asset": "EUR/USD",
"min_trade_amount": 1.0,
"max_trade_amount": 100.0,
"risk_percentage": 2.0
}
}Your First Trade
Here’s a complete example of making your first trade:
import asyncio
from BinomoAPI import BinomoAPI, AuthenticationError, TradeError
async def main():
try:
# Login to get authentication data
login_response = BinomoAPI.login(
"your_email@example.com",
"your_password"
)
print(f"Login successful! User ID: {login_response.user_id}")
# Initialize API client
async with BinomoAPI(
auth_token=login_response.authtoken,
device_id=login_response.user_id,
demo=True, # Use demo account
enable_logging=True
) as api:
# Check balance
balance = await api.get_balance()
print(f"Demo account balance: ${balance.amount}")
# Place a trade
if balance.amount >= 1.0:
result = await api.place_call_option(
asset="EUR/USD",
duration_seconds=60,
amount=1.0
)
print(f"Trade placed successfully: {result}")
else:
print("Insufficient balance for trading")
except AuthenticationError as e:
print(f"Login failed: {e}")
except TradeError as e:
print(f"Trade failed: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
if __name__ == "__main__":
asyncio.run(main())Understanding Results
Login Response
The login_response object contains:
authtoken: Authentication token for API callsuser_id: Your unique user identifier
Balance Information
The balance object includes:
amount: Current balance amountcurrency: Currency codeaccount_type: “demo” or “real”
Trade Results
Trade results contain:
- Trade ID
- Execution status
- Entry price
- Expiry time
- Potential profit
Next Steps
- Explore more advanced trading features
- Learn about error handling
- Check out complete code examples
- Read the API reference
Common Issues
Authentication Fails
- Verify your credentials
- Check network connection
- Ensure account is active
Trade Execution Fails
- Verify sufficient balance
- Check asset availability
- Validate trade parameters
WebSocket Connection Issues
- Check internet connection
- Verify WebSocket endpoint
- Ensure proper authentication
Getting Help
- Check the FAQ
- Join our Discord community
- Open an issue on GitHub
Remember to always use the demo account first when testing new trading strategies!