async def main():
    client = await AsyncClient.create(API_KEY, API_SECRET)
    try:
        # 设置杠杆
        for symbol in SYMBOLS:
            await client.futures_change_leverage(symbol=symbol, leverage=LEVERAGE)

        while True:
            tasks = [handle_symbol(client, symbol) for symbol in SYMBOLS]
            await asyncio.gather(*tasks)
            await asyncio.sleep(60)  # 每5分钟检查一次
    finally:
        await client.close_connection()


async def handle_symbol(client, symbol):
    try:
        # 获取30分钟K线数据
        klines_30m = await client.futures_klines(symbol=symbol, interval=TIMEFRAME_30M, limit=100)
        df_30m = pd.DataFrame(klines_30m, columns=['timestamp', 'open', 'high', 'low', 'close', 'volume',
                                                   'close_time', 'quote_asset_volume', 'number_of_trades',
                                                   'taker_buy_base_asset_volume', 'taker_buy_quote_asset_volume',
                                                   'ignore'])
        df_30m['close'] = df_30m['close'].astype(float)

        # 获取5分钟K线数据
        klines_5m = await client.futures_klines(symbol=symbol, interval=TIMEFRAME_5M, limit=100)
        df_5m = pd.DataFrame(klines_5m, columns=['timestamp', 'open', 'high', 'low', 'close', 'volume',
                                                 'close_time', 'quote_asset_volume', 'number_of_trades',
                                                 'taker_buy_base_asset_volume', 'taker_buy_quote_asset_volume',
                                                 'ignore'])
        df_5m['open'] = df_5m['open'].astype(float)
        df_5m['high'] = df_5m['high'].astype(float)
        df_5m['low'] = df_5m['low'].astype(float)
        df_5m['close'] = df_5m['close'].astype(float)

        # 计算30分钟MACD的DIF
        macd = ta.macd(df_30m['close'])
        dif = macd['MACD_12_26_9'].iloc[-1]

        # 打印30分钟的DIF是大于0还是小于0
        if dif > 0:
            print(f"{symbol} 30分钟DIF大于0: {dif}")
        else:
            print(f"{symbol} 30分钟DIF小于0: {dif}")

        # 计算5分钟SAR
        df_5m.ta.psar(append=True)
        df_5m['sar'] = df_5m['PSARl_0.02_0.2']
        current_sar = df_5m['sar'].iloc[-1]
        previous_sar = df_5m['sar'].iloc[-2]
        current_close = df_5m['close'].iloc[-1]
        previous_close = df_5m['close'].iloc[-2]

        # 打印5分钟SAR在K线上还是K线下
        if current_sar < current_close:
            print(f"{symbol} 5分钟SAR在K线下方: 当前SAR: {current_sar}, 当前收盘价: {current_close}")
        else:
            print(f"{symbol} 5分钟SAR在K线上方: 当前SAR: {current_sar}, 当前收盘价: {current_close}")

        # 获取仓位信息
        position_info = await client.futures_position_information(symbol=symbol)
        position_amt = float(position_info[0]['positionAmt'])

        # 判断做多条件
        if dif > 0 and previous_sar > previous_close and current_sar < current_close:
            print(f"{symbol} 满足做多条件：DIF: {dif}, 前一根SAR: {previous_sar}, 当前SAR: {current_sar}")

            if position_amt == 0:
                await open_position(client, symbol, "LONG")
        # 判断做空条件
        elif dif < 0 and previous_sar < previous_close and current_sar > current_close:
            print(f"{symbol} 满足做空条件：DIF: {dif}, 前一根SAR: {previous_sar}, 当前SAR: {current_sar}")

            if position_amt == 0:
                await open_position(client, symbol, "SHORT")
        # 已有仓位，检查止盈止损
        elif position_amt != 0:
            await manage_position(client, symbol, position_amt)
    except Exception as e:
        logging.error(f"处理交易对{symbol}时出错: {e}")


async def open_position(client, symbol, side):
    try:
        # 获取当前订单簿
        depth = await client.futures_order_book(symbol=symbol, limit=10)
        if side == "LONG":
            price = float(depth['asks'][3][0])  # 买入，取第4个最优价
        else:
            price = float(depth['bids'][3][0])  # 卖出，取第4个最优价

        # 计算下单数量
        symbol_info = await client.futures_exchange_info()
        info = next(filter(lambda x: x['symbol'] == symbol, symbol_info['symbols']))
        lot_size = next(filter(lambda f: f['filterType'] == 'LOT_SIZE', info['filters']))
        step_size = float(lot_size['stepSize'])
        quantity = TRADE_AMOUNT * LEVERAGE / price
        quantity = round_step_size(quantity, step_size)

        # 下限价单开仓
        if side == "LONG":
            order = await client.futures_create_order(
                symbol=symbol,
                side='BUY',
                type='LIMIT',
                price=price,
                quantity=quantity,
                timeInForce='GTC')
        else:
            order = await client.futures_create_order(
                symbol=symbol,
                side='SELL',
                type='LIMIT',
                price=price,
                quantity=quantity,
                timeInForce='GTC')
        logging.info(f"{symbol} 开仓 {side}，价格：{price}，数量：{quantity}")
        logging.info(f"{symbol} 开仓订单：{order}")

        # 记录入场价
        entry_price = price

        # 设置止盈
        if side == "LONG":
            take_profit_price = entry_price * (1 + TAKE_PROFIT_PERCENT)
            tp_order = await client.futures_create_order(
                symbol=symbol,
                side='SELL',
                type='LIMIT',
                price=take_profit_price,
                quantity=quantity,
                reduceOnly='true',
                timeInForce='GTC')
        else:
            take_profit_price = entry_price * (1 - TAKE_PROFIT_PERCENT)
            tp_order = await client.futures_create_order(
                symbol=symbol,
                side='BUY',
                type='LIMIT',
                price=take_profit_price,
                quantity=quantity,
                reduceOnly='true',
                timeInForce='GTC')
        logging.info(f"{symbol} 设置止盈单，价格：{take_profit_price}")
        logging.info(f"{symbol} 止盈订单：{tp_order}")

        # 设置止损
        # 获取入场前一根K线的最高/最低价
        klines = await client.futures_klines(symbol=symbol, interval=TIMEFRAME_5M, limit=2)
        previous_kline = klines[0]
        high_price = float(previous_kline[2])
        low_price = float(previous_kline[3])

        if side == "LONG":
            stop_loss_price = low_price
            sl_order = await client.futures_create_order(
                symbol=symbol,
                side='SELL',
                type='STOP_MARKET',
                stopPrice=stop_loss_price,
                quantity=quantity,
                reduceOnly='true',
                timeInForce='GTC')
        else:
            stop_loss_price = high_price
            sl_order = await client.futures_create_order(
                symbol=symbol,
                side='BUY',
                type='STOP_MARKET',
                stopPrice=stop_loss_price,
                quantity=quantity,
                reduceOnly='true',
                timeInForce='GTC')
        logging.info(f"{symbol} 设置止损单，价格：{stop_loss_price}")
        logging.info(f"{symbol} 止损订单：{sl_order}")

    except Exception as e:
        logging.error(f"开仓时发生错误：{e}")


async def manage_position(client, symbol, position_amt):
    try:
        # 检查仓位盈亏，是否达到止盈止损条件
        # 在此可以根据需要添加更多逻辑
        pass
    except Exception as e:
        logging.error(f"管理仓位时发生错误：{e}")


if __name__ == "__main__":
    asyncio.run(main())

我在交易所app上看到满足交易条件，但程序没执行交易