public void UpdateCurrentWallet() { using (var client = CreateBinanceClient()) { var price = client.GetPrice(_symbolPair.ToString()); var accountInfo = client.GetAccountInfo(); var s1b = accountInfo.Data.Balances .Where(b => b.Asset == _symbolPair.Symbol1) .First(); var s2b = accountInfo.Data.Balances .Where(b => b.Asset == _symbolPair.Symbol2) .First(); SymbolAmountPair cw; var s1pcb = s1b.Total * price.Data.Price; if (s1pcb > s2b.Total) { cw = SymbolAmountPair.Create(s1b.Asset, s1b.Total); } else { cw = SymbolAmountPair.Create(s2b.Asset, s2b.Total); } if (cw != CurrentWallet) { Wallets.Add(cw); } } }
public void UpdateCurrentWallet() { var nw = SymbolAmountPair.Create("USDT", 100m); if (nw != CurrentWallet) { Wallets.Add(nw); } }
private SymbolAmountPair CalculateWalletBalanceAfterTrade(SymbolAmountPair initial, decimal price) { if (initial.Symbol == _config.FirstSymbol) { return(SymbolAmountPair.Create(_config.SecondSymbol, price * initial.Amount * 0.999m)); } else { return(SymbolAmountPair.Create(_config.FirstSymbol, initial.Amount / price * 0.999m)); } }