0

First of all, I'm using Binance.Net as a Binance API wrapper. At first point, I was struggling to get my balance for the base and quote assets for a crypto pair.

Let's say we're talking about BTCUSDT. I had a problem in obtaining BTC and USDT, separately because I need them to obtain the information about my balance.

var symbols = _client.GetExchangeInfo().Data.Symbols;
var symbol = symbols.Single(item => item.Name == "BTCUSDT");
var baseAsset = symbol.BaseAsset; // BTC
var quoteAsset = symbol.QuoteAsset; // USDT

var firstPairBalance = client.GetAccountInfo().Data.Balances.FirstOrDefault(e => e.Asset == baseAsset).Free; // Balance for BTC
var secondPairBalance = client.GetAccountInfo().Data.Balances.FirstOrDefault(e => e.Asset == quoteAsset).Free; // Balance for USDT

client.PlaceOrder("TRXUSDT", OrderSide.Sell, OrderType.Market, quantity: ..., timeInForce: TimeInForce.GoodTillCancel);

How do I get price estimation to dollars for each of the crypto pairs, so I can compare them and see how much I need to convert. In other words, dollar price for TRX and dollar price USDT, preferably from Binance.

nop
  • 4,711
  • 6
  • 32
  • 93
  • https://www.binance.com/api/v3/ticker/price?symbol=TRXUSDT or `client.GetPrice("TRXUSDT");` – Charles Jan 08 '20 at 18:45
  • @Charles, that seems to be the last price. I need split my current amount (TRX + USDT) into 50/50. If I have $50 TRX and $0 USDT. It should split to $25 TRX and $25 USDT. To do that I need to know how much TRX are worth $25. – nop Jan 08 '20 at 19:08
  • divide $25 by the price of one – Charles Jan 08 '20 at 19:16

0 Answers0