问题
I wanted to put orders with 100% of my quantity but I don't seem to find built-in functionality in Binance.Net, so I decided to make it myself.
var balance = _client.GetAccountInfo().Data.Balances.FirstOrDefault(e => e.Asset == "TRX").Free;
var orderId = _client.PlaceOrder("TRXUSDT", OrderSide.Sell, OrderType.Limit, quantity: balance, price: 0.01460m, timeInForce: TimeInForce.GoodTillCancel);
The following code is selling 100% of my TRX quantity for USDT.
The problem is that I only have the crypto pair saved into my database (TRXUSDT
) and I don't have TRX and USDT, separately. Of course, I could use substring but there are symbols with more than 3 symbols, e.g. MATICUSDT.
Yes, I could use StartsWith:
var asdf = client.GetAccountInfo().Data.Balances.Where(e => e.Asset.StartsWith("TRXUSDT".Substring(0, 3)));
This gets the first pair (TRX) but what about the second pair (USDT)? I can't think of any solution.
来源:https://stackoverflow.com/questions/59636473/binance-net-placing-order-with-the-entire-quantity