◈   ⌘ api · Intermediate

Binance Algo Orders API: Complete Trader's Guide

Master Binance algo order API endpoints to automate TWAP, VP, and VWAP strategies. Real code examples, auth setup, and error handling included.

Uncle Solieditor · voc · 06.05.2026 ·views 28
◈   Contents
  1. → What Are Algo Orders on Binance?
  2. → Authentication and API Key Setup
  3. → Core Binance Algo Order API Endpoints
  4. → Placing a TWAP Order: Full Working Example
  5. → Monitoring and Cancelling Algo Orders
  6. → Frequently Asked Questions
  7. → Putting It All Together

Executing large crypto orders manually is a fast way to move the market against yourself. Drop a 50 BTC market buy on Binance without any execution logic and you'll eat slippage that wipes out any edge you had. Algorithmic order types solve this — and Binance exposes them directly through their API. Whether you're running a prop desk, a hedge fund script, or a personal bot, the Binance algo order API gives you TWAP, VP (Volume Participation), and VWAP execution natively, without needing a third-party OMS.

What Are Algo Orders on Binance?

Algo orders are execution algorithms that break a large parent order into smaller child orders over time or volume, reducing market impact. Binance currently supports three algo types via their API: TWAP (Time-Weighted Average Price), VP (Volume Participation), and VWAP (Volume-Weighted Average Price). These are available on Binance Spot, USD-M Futures, and COIN-M Futures markets.

Compared to platforms like Bybit and OKX, which also offer algo execution but through different API schemas, Binance's implementation is more granular — you get direct control over duration, urgency ratio, and limit price offsets. OKX calls their equivalent 'iceberg' and 'time-division' orders, while Bybit bundles similar logic under their TWAP order type. Binance's binance algo order api is arguably the most flexible of the three for futures trading.

Authentication and API Key Setup

Algo order endpoints require a signed request with your API key and secret. This means every request needs an HMAC SHA256 signature. Here's the minimal Python setup you need before touching any algo endpoint:

import hmac
import hashlib
import time
import requests
from urllib.parse import urlencode

API_KEY = 'your_api_key_here'
API_SECRET = 'your_api_secret_here'
BASE_URL = 'https://api.binance.com'

def sign_params(params: dict) -> str:
    query_string = urlencode(params)
    signature = hmac.new(
        API_SECRET.encode('utf-8'),
        query_string.encode('utf-8'),
        hashlib.sha256
    ).hexdigest()
    return signature

def get_headers() -> dict:
    return {
        'X-MBX-APIKEY': API_KEY,
        'Content-Type': 'application/x-www-form-urlencoded'
    }

def get_timestamp() -> int:
    return int(time.time() * 1000)
Always use IP whitelisting on your Binance API keys for algo trading. If your key leaks, an attacker can't use it from an unauthorized IP. Also set 'Spot & Margin Trading' or 'Futures' permissions only — never enable withdrawals on a trading key.

Core Binance Algo Order API Endpoints

The binance algo order api endpoints are split by market type. Spot algo orders live under /sapi/v1/algo/spot/, while USD-M futures algo orders use /sapi/v1/algo/futures/. Here's a breakdown of the key endpoints you'll use daily:

Binance Algo Order API Endpoints
EndpointMethodDescription
/sapi/v1/algo/spot/newOrderTwapPOSTPlace spot TWAP order
/sapi/v1/algo/futures/newOrderTwapPOSTPlace futures TWAP order
/sapi/v1/algo/futures/newOrderVpPOSTPlace futures VP order
/sapi/v1/algo/spot/openOrdersGETList open algo orders (spot)
/sapi/v1/algo/futures/openOrdersGETList open algo orders (futures)
/sapi/v1/algo/spot/orderDELETECancel spot algo order
/sapi/v1/algo/futures/orderDELETECancel futures algo order
/sapi/v1/algo/spot/historicalOrdersGETHistorical algo orders (spot)
/sapi/v1/algo/futures/subOrdersGETList child orders for a parent

Note that all algo endpoints require 'Enable Spot & Margin Trading' or 'Enable Futures' permissions respectively, and every request must be signed. The recvWindow parameter (default 5000ms) controls how long your timestamp stays valid — for algo orders, 5000ms is usually fine since you're not doing microsecond HFT here.

Placing a TWAP Order: Full Working Example

Let's walk through placing a futures TWAP order. The required parameters are symbol, side, quantity, duration (in seconds), and clientAlgoId (your own reference ID). Optional params include limitPrice to cap your execution price and positionSide for hedge mode.

import uuid

def place_futures_twap(
    symbol: str,
    side: str,        # 'BUY' or 'SELL'
    quantity: float,
    duration: int,    # seconds, min 300 (5 min), max 86400 (24h)
    limit_price: float = None
) -> dict:
    """
    Place a TWAP order on Binance USD-M Futures.
    duration: how long to spread the order (300-86400 seconds)
    """
    endpoint = '/sapi/v1/algo/futures/newOrderTwap'
    
    params = {
        'symbol': symbol,
        'side': side,
        'quantity': str(quantity),
        'duration': duration,
        'clientAlgoId': str(uuid.uuid4()).replace('-', '')[:32],
        'timestamp': get_timestamp(),
        'recvWindow': 5000
    }
    
    if limit_price:
        params['limitPrice'] = str(limit_price)
    
    params['signature'] = sign_params(params)
    
    response = requests.post(
        BASE_URL + endpoint,
        headers=get_headers(),
        data=params  # POST body, not query string
    )
    
    data = response.json()
    
    if response.status_code != 200:
        raise Exception(f"Binance API error {data.get('code')}: {data.get('msg')}")
    
    return data

# Example: buy 1.5 ETH over 30 minutes
result = place_futures_twap(
    symbol='ETHUSDT',
    side='BUY',
    quantity=1.5,
    duration=1800  # 30 minutes
)

print(f"Algo order placed. algoId: {result['algoId']}")
print(f"Client ID: {result['clientAlgoId']}")

The response gives you an algoId — store this. You'll need it to query child orders, check status, or cancel. Binance will start firing child orders immediately, and you can monitor them via the /sapi/v1/algo/futures/subOrders endpoint using that algoId.

Monitoring and Cancelling Algo Orders

Once your algo order is live, you need to track its execution. The subOrders endpoint gives you every child order that has been sent, including their fill status. Here's a complete monitoring and cancel workflow:

def get_algo_sub_orders(algo_id: int, page: int = 1, page_size: int = 20) -> dict:
    """Fetch child orders for a parent algo order."""
    endpoint = '/sapi/v1/algo/futures/subOrders'
    
    params = {
        'algoId': algo_id,
        'page': page,
        'pageSize': page_size,
        'timestamp': get_timestamp()
    }
    params['signature'] = sign_params(params)
    
    response = requests.get(
        BASE_URL + endpoint,
        headers=get_headers(),
        params=params
    )
    return response.json()


def cancel_algo_order(algo_id: int) -> dict:
    """Cancel an active algo order by its algoId."""
    endpoint = '/sapi/v1/algo/futures/order'
    
    params = {
        'algoId': algo_id,
        'timestamp': get_timestamp()
    }
    params['signature'] = sign_params(params)
    
    response = requests.delete(
        BASE_URL + endpoint,
        headers=get_headers(),
        params=params
    )
    
    data = response.json()
    if data.get('success'):
        print(f"Algo {algo_id} cancelled. {data.get('msg')}")
    return data


def monitor_algo_execution(algo_id: int):
    """Print a summary of algo order execution progress."""
    sub_orders = get_algo_sub_orders(algo_id)
    total = sub_orders.get('total', 0)
    orders = sub_orders.get('subOrders', [])
    
    filled = sum(1 for o in orders if o['status'] == 'FILLED')
    total_qty_filled = sum(float(o['executedQty']) for o in orders)
    
    print(f"Child orders: {filled}/{total} filled")
    print(f"Total qty executed: {total_qty_filled}")
    
    for order in orders[-3:]:  # show last 3
        print(f"  orderId={order['orderId']} "
              f"status={order['status']} "
              f"price={order['price']} "
              f"qty={order['executedQty']}")

# Usage
monitor_algo_execution(algo_id=12345678)
If your algo order gets stuck (e.g., limitPrice is too far from market), Binance will pause child order submission but keep the parent active. Always monitor fill rate in the first 5 minutes. If less than 10% is filled after 10% of your duration has elapsed, your limitPrice is probably too restrictive.

Platforms like Bybit handle stuck algo orders differently — they'll auto-cancel after a timeout. Binance keeps them open until duration expires or you explicitly cancel. Build a monitoring loop into your bot that checks fill rate and auto-cancels if execution pace is far below expected. VoiceOfChain's signal layer can feed entry/exit triggers into this loop — when a signal fires, your TWAP bot activates; when the signal expires, the monitor cancels any remaining algo order.

Frequently Asked Questions

What is the minimum order duration for Binance TWAP?
The minimum duration for a Binance futures TWAP order is 300 seconds (5 minutes), and the maximum is 86400 seconds (24 hours). For spot TWAP, the same limits apply. Choosing too short a window on a large order can still cause significant slippage.
Do Binance algo orders work for spot trading or only futures?
Both. Binance provides separate algo API endpoints for spot (/sapi/v1/algo/spot/) and USD-M futures (/sapi/v1/algo/futures/). Spot algo orders support TWAP, while futures supports TWAP and VP. COIN-M futures also has its own set of algo endpoints.
Can I use the Binance algo order API with a sub-account?
Yes, but you need to generate API keys specifically for the sub-account — master account keys won't sign requests for sub-accounts. Sub-account algo orders are tracked separately and won't appear in master account open orders queries.
What happens if my internet drops while a Binance algo order is running?
Algo orders are fully server-side once submitted. Binance's servers continue executing child orders regardless of your connection status. This is one of the key advantages over self-managed iceberg strategies — your bot going offline doesn't halt execution.
How does Binance algo TWAP compare to OKX or Bybit algo orders?
Binance offers more parameter granularity, including limitPrice offsets and VP urgency ratios. OKX's time-division orders are simpler but have more flexible market types. Bybit's TWAP is the least configurable of the three but has a cleaner API response format. For futures, Binance is generally the most feature-rich.
Is there a rate limit on Binance algo order API endpoints?
Yes. Creating algo orders costs 3000 request weight per order. Querying open orders or sub-orders costs 1 weight. Binance enforces a 1200 weight per minute limit on most endpoints. Avoid polling sub-orders too frequently — once every 5-10 seconds is sufficient for monitoring.

Putting It All Together

The Binance algo order API removes the hardest part of large-order execution from your plate. Instead of hand-rolling TWAP slicing logic, managing child order queues, and watching for partial fills, you submit one parent order and let Binance handle the mechanics. Your job becomes higher-level: decide when to enter, what size, and over what window.

Pair these binance algo order api endpoints with a signal source and you have a complete execution pipeline. VoiceOfChain provides real-time on-chain and technical signals that can trigger your TWAP bot — when a whale accumulation signal fires on ETH, your bot places a 30-minute TWAP buy; when momentum reverses, it cancels any remaining algo order and sits flat. Exchanges like Binance, Bybit, and OKX all offer programmatic algo execution, but the key is tying that execution to a reliable signal layer rather than running blindly on schedule.

Start with small quantities to verify your signing logic, confirm child orders are appearing correctly in the subOrders endpoint, then scale up. Algorithmic execution isn't about being smarter than the market — it's about not being your own worst enemy when size starts to matter.

◈   more on this topic
◉ basics Mastering the ccxt library documentation for crypto traders ⌂ exchanges Mastering the Binance CCXT Library for Crypto Traders ⌬ bots Best Crypto Trading Bots 2025: Profitable AI-Powered Strategies