コード例 #1
0
        /// <summary>
        /// Update account balances and total USD value
        /// </summary>
        private void UpdateAccounts(object sender, EventArgs e)
        {
            try
            {
                var assets   = 0.0M;
                var balances = GeminiClient.GetBalances();
                foreach (var balance in balances)
                {
                    switch (balance.Currency)
                    {
                    case "BTC":
                        textboxBtcBalance.Text = balance.Amount.ToString();
                        assets += balance.Amount * LastTrades["btcusd"].Price;
                        break;

                    case "ETH":
                        textboxEthBalance.Text = balance.Amount.ToString();
                        assets += balance.Amount * LastTrades["ethusd"].Price;
                        break;

                    case "USD":
                        textboxUsdBalance.Text = balance.Amount.ToString();
                        assets += balance.Amount;
                        break;
                    }
                }
                labelAssetValue.Text = String.Format("Total Value: ${0}", Math.Round(assets, 2));
            }
            catch (Exception ex)
            {
                Logger.WriteException(Logger.Level.Error, ex);
            }
        }
コード例 #2
0
ファイル: Libra.cs プロジェクト: jefmcclimans/Libra
 private void bMaxWithdraw_Click(object sender, EventArgs e)
 {
     try
     {
         tbWithdrawAmount.Text = GeminiClient.GetBalances()
                                 .First((x) => x.Currency == cbWithdraw.Text)
                                 .AvailableForWithdrawal.ToString();
     }
     catch { }
 }