/// <summary> /// Helper method to build wallet objects /// </summary> private static MtGoxWallet BuildWallet(string walletName, dynamic obj) { if (obj == null) { throw new Exception("No wallet for this currency"); } MtGoxCurrencySymbol name = (MtGoxCurrencySymbol)Enum.Parse(typeof(MtGoxCurrencySymbol), walletName, true); MtGoxWalletBalance bal = new MtGoxWalletBalance(double.Parse(obj.Balance.value), Int64.Parse(obj.Balance.value_int), obj.Balance.display, (MtGoxCurrencySymbol)Enum.Parse(typeof(MtGoxCurrencySymbol), obj.Balance.currency, true)); int ops = obj.Operations; MtGoxWithdrawalLimit dwd = null; if (obj.Daily_Withdraw_Limit != null) { dwd = new MtGoxWithdrawalLimit(double.Parse(obj.Daily_Withdraw_Limit.value), Int64.Parse(obj.Daily_Withdraw_Limit.value_int), obj.Daily_Withdraw_Limit.display, (MtGoxCurrencySymbol)Enum.Parse(typeof(MtGoxCurrencySymbol), obj.Daily_Withdraw_Limit.currency, true)); } MtGoxWithdrawalLimit mwd = null; if (obj.Monthly_Withdraw_Limit != null) { mwd = new MtGoxWithdrawalLimit(double.Parse(obj.Monthly_Withdraw_Limit.value), Int64.Parse(obj.Monthly_Withdraw_Limit.value_int), obj.Monthly_Withdraw_Limit.display, (MtGoxCurrencySymbol)Enum.Parse(typeof(MtGoxCurrencySymbol), obj.Monthly_Withdraw_Limit.currency, true)); } MtGoxWithdrawalLimit maxwd = null; if (obj.Max_Withdraw != null) { maxwd = new MtGoxWithdrawalLimit(double.Parse(obj.Max_Withdraw.value), Int64.Parse(obj.Max_Withdraw.value_int), obj.Max_Withdraw.display, (MtGoxCurrencySymbol)Enum.Parse(typeof(MtGoxCurrencySymbol), obj.Max_Withdraw.currency, true)); } MtGoxWallet wal = new MtGoxWallet(name, bal, ops, dwd, mwd, maxwd); return(wal); }
public MtGoxWallet(MtGoxCurrencySymbol name, MtGoxWalletBalance balance, int Operations, MtGoxWithdrawalLimit Daily_Withdraw_Limit, MtGoxWithdrawalLimit Monthly_Withdraw_Limit, MtGoxWithdrawalLimit Max_Withdraw) { this.name = name; this.balance = balance; this.Operations = Operations; this.Daily_Withdraw_Limit = Daily_Withdraw_Limit; this.Monthly_Withdraw_Limit = Monthly_Withdraw_Limit; this.Max_Withdraw = Max_Withdraw; }
/// <summary> /// Helper method to build wallet objects /// </summary> private static MtGoxWallet BuildWallet(string walletName, dynamic obj) { if(obj == null) throw new Exception("No wallet for this currency"); MtGoxCurrencySymbol name = (MtGoxCurrencySymbol)Enum.Parse(typeof(MtGoxCurrencySymbol), walletName, true); MtGoxWalletBalance bal = new MtGoxWalletBalance(double.Parse(obj.Balance.value), Int64.Parse(obj.Balance.value_int), obj.Balance.display, (MtGoxCurrencySymbol)Enum.Parse(typeof(MtGoxCurrencySymbol), obj.Balance.currency, true)); int ops = obj.Operations; MtGoxWithdrawalLimit dwd = null; if (obj.Daily_Withdraw_Limit != null) { dwd = new MtGoxWithdrawalLimit(double.Parse(obj.Daily_Withdraw_Limit.value), Int64.Parse(obj.Daily_Withdraw_Limit.value_int), obj.Daily_Withdraw_Limit.display, (MtGoxCurrencySymbol)Enum.Parse(typeof(MtGoxCurrencySymbol), obj.Daily_Withdraw_Limit.currency, true)); } MtGoxWithdrawalLimit mwd = null; if (obj.Monthly_Withdraw_Limit != null) { mwd = new MtGoxWithdrawalLimit(double.Parse(obj.Monthly_Withdraw_Limit.value), Int64.Parse(obj.Monthly_Withdraw_Limit.value_int), obj.Monthly_Withdraw_Limit.display, (MtGoxCurrencySymbol)Enum.Parse(typeof(MtGoxCurrencySymbol), obj.Monthly_Withdraw_Limit.currency, true)); } MtGoxWithdrawalLimit maxwd = null; if (obj.Max_Withdraw != null) { maxwd = new MtGoxWithdrawalLimit(double.Parse(obj.Max_Withdraw.value), Int64.Parse(obj.Max_Withdraw.value_int), obj.Max_Withdraw.display, (MtGoxCurrencySymbol)Enum.Parse(typeof(MtGoxCurrencySymbol), obj.Max_Withdraw.currency, true)); } MtGoxWallet wal = new MtGoxWallet(name, bal, ops, dwd, mwd, maxwd); return wal; }