From 51e76fea9d81162a60c9924208f57c45e5aede63 Mon Sep 17 00:00:00 2001 From: Alexander Biryukov Date: Sat, 29 Aug 2020 19:08:19 +0300 Subject: [PATCH] Removed obsoleted SwissCex --- .../coinguardian/config/MarketsConfig.java | 1 - .../coinguardian/model/market/SwissCex.java | 70 ------------------- 2 files changed, 71 deletions(-) delete mode 100644 dataModule/src/main/java/com/mobnetic/coinguardian/model/market/SwissCex.java diff --git a/dataModule/src/main/java/com/mobnetic/coinguardian/config/MarketsConfig.java b/dataModule/src/main/java/com/mobnetic/coinguardian/config/MarketsConfig.java index 4cd0df7f..07848ec4 100644 --- a/dataModule/src/main/java/com/mobnetic/coinguardian/config/MarketsConfig.java +++ b/dataModule/src/main/java/com/mobnetic/coinguardian/config/MarketsConfig.java @@ -54,7 +54,6 @@ private final static void addMarket(Market market) { addMarket(new Bit2c()); addMarket(new CryptoAltex()); addMarket(new BtcMarkets()); - addMarket(new SwissCex()); addMarket(new Bleutrade()); addMarket(new ShareXcoin()); addMarket(new Unisend()); diff --git a/dataModule/src/main/java/com/mobnetic/coinguardian/model/market/SwissCex.java b/dataModule/src/main/java/com/mobnetic/coinguardian/model/market/SwissCex.java deleted file mode 100644 index a939508c..00000000 --- a/dataModule/src/main/java/com/mobnetic/coinguardian/model/market/SwissCex.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.mobnetic.coinguardian.model.market; - -import java.util.List; - -import org.json.JSONArray; -import org.json.JSONObject; - -import android.text.TextUtils; - -import com.mobnetic.coinguardian.model.CheckerInfo; -import com.mobnetic.coinguardian.model.CurrencyPairInfo; -import com.mobnetic.coinguardian.model.Market; -import com.mobnetic.coinguardian.model.Ticker; - -public class SwissCex extends Market { - - private final static String NAME = "SWISSCEX"; - private final static String TTS_NAME = "Swiss Cex"; - private final static String URL = "http://api.swisscex.com/quote/%1$s/%2$s?apiKey=%3$s"; - private final static String URL_CURRENCY_PAIRS = "http://api.swisscex.com/quotes?apiKey=%1$s"; - public static String API_KEY = "61u3kk4h2una357envden8cuk6"; - - public SwissCex() { - super(NAME, TTS_NAME, null); - } - - @Override - public String getUrl(int requestId, CheckerInfo checkerInfo) { - return String.format(URL, checkerInfo.getCurrencyBase(), checkerInfo.getCurrencyCounter(), API_KEY); - } - - @Override - protected void parseTickerFromJsonObject(int requestId, JSONObject jsonObject, Ticker ticker, CheckerInfo checkerInfo) throws Exception { - final JSONObject quoteJsonObject = jsonObject.getJSONObject("quote"); - ticker.bid = quoteJsonObject.getDouble("bidPrice"); - ticker.ask = quoteJsonObject.getDouble("askPrice"); - ticker.vol = quoteJsonObject.getDouble("volume24"); - ticker.high = quoteJsonObject.getDouble("high24"); - ticker.low = quoteJsonObject.getDouble("low24"); - ticker.last = quoteJsonObject.getDouble("lastPrice"); - } - - @Override - protected String parseError(int requestId, String responseString, CheckerInfo checkerInfo) throws Exception { - if(TextUtils.isEmpty(API_KEY)) - return "API_KEY is empty"; - return responseString; - } - - // ==================== - // Get currency pairs - // ==================== - @Override - public String getCurrencyPairsUrl(int requestId) { - return String.format(URL_CURRENCY_PAIRS, API_KEY); - } - - @Override - protected void parseCurrencyPairsFromJsonObject(int requestId, JSONObject jsonObject, List pairs) throws Exception { - final JSONArray pairNames = jsonObject.names(); - for(int i=0; i