Absolutely! Here’s a complete English step-by-step guide for running the ETHUSDT Grid Bot on Binance Futures (Windows).
You can share this with anyone to help them set up and run the bot from scratch.
✅ ETHUSDT Grid Bot – Full English Guide (Windows)
1. Create a Binance Account and Enable Futures
· Sign up at Binance.
· Enable Futures Trading in your account dashboard.
2. Generate Your API Key
· Go to your profile > API Management.
· Create a new API key (label it, e.g., "GridBot").
· Enable:
o Enable Reading
o Enable Spot & Margin Trading (optional)
o Enable Futures (required)
· Do NOT enable withdrawals for security.
· Copy and save your API Key and API Secret somewhere safe.
3. Install Python and Required Libraries
· Download and install Python (version 3.9+ recommended).
· During installation, check the box for "Add Python to PATH".
· Open PowerShell or Command Prompt and check installation:
python --version
pip --version
You should see version numbers.
· Install the required libraries:
pip install python-binance numpy
4. Prepare the Bot Code
· Open Notepad or any text editor.
· Copy the full bot code (see next section).
· Save the file as:
ethusdt_gridbot.py
(Make sure the extension is .py, not .txt)
5. Edit Your Bot Settings
· At the top of the code, enter your API_KEY and API_SECRET between single quotes '...'.
· Adjust the other settings as you wish (price range, grid levels, target profit, capital per order).
6. Run the Bot
· Open PowerShell or CMD.
· Navigate to the folder where you saved the bot:
cd C:\Users\YourUsername\Desktop
· Start the bot:
python ethusdt_gridbot.py
7. Monitor the Bot
· The bot will print a summary of your settings.
· It will automatically place grid buy/sell orders.
· It will monitor profit and reset the grid when the target is reached or price hits your range limits.
· You can monitor open orders and positions on Binance or in the console.
8. Safety and Best Practices
· Test first with a small amount or on Binance Testnet.
· Never share your API keys with anyone.
· Don’t leave the bot running unattended for long periods, especially during high volatility.
· You can easily improve the code or add notifications later.
📄 Sample Bot Code (Ready to Use)
import time
import numpy as np
from binance.client import Client
from binance.enums import *
from binance.exceptions import BinanceAPIException
# ====== YOUR SETTINGS ======
API_KEY = 'YOUR_API_KEY'
API_SECRET = 'YOUR_API_SECRET'
SYMBOL = 'ETHUSDT'
LEVERAGE = 15
BOTTOM = 2000 # Minimum price to run the bot
TOP = 2900 # Maximum price to run the bot
GRID_LEVELS = 100 # Number of grid levels (50 below and 50 above current price)
TP_PROFIT = 0.25 # Target profit per cycle in USD
USDT_PER_ORDER = 10 # Estimated capital per order
# ==========================
client = Client(API_KEY, API_SECRET)
def get_current_price():
return float(client.futures_symbol_ticker(symbol=SYMBOL)['price'])
def get_balance():
for asset in client.futures_account()['assets']:
if asset['asset'] == 'USDT':
return float(asset['walletBalance'])
return 0.0
def get_realized_profit():
income = client.futures_income_history(symbol=SYMBOL, limit=100)
return round(sum(float(i['income']) for i in income if i['incomeType'] == 'REALIZED_PNL'), 4)
def cancel_all_orders():
client.futures_cancel_all_open_orders(symbol=SYMBOL)
def close_all_positions():
positions = client.futures_position_information(symbol=SYMBOL)
for pos in positions:
amt = float(pos['positionAmt'])
if amt != 0:
side = SIDE_SELL if amt > 0 else SIDE_BUY
try:
client.futures_create_order(
symbol=SYMBOL,
side=side,
type=ORDER_TYPE_MARKET,
quantity=abs(amt),
reduceOnly=True
)
except Exception as e:
print(f"[!] Error closing position: {e}")
def get_order_size(price):
qty = round(USDT_PER_ORDER / price, 4)
return max(qty, 0.001)
def place_grid_orders():
price = get_current_price()
grid_prices = np.linspace(BOTTOM, TOP, GRID_LEVELS)
buy_prices = [p for p in grid_prices if p < price]
sell_prices = [p for p in grid_prices if p > price]
for p in buy_prices:
qty = get_order_size(p)
try:
client.futures_create_order(
symbol=SYMBOL,
side=SIDE_BUY,
type=ORDER_TYPE_LIMIT,
price=str(round(p,2)),
quantity=qty,
timeInForce=TIME_IN_FORCE_GTC
)
except BinanceAPIException as e:
print(f"[!] Buy order error at {p}: {e}")
for p in sell_prices:
qty = get_order_size(p)
try:
client.futures_create_order(
symbol=SYMBOL,
side=SIDE_SELL,
type=ORDER_TYPE_LIMIT,
price=str(round(p,2)),
quantity=qty,
timeInForce=TIME_IN_FORCE_GTC
)
except BinanceAPIException as e:
print(f"[!] Sell order error at {p}: {e}")
print(f"[✓] Grid placed around price {price}")
def set_leverage():
try:
client.futures_change_leverage(symbol=SYMBOL, leverage=LEVERAGE)
except Exception as e:
print(f"[!] Leverage set error: {e}")
def print_start_message():
est_capital = USDT_PER_ORDER * GRID_LEVELS
print("="*60)
print(f"ETHUSDT Grid Bot - Binance Futures")
print(f"Range: {BOTTOM} to {TOP}")
print(f"Grid levels: {GRID_LEVELS}")
print(f"Estimated capital used: {est_capital} USDT")
print(f"Target profit per cycle: {TP_PROFIT} USDT")
print(f"Bot will only close grid if profit is reached or price hits BOTTOM/TOP")
print("="*60)
def main():
set_leverage()
print_start_message()
while True:
try:
cancel_all_orders()
close_all_positions()
place_grid_orders()
initial_profit = get_realized_profit()
print(f"Initial realized profit: {initial_profit} USDT")
while True:
price = get_current_price()
current_profit = get_realized_profit()
net_profit = current_profit - initial_profit
print(f"Current price: {price:.2f} | Net profit: {net_profit:.4f} USDT", end='\r')
if net_profit >= TP_PROFIT:
print(f"\n[💰] Profit target reached: {net_profit:.4f} USDT, resetting grid...")
cancel_all_orders()
close_all_positions()
break
if price <= BOTTOM or price >= TOP:
print(f"\n[!] Price hit range limit ({price:.2f}). Closing grid and waiting...")
cancel_all_orders()
close_all_positions()
time.sleep(60) # Wait a minute before retry
break
time.sleep(10)
except Exception as e:
print(f"[!] General error: {e}")
time.sleep(15)
if __name__ == "__main__":
main()
Summary
· Create Binance account & enable Futures
· Generate API key (with Futures enabled)
· Install Python + libraries
· Save and edit the bot code
· Run the bot and monitor