private String getExchageRate() throws Exception {
String rtnVal = "";
Communicator comm = new Communicator();
String url = "https://quotation-api-cdn.dunamu.com/v1/forex/recent?codes=FRX.KRWUSD";
String recv = comm.getHttpFromURL(url);
JSONArray jsonA = new JSONArray(recv);
JSONObject json = jsonA.getJSONObject(0);
rtnVal = String.valueOf(json.getDouble("basePrice"));
return rtnVal;
}
private String getExchageRateEURUSD() throws Exception {
String rtnVal = "";
Communicator comm = new Communicator();
String url = "https://quotation-api-cdn.dunamu.com/v1/forex/recent?codes=FRX.EURUSD";
String recv = comm.getHttpFromURL(url);
JSONArray jsonA = new JSONArray(recv);
JSONObject json = jsonA.getJSONObject(0);
rtnVal = String.valueOf(json.getDouble("basePrice"));
return rtnVal;
}
private String getExchageRateEURKRW() throws Exception {
String rtnVal = "";
Communicator comm = new Communicator();
String url = "https://quotation-api-cdn.dunamu.com/v1/forex/recent?codes=FRX.KRWEUR";
String recv = comm.getHttpFromURL(url);
JSONArray jsonA = new JSONArray(recv);
JSONObject json = jsonA.getJSONObject(0);
rtnVal = String.valueOf(1 / json.getDouble("basePrice"));
return rtnVal;
}
private String getExchageRateKRWEUR() throws Exception {
String rtnVal = "";
Communicator comm = new Communicator();
String url = "https://quotation-api-cdn.dunamu.com/v1/forex/recent?codes=FRX.KRWEUR";
String recv = comm.getHttpFromURL(url);
JSONArray jsonA = new JSONArray(recv);
JSONObject json = jsonA.getJSONObject(0);
rtnVal = String.valueOf(json.getDouble("basePrice"));
return rtnVal;
}
유로 포함 환율 가져오는 함수