Exemplo n.º 1
0
        public async Task <BaseTypes.CurrencyBalance> GetBalance(string Currency, InvokePrint Print)
        {
            try
            {
                var cbal = await bittrex.GetBalance(Currency);

                BaseTypes.CurrencyBalance balance = new BaseTypes.CurrencyBalance
                {
                    Currency  = cbal.Currency,
                    Balance   = cbal.Balance,
                    Available = cbal.Available
                };
                return(balance);
            }
            catch (Exception ex)
            {
                System.Media.SystemSounds.Beep.Play();
                Print(String.Format("Ошибка BittrexApi GetBalance: {0}\r\nCurrency: {1}.", ex.Message, Currency));
                return(null);
            }
        }
Exemplo n.º 2
0
        public async Task <BaseTypes.CurrencyBalance> GetBalance(string Currency, InvokePrint Print)
        {
            try
            {
                var ainfo = await binanceClient.GetAccountInfo();

                var Bbalance = ainfo.Balances.First(x => x.Asset == Currency);

                var balance = new BaseTypes.CurrencyBalance
                {
                    Currency  = Bbalance.Asset,
                    Balance   = Bbalance.Free + Bbalance.Locked,
                    Available = Bbalance.Free
                };
                return(balance);
            }
            catch (Exception ex)
            {
                System.Media.SystemSounds.Beep.Play();
                Print(String.Format("Ошибка BinanceApi GetBalance: {0}\r\nCurrency: {1}.", ex.Message, Currency));
                return(null);
            }
        }