static SortedSet <string> GetDeletedCurrencies(IEnumerable <string> resp_pairs) { var our_currencies = WexCurrencyHelper.GetAllCurrencies(); foreach (string s_pair in resp_pairs) { string[] two_currs_arr = s_pair.Split(WexPairHelper.PAIR_TO_CURR_SPLIT_CHARS); if (two_currs_arr.Count() != 2) { throw new Exception("Strange pair " + s_pair); } foreach (string s_curr in two_currs_arr) { WexCurrency wex_curr = WexCurrencyHelper.FromString(s_curr); if (wex_curr != WexCurrency.Unknown) { our_currencies.Remove(wex_curr); } } } SortedSet <string> deleted_currencies = new SortedSet <string>(); foreach (WexCurrency curr in our_currencies) { deleted_currencies.Add(WexCurrencyHelper.ToString(curr)); } return(deleted_currencies); }
/// <summary> /// This method can be used to retrieve the address for depositing crypto-currency. /// See https://github.com/wex-exchange/api-doc/blob/master/trade-api.md#CoinDepositAddress /// </summary> /// <param name="crypto_currency">Crypto currency</param> /// <returns>address for deposits</returns> public string CoinDepositAddress(WexCurrency crypto_currency) { var args = new Dictionary <string, string>() { { "method", "CoinDepositAddress" }, { "coinName", WexCurrencyHelper.ToString(crypto_currency).ToUpperInvariant() } }; string query_answer = QueryExec(args); var json_result = ParseAnswer(query_answer); return(json_result.Value <string>("address")); }
public static Transaction ReadFromJObject(JObject o) { if (o == null) { return(null); } return(new Transaction() { Type = (TransType)o.Value <int>("type"), Amount = o.Value <decimal>("amount"), Currency = WexCurrencyHelper.FromString(o.Value <string>("currency")), Description = o.Value <string>("desc"), Status = (TransStatus)o.Value <int>("status"), Timestamp = UnixTime.ConvertToDateTime(o.Value <UInt32>("timestamp")) }); }
public static PairCurrencies GetPairCurrencies(WexPair p) { if (p == WexPair.Unknown) { return(null); } string str_p = ToString(p); string[] arr = str_p.Split(PAIR_TO_CURR_SPLIT_CHARS); if (arr.Length != 2) { throw new Exception("Strange pair " + str_p); } return(new PairCurrencies { BaseCurrency = WexCurrencyHelper.FromString(arr[0]), QuoteCurrency = WexCurrencyHelper.FromString(arr[1]) }); }
public static Funds ReadFromJObject(JObject o) { if (o == null) { return(null); } Dictionary <WexCurrency, decimal> funds_amounts = new Dictionary <WexCurrency, decimal>(); var funds = o.Children(); foreach (JProperty cur in funds) { string name = cur.Name; decimal value = o.Value <decimal>(name); funds_amounts.Add(WexCurrencyHelper.FromString(name), value); } return(new Funds() { Amounts = funds_amounts }); }
static SortedSet <string> GetAddedCurrencies(List <string> resp_pairs) { SortedSet <string> added_currencies = new SortedSet <string>(); foreach (string s_pair in resp_pairs) { string[] two_currs_arr = s_pair.Split(WexPairHelper.PAIR_TO_CURR_SPLIT_CHARS); if (two_currs_arr.Count() != 2) { throw new Exception("Strange pair " + s_pair); } foreach (string s_curr in two_currs_arr) { WexCurrency wex_curr = WexCurrencyHelper.FromString(s_curr); if (wex_curr == WexCurrency.Unknown) { added_currencies.Add(s_curr.ToLowerInvariant()); } } } return(added_currencies); }