我已经下载了 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() 添加止损价(即触发值)。
我是一名优秀的程序员,十分优秀!