public void localUpdate() {
   SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
   String[] currencies = fxRates.getCurrencies();
   for (int i = 0; i < currencies.length; i++) {
     prices.put(
         currencies[i],
         Double.longBitsToDouble(prefs.getLong(currencies[i], Double.doubleToLongBits(0.0))));
     symbols.put(currencies[i], prefs.getString(currencies[i] + "-SYM", null));
   }
 }
  public static CurrencyExchange getInstance(Context ctx) {

    context = ctx;

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    strFiatCode = prefs.getString("ccurrency", "USD");

    if (instance == null) {
      fxRates = new ExchangeRates();
      prices = new HashMap<String, Double>();
      symbols = new HashMap<String, String>();
      String[] currencies = fxRates.getCurrencies();
      for (int i = 0; i < currencies.length; i++) {
        prices.put(
            currencies[i],
            Double.longBitsToDouble(prefs.getLong(currencies[i], Double.doubleToLongBits(0.0))));
        symbols.put(currencies[i], prefs.getString(currencies[i] + "-SYM", null));
      }

      instance = new CurrencyExchange();
    }

    if (System.currentTimeMillis() - ts > (15 * 60 * 1000)) {

      getExchangeRates();

      String[] currencies = fxRates.getCurrencies();
      SharedPreferences.Editor editor = prefs.edit();
      for (int i = 0; i < currencies.length; i++) {
        if (fxRates.getLastPrice(currencies[i]) > 0.0) {
          editor.putLong(
              currencies[i], Double.doubleToRawLongBits(fxRates.getLastPrice(currencies[i])));
          editor.putString(currencies[i] + "-SYM", fxRates.getSymbol(currencies[i]));
        }
      }
      editor.commit();
    }

    return instance;
  }
 public String[] getBlockchainCurrencies() {
   return fxRates.getCurrencies();
 }