I used this code: import time
from binance.client import Client
from binance.enums import *
from binance.exceptions import BinanceAPIException
import pandas as pd
import requests
import json
import numpy as np
import pytz
import datetime as dt
import ccxt
binance_futures = ccxt.binance({ 'option': { 'defaultMarket': 'futures' } })


date = dt.datetime.now().strftime("%m/%d/%Y %H:%M:%S")
print(date)

url = "https://api.binance.com/api/v1/time"
t = time.time()*1000
r = requests.get(url)
result = json.loads(r.content)

# API keys and other configuration
API_KEY = ''
API_SECRET = ''

client = Client(API_KEY, API_SECRET)

STOP_LOSS_PERCENTAGE = -50
TAKE_PROFIT_PERCENTAGE = 100
MAX_TRADE_QUANTITY_PERCENTAGE = 100
POSITION_SIDE_SHORT = 'SELL'
POSITION_SIDE_LONG = 'BUY'
symbol = 'BTCUSDT'
quantity = 1
order_type = 'MARKET'
leverage = 100
max_trade_quantity_percentage = 1

client = Client(API_KEY, API_SECRET)

def get_klines(symbol, interval, lookback):
    url = "https://fapi.binance.com/fapi/v1/klines"
    start_time = (dt.datetime.now() - dt.timedelta(minutes=lookback))
    end_time = dt.datetime.now()
    query_params = f"?symbol={symbol}&interval={interval}&startTime={start_time}&endTime={end_time}"
    headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36'
    }
    try:
        response = requests.get(url + query_params, headers=headers)
        response.raise_for_status()
        data = response.json()
        if not data: # if data is empty, return None
            print('No data found for the given timeframe and symbol')
            return None
        ohlc = []
        for d in data:
            timestamp = dt.datetime.fromtimestamp(d[0]/1000).strftime('%Y-%m-%d %H:%M:%S')
            ohlc.append({
            'Open time': timestamp,
            'Open': float(d[1]),
            'High': float(d[2]),
            'Low': float(d[3]),
            'Close': float(d[4]),
            'Volume': float(d[5])
            })
        df = pd.DataFrame(ohlc)
        df.set_index('Open time', inplace=True)
        return df
    except requests.exceptions.RequestException as e:
        print(f'Error in get_klines: {e}')
        return None
df = get_klines('BTCUSDT', '15m', 44640)

def signal_generator(df):
    open = df.Open.iloc[-1]
    close = df.Close.iloc[-1]
    previous_open = df.Open.iloc[-2]
    previous_close = df.Close.iloc[-2]

    # Bearish pattern
    if (open>close and
    previous_open<previous_close and
    close<previous_open and
    open>=previous_close):
        return 'sell'

    # Bullish pattern
    elif (open<close and
    previous_open>previous_close and
    close>previous_open and
    open<=previous_close):
        return 'buy'

    # No clear pattern
    else:
        return ""

df = get_klines('BTCUSDT', '15m', 44640)
def order_execution(symbol, signal, max_trade_quantity_percentage, leverage):
    max_trade_quantity = None
    account_balance = client.futures_account_balance()
    usdt_balance = 0
    for b in account_balance['assets']:
        if b['asset'] == 'USDT':
            usdt_balance = float(b['balance'])
    max_trade_quantity = usdt_balance * max_trade_quantity_percentage/100

    # Close long position if signal is opposite
    long_position = None
    short_position = None
    positions = client.futures_position_information(symbol=symbol)
    for p in positions:
        if p['positionSide'] == 'LONG':
            long_position = p
        elif p['positionSide'] == 'SHORT':
            short_position = p
        if long_position is not None and short_position is not None:
            print("Multiple positions found. Closing both positions.")
        if long_position is not None:
            client.futures_create_order(
                symbol=symbol,
                side=SIDE_SELL,
                type=ORDER_TYPE_MARKET,
                quantity=long_position['positionAmt'],
                reduceOnly=True
            )
    time.sleep(1)
    if short_position is not None:
        client.futures_create_order(
            symbol=symbol,
            side=SIDE_BUY,
            type=ORDER_TYPE_MARKET,
            quantity=short_position['positionAmt'],
            reduceOnly=True
        )
    time.sleep(1)
    print("Both positions closed.")

    if signal == 'buy':
        position_side = POSITION_SIDE_LONG
        opposite_position = short_position
    elif signal == 'sell':
        position_side = POSITION_SIDE_SHORT
        opposite_position = long_position
    else:
        print("Invalid signal. No order placed.")
        return
    order_quantity = 0
    if opposite_position is not None:
        order_quantity = min(max_trade_quantity, abs(float(opposite_position['positionAmt'])))
    if opposite_position is not None and opposite_position['positionSide'] != position_side:
        print("Opposite position found. Closing position before placing order.")
        client.futures_create_order(
            symbol=symbol,
            side=SIDE_SELL if
            opposite_position['positionSide'] == POSITION_SIDE_LONG
            else
            SIDE_BUY,
            type=ORDER_TYPE_MARKET,
            quantity=order_quantity,
            reduceOnly=True,
            positionSide=opposite_position['positionSide']
        )
    time.sleep(1)

    order = client.futures_create_order(
    symbol=symbol,
    side=SIDE_BUY if signal == 'buy' else SIDE_SELL,
    type=ORDER_TYPE_MARKET,
    quantity=order_quantity,
    reduceOnly=False,
    timeInForce=TIME_IN_FORCE_GTC,
    positionSide=position_side, # add position side parameter
    leverage=leverage
    )
    if order is None:
        print("Order not placed successfully. Skipping setting stop loss and take profit orders.")
        return
    order_id = order['orderId']
    print(f"Placed {signal} order with order ID {order_id} and quantity {order_quantity}")
    time.sleep(1)

    # Set stop loss and take profit orders
    # Get the order details to determine the order price
    order_info = client.futures_get_order(symbol=symbol, orderId=order_id)
    if order_info is None:
        print("Error getting order information. Skipping setting stop loss and take profit orders.")
        return
    order_price = float(order_info['avgPrice'])

    # Set stop loss and take profit orders
    stop_loss_price = order_price * (1 + STOP_LOSS_PERCENTAGE / 100) if signal == 'sell' else order_price * (1 - STOP_LOSS_PERCENTAGE / 100)
    take_profit_price = order_price * (1 + TAKE_PROFIT_PERCENTAGE / 100) if signal == 'buy' else order_price * (1 - TAKE_PROFIT_PERCENTAGE / 100)
    stop_loss_order = client.futures_create_order(
        symbol=symbol,
        side=SIDE_SELL if signal == 'buy' else SIDE_BUY,
        type=ORDER_TYPE_STOP_LOSS,
        quantity=order_quantity,
        stopPrice=stop_loss_price,
        reduceOnly=True,
        timeInForce=TIME_IN_FORCE_GTC,
        positionSide=position_side # add position side parameter
    )
    take_profit_order = client.futures_create_order(
        symbol=symbol,
        side=SIDE_SELL if signal == 'buy' else SIDE_BUY,
        type=ORDER_TYPE_LIMIT,
        quantity=order_quantity,
        price=take_profit_price,
        reduceOnly=True,
        timeInForce=TIME_IN_FORCE_GTC,
        positionSide=position_side # add position side parameter
    )
    # Print order creation confirmation messages
    print(f"Placed stop loss order with stop loss price {stop_loss_price}")
    print(f"Placed take profit order with take profit price {take_profit_price}")
    time.sleep(1)
while True:
    df = get_klines('BTCUSDT', '15m', 44640)
    if df is not None:
        signal = signal_generator(df)
        if signal:
            print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} :{signal}")
            order_execution('BTCUSDT', signal, MAX_TRADE_QUANTITY_PERCENTAGE, leverage)
            time.sleep(1)
But I getting ERROR in futures order execution : The signal time is: 2023-06-01 20:40:25 :sell
Traceback (most recent call last):
  File "c:\Users\Alan\.vscode\jew_bot\jew_bot\jew_bot.py", line 226, in <module>       
    order_execution('BTCUSDT', signal, MAX_TRADE_QUANTITY_PERCENTAGE, leverage)        
  File "c:\Users\Alan\.vscode\jew_bot\jew_bot\jew_bot.py", line 103, in order_execution
    account_balance = client.futures_account_balance()
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Client' object has no attribute 'futures_account_balance'