I used your code: def signal_generator(df):
    if df is None or len(df) < 2:
        return ''

    # Retrieve depth data
    depth_data = client.depth(symbol=symbol)
    bid_depth = depth_data['bids']
    ask_depth = depth_data['asks']

    depth_analysis = []
    
    depth_threshold = 100

    for i in range(1, len(bid_depth)):
        if (
            float(bid_depth[i][0]) >= depth_threshold and
            float(bid_depth[i - 1][0]) < depth_threshold
            ):
                depth_analysis.append('buy')
        elif (
            float(ask_depth[i][0]) >= depth_threshold and
            float(ask_depth[i - 1][0]) < depth_threshold
            ):
                depth_analysis.append('sell')

    # After adding your algorithm logic, check if there is a buy or sell signal
    if 'buy' in depth_analysis:
        return 'buy'
    elif 'sell' in depth_analysis:
        return 'sell'
    else:
        return ''

end_time = int(time.time() * 1000)
start_time = end_time - lookback * 60 * 1000
    
TradeType = "BUY" or "SELL"

secret_key = API_KEY_BINANCE  # Replace with your actual secret key obtained from MXC Exchange
access_key = API_SECRET_BINANCE # Replace with your actual access key obtained from MXC Exchange

import binance

while True:
    lookback = 10080
    df = get_klines(symbol, interval, lookback)

    if df is not None:
        signals = signal_generator(df)
        print(f"The signal time is: {dt.datetime.now().strftime('%Y-%m-%d %H:%M:%S')} - Signals: {signals}")

        mark_price = client.ticker_price(symbol=symbol)
        
        if signals == 'buy':
            try:
                quantity = 0.1
                client.new_order(symbol=symbol, side='BUY', type='MARKET', quantity=quantity)
                print("Long order executed!")

                stop_loss_price = float(mark_price) - (float(mark_price) * 0.002)
                print(f"Stop loss set at: {stop_loss_price}")

                try:
                    client.new_order(
                        symbol=symbol,
                        side='SELL',
                        type='STOP_MARKET',
                        quantity=0.1,
                        stopPrice=stop_loss_price
                    )
                    print("Stop loss order placed!")
                except binance.error.ClientError as e:
                    print(f"Error placing stop loss order: {e}")

                time.sleep(1)

            except binance.error.ClientError as e:
                print(f"Error executing long order: {e}")
            
            time.sleep(1)

        if signals == 'sell':
            try:
                quantity = 0.1
                client.new_order(symbol=symbol, side='SELL', type='MARKET', quantity=quantity)
                print("Short order executed!")

                stop_loss_price = float(mark_price) + (float(mark_price) * 0.002)
                print(f"Stop loss set at: {stop_loss_price}")

                try:
                    client.new_order(
                        symbol=symbol,
                        side='BUY',
                        type='STOP_MARKET',
                        quantity=0.1,
                        stopPrice=stop_loss_price
                    )
                    print("Stop loss order placed!")
                except binance.error.ClientError as e:
                    print(f"Error placing stop loss order: {e}")

                time.sleep(1)

            except binance.error.ClientError as e:
                print(f"Error executing short order: {e}")
            
            time.sleep(1)
    
    time.sleep(1)

Can you set in signal_generator if buy orders qty > sell order qty return 'bullish'
If bullish price > mark price return buy 

elif :
 if sell orders qty > buy order qty return 'bearish'
If bearish price > mark price return sell