コード例 #1
0
 public void UpdateUSDFunds() {
   try {
     JSONObject jo =
         new JSONObject(query("getInfo", new HashMap<String, String>())).getJSONObject("return");
     USDFunds = new BigDecimal(jo.getJSONObject("funds").getDouble("usd"));
   } catch (JSONException e) {
     utils.logger.log(true, e.getMessage());
     USDFunds = new BigDecimal(0);
   }
 }
コード例 #2
0
 public void submit_order(String type, String amount, String price) {
   super.submit_order(type, amount, price);
   HashMap<String, String> args = new HashMap<String, String>();
   args.put("pair", "btc_usd");
   if (type.equals("bid")) {
     args.put("type", "buy");
   } else if (type.equals("ask")) {
     args.put("type", "sell");
   }
   args.put("rate", price);
   args.put("amount", amount);
   JSONObject reponse;
   try {
     reponse = new JSONObject(query("Trade", args));
     if (reponse.has("success") && reponse.getInt("success") == 1) {
       settings.lasttrade.setOrderid(
           Integer.toString(reponse.getJSONObject("return").getInt("order_id")));
     }
   } catch (JSONException e) {
     reponse = new JSONObject();
   }
   utils.logger.log(false, reponse.toString());
   needsToUpdateBlances = true;
 }