Closed ndrb closed 3 years ago
I finally managed to figure it out. In the NewOrder.java class, there is the marketBuy method, I overwrote the method to use the quantity value as quoteOrderQuantity since NewOrder object already has a field for quoteOrderQuantity. This is the new method:
public static NewOrder marketBuy(String symbol, String quantity) {
//return new NewOrder(symbol, OrderSide.BUY, OrderType.MARKET, null, quantity);
return new NewOrder(symbol, OrderSide.BUY, OrderType.MARKET, null, null,null, quantity);
}
I finally managed to figure it out. In the NewOrder.java class, there is the marketBuy method, I overwrote the method to use the quantity value as quoteOrderQuantity since NewOrder object already has a field for quoteOrderQuantity. This is the new method:
public static NewOrder marketBuy(String symbol, String quantity) { //return new NewOrder(symbol, OrderSide.BUY, OrderType.MARKET, null, quantity); return new NewOrder(symbol, OrderSide.BUY, OrderType.MARKET, null, null,null, quantity); }
Thanks for actually providing a response and not just claiming you fixed it. There are some ambiguities about how Binance states its order system. Had to learn it the hard way that you have to specify the quantity of the asset, not just the flat USDT you'd like to buy. Would be nicer if they reverted it to the USDT equivalent (or provided another method of making orders this way).
@Angus-Less Yeah it would be a lot clearer with different methods with descriptive names that way the people using the API have options to chose from. I also learned it the hard way by hitting the API and reading the output in my order history. Their test-net also has some differing functionality which I found really hard, it was a while ago so I can't recall but certain tests where failing on test-net but passing on the real API
Hello, I saw the code used to make a new Market Order:
This takes the quantity of the crypto that I want to buy. I was hoping to do market orders using a quote order quantity so I can give it the amount of USDT I want to buy with and for it to return the total final value that it bought. It is easy to do this calculation myself but I worry about market volatility and by diving USDT by BTC/ETH/BNB I will end up with an outdated value.
Thank you kindly for your time!