gpt4 book ai didi

java - Binance API Java - 止损限价单?

转载 作者:太空宇宙 更新时间:2023-11-04 10:13:32 24 4
gpt4 key购买 nike

我已经下载了 binance API for Java我正在尝试弄清楚如何制定新的止损限价单。我已经进入 NewOrder 类并添加了一个构造函数,该构造函数采用止损价格参数和用于创建止损限价卖出订单的方法。

public NewOrder(String symbol, OrderSide side, OrderType type, TimeInForce timeInForce, String quantity, String Price, String stopPrice){
this(symbol, side, type, timeInForce, quantity);
this.price=price;
this.stopPrice=stopPrice;
}

public static NewOrder stopLimitSell(String symbol, TimeInForce timeInForce, String quantity, String price, String stopPrice){
return new NewOrder(symbol, OrderSide.SELL, OrderType.STOP_LOSS_LIMIT, timeInForce, quantity, price, stopPrice);
}

这是应该创建止损限价单的代码行

client.newOrder(stopLimitBuy("BTCUSDT", TimeInForce.GTC, "0.035375", "5000","4999"));

出现以下错误:

Exception in thread "main" com.binance.api.client.exception.BinanceApiException: Mandatory parameter 'price' was not sent, was empty/null, or malformed.

有人可以指导我正确的方向吗? Java中如何为binance创建止损限价单?我找不到任何东西...

最佳答案

创建 NewOrder 对象作为默认限价卖单,然后使用 NewOrder.stopPrice() 添加止损价(即触发值)。

关于java - Binance API Java - 止损限价单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52022504/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com