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
Guide for migrating from older versions of BinomoAPI to the latest version.
Before (2.x):
# Synchronous API
api = BinomoAPI(auth_token, device_id)
balance = api.get_balance()
result = api.Call("EUR/USD", 60, 5.0)
After (3.x):
# Async API
async with BinomoAPI(auth_token, device_id) as api:
balance = await api.get_balance()
result = await api.place_call_option(
asset="EUR/USD",
duration_seconds=60,
amount=5.0
)
Before (2.x):
api.Call("EUR", 60, 5.0, True)
api.Put("GBP", 120, 10.0, False)
api.Getbalance()
After (3.x):
await api.place_call_option(
asset="EUR/USD",
duration_seconds=60,
amount=5.0,
use_demo=True
)
await api.place_put_option(
asset="GBP/USD",
duration_seconds=120,
amount=10.0,
use_demo=False
)
await api.get_balance()
Before (2.x):
try:
result = api.Call("EUR", 60, 5.0)
if not result:
print("Trade failed")
except Exception as e:
print(f"Error: {e}")
After (3.x):
from BinomoAPI.exceptions import TradeError, InsufficientBalanceError
try:
result = await api.place_call_option(
asset="EUR/USD",
duration_seconds=60,
amount=5.0
)
except InsufficientBalanceError:
logging.error("Not enough funds")
except TradeError as e:
logging.error(f"Trade failed: {e}")
Before (2.x):
api = BinomoAPI(
auth_token,
device_id,
demo=True,
timeout=30
)
After (3.x):
from BinomoAPI.config_manager import get_config
config = get_config()
config.set("api", "timeout_seconds", 30)
config.save()
async with BinomoAPI(
auth_token=auth_token,
device_id=device_id,
demo=True
) as api:
# API uses configuration
pip install --upgrade BinomoAPI
from BinomoAPI import BinomoAPI
from BinomoAPI import BinomoAPI from BinomoAPI.exceptions import ( AuthenticationError, TradeError )
3. Update code structure:
```python
import asyncio
from BinomoAPI import BinomoAPI
async def main():
async with BinomoAPI(...) as api:
# Your trading code here
pass
if __name__ == "__main__":
asyncio.run(main())
Before (1.x):
api = BinomoAPI()
api.login("email", "password")
After (2.x):
api = BinomoAPI.login("email", "password")
Before (1.x):
api.trade("EUR", "CALL", 60, 5.0)
After (2.x):
api.Call("EUR", 60, 5.0)
pip install BinomoAPI==2.0.0
api = BinomoAPI() api.login(โemailโ, โpasswordโ)
api = BinomoAPI.login(โemailโ, โpasswordโ)
## ๐ Tips for Smooth Migration
### 1. Gradual Migration
Migrate one component at a time:
1. Update authentication
2. Convert to async/await
3. Implement new error handling
4. Update configuration
### 2. Testing Strategy
1. Create test environment
2. Run old and new versions in parallel
3. Compare results
4. Verify functionality
### 3. Common Issues
#### Async/Await Conversion
Problem:
```python
# This will not work
result = api.place_call_option(...)
Solution:
# Use async/await
result = await api.place_call_option(...)
Problem:
# Old method names will raise AttributeError
api.Call(...)
Solution:
# Use new method names
await api.place_call_option(...)
Problem:
# Direct configuration no longer works
api = BinomoAPI(..., timeout=30)
Solution:
# Use configuration manager
config = get_config()
config.set("api", "timeout_seconds", 30)
config.save()
For smoother transition, version 3.0 includes compatibility mode:
from BinomoAPI import BinomoAPI
from BinomoAPI.compat import enable_legacy_mode
# Enable compatibility mode
enable_legacy_mode()
# Old methods will work with warnings
api.Call("EUR", 60, 5.0) # Works but warns
If you encounter issues during migration:
Remember to always test thoroughly after migration!