在 Binance 的 Python 脚本中分析和打印信号的问题

问题描述 投票:0回答:0

我目前正在开发一个 Python 脚本来分析信号并将其发送到 Binance API。但是,我遇到了信号分析和打印的问题。具体来说,当我打印一个信号时,符号值似乎发生了意外变化。

我已经检查了我的代码并确保在分析过程中交易品种参数没有被覆盖或修改。但是,当我打印信号时,符号值与我传递给分析函数的符号值不同。这个问题导致错误的信号被发送到 Binance API。

对于如何解决此问题的任何帮助或建议,我将不胜感激。谢谢。

我尝试检查我的代码是否存在可能修改符号参数的任何实例,以及验证传递给分析函数的数据。我希望在我的代码中找到导致符号值更改的错误,但我无法确定问题所在。结果,错误的信号被发送到 Binance API。

def bot_maria():

symbols_data = get_symbols()
positions, num_open_positions = open_positions(symbols)
Kapital = 9
max_bid_price, max_ask_price, last_price = update_data_10()
last_price = float(last_price)
max_bid_price = float(max_bid_price)
max_ask_price = float(max_ask_price)

quantity = math.floor(Kapital / float(last_price))



# Open positions last_price >= max_bid_price + 0.005: abrir posicion LONG,  
for symbol in symbols_data:
    if last_price >= max_bid_price + 0.005:

        print(f' Signal BUY Symbol {symbol} LONG point: {max_bid_price} Qty: {quantity}')
        
        if positions.get(symbol, {}).get('is_open', False):
            
            print(f"Position already open for {symbol} - skipping")
            
            continue
        try:
            response = um_futures_client.new_order(
                symbol=symbol, side="SELL", type="LIMIT", quantity=quantity, price=max_ask_price, timeInForce="GTC")
            
            print(f' BUY order delivered @ Symbol {symbol} LONG point: {max_bid_price} Qty: {quantity}')
            
        except Exception as e:
            print(f"Failed to place sell order for {symbol}: {e}")

符号 MANAUSDT 的 10 个级别的订单簿: MANAUSDT 的最高出价:0.583,数量为 183654.0 MANAUSDT 的最大要价:0.587,数量为 99527.0 MANAUSDT 最后价格:0.58520000 Signal SELL Symbol SNXUSDT SHORT 点:0.587 数量:15

debugging jupyter-notebook bots trading binance
© www.soinside.com 2019 - 2024. All rights reserved.