Crypto

Binance Setup Guide

Time: 10 minutes | Difficulty: Easy | Market: Crypto Mode: Full automation | API: REST + WebSocket API | Docs: binance-docs.github.io/apidocs

This guide wires a Binance trading bot to the REST and WebSocket API using the botwir3 runtime. Configure API credentials, connect to any supported trading pair, and run automated crypto trading locally.


Before you start

Verify that automated operation is permitted under Binance's current terms of service before deploying. botwir3 provides tools for building structured automation. The user is responsible for compliance with the platform's terms and all applicable regulations.

Jurisdiction. Binance is not available in the United States. US-based users can access Binance.US, which has a separate and more limited API. This guide covers Binance (global). Verify availability in the applicable jurisdiction before proceeding.

Binance Terms of Use | Last verified: May 2026

What you need

  • A Binance account with identity verification (KYC) complete
  • The botwir3 runtime downloaded and unzipped
  • A strategy config file from the builder

Step 1: Create API credentials

  1. Log in to binance.com
  2. Navigate to Account → API Management
  3. Click Create API and select System generated
  4. Complete the security verification
  5. Copy the API Key and Secret Key
  6. Under Restrictions, enable Enable Spot & Margin Trading
  7. Under IP access restrictions, select Restrict access to trusted IPs only and add the IP address of the machine running the bot

Permissions required: Enable Spot & Margin Trading (or Enable Futures, depending on the strategy). Permissions to disable: Enable Withdrawals, Enable Internal Transfer. These scopes are not required for trading and can be left disabled.

🔒 Security. IP whitelisting is required for Binance API keys with trading permissions. Add only the IP address of the machine running the bot. Binance locks new API keys for 48 hours on new accounts.

Step 2: Configure the adapter

Create adapter.json in the bot directory:

{
  "adapter": "binance",
  "credentials": {
    "api_key": "paste-api-key-here",
    "api_secret": "paste-api-secret-here"
  },
  "trading_pair": "BTCUSDT",
  "environment": "live",
  "rate_limit_ms": 100
}

Common trading pairs: BTCUSDT, ETHUSDT, SOLUSDT, BNBUSDT.

API keys are stored in a local config file on the machine running the bot. They are not transmitted to botwir3 or any third party. botwir3 never sees, stores, or has access to platform credentials.

Step 3: Test the connection

botwir3 test --adapter binance

Expected output:

[botwir3] Adapter: binance
[botwir3] Connection: OK
[botwir3] Permissions: SPOT_TRADING
[botwir3] Rate limit: weight-based (1200 weight/minute)

Step 4: Start the bot

botwir3 start --config my-strategy.json

The runtime loads the strategy, computes the spec hash, connects to Binance via the local API credentials, and begins evaluating signals. The gate function compares proposed actions against the configured spec. The user is responsible for monitoring the bot and verifying execution outcomes.

Rate limits and considerations

EndpointLimitNotes
REST API1200 weight/minuteEach endpoint has a weight cost. Order placement is 1 weight.
WebSocket5 messages/secondPer connection. 1024 streams per connection.
Order placement (spot)10 orders/secondPer trading pair. 200,000 orders/day.
Order placement (futures)10 orders/secondPer symbol. Rate limits vary by tier.

Weight-based rate limits. Binance uses a weight system rather than simple request counts. A market data call may cost 5-40 weight depending on the endpoint. Order placement costs 1 weight. Monitor weight usage via the X-MBX-USED-WEIGHT response header.

Common Binance bot configurations include grid trading across a price range on BTCUSDT, DCA strategies on high-cap pairs, and momentum or mean reversion on altcoin/USDT pairs. The native bot suite (Grid, DCA) is a hosted alternative — botwir3 provides the local, air-gapped version with configurable discipline features. All actions and decisions are recorded in the local ledger.

Troubleshooting

ErrorCauseFix
CONNECTION_REFUSEDAPI key invalid, expired, or IP not whitelistedVerify API key and add the machine's IP to the whitelist in API Management
RATE_LIMITEDWeight limit exceededIncrease rate_limit_ms in adapter config. Check weight usage per endpoint.
PERMISSION_DENIEDTrading permission not enabled on API keyEnable "Enable Spot & Margin Trading" in API Management
INSUFFICIENT_FUNDSAccount balance cannot cover the proposed tradeReduce position sizing in strategy config
MANDATE_INTEGRITY_VIOLATIONConfig file modified while bot is runningStop the bot, verify config, restart

Related guides


One bot. $129. No subscription. No $749/mo platform. → Build for Binance


Build your Binance bot

botwir3 compiler

1 Platform

2 Objective