Binance.Net placing order with the entire quantity

萝らか妹 提交于 2020-01-25 07:54:37

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!