Which API to use?
For binary options, the Deriv API is the best option. It lets you open trades, query prices in real time and manage your account programmatically. For crypto, the Binance API is the standard.
Basic moving-average crossover strategy
A simple example: a bot that returns CALL when the 9 EMA is above the 21 EMA, and PUT otherwise.
import pandas as pd
# Strategy: moving-average crossover
def signal(data):
data['ema9'] = data['close'].ewm(span=9).mean()
data['ema21'] = data['close'].ewm(span=21).mean()
if data['ema9'].iloc[-1] > data['ema21'].iloc[-1]:
return 'CALL'
return 'PUT'
Next steps
This is just the signal logic. To turn it into a full bot you need to connect it to the broker API, add risk management (stop loss, trade limits) and test it thoroughly on demo. See our Deriv API with Python tutorial for the connection part.
💡 Tip
Always backtest your strategy on historical data before connecting it to a real account. A backtest that performs well is no guarantee of future results, but a strategy that fails on history will almost certainly fail live.
⚠️ Risk warning
Trading binary options carries significant risk. The majority of traders lose money. This site contains affiliate links.