Skip to content

Commit

Permalink
Fixed CCEXExchange returning 403 http error code.
Browse files Browse the repository at this point in the history
Fixed KrakenExchange not recognizing GBP and JPY as fiat.
Removed Vault of Satoshi exchange.
Removed Justcoin exchange.
  • Loading branch information
andrefbsantos committed Jan 29, 2015
1 parent 2fffecc commit 26b326e
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 266 deletions.
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
<jdk.version>1.6</jdk.version>
<release.description>
\- Removed MintPal exchange.
\- Fixed CCEXExchange returning 403 http error code.
\- Fixed KrakenExchange not recognizing GBP and JPY as fiat.
\- Removed Vault of Satoshi exchange.
\- Removed Justcoin exchange.
</release.description>
</properties>

Expand Down
18 changes: 14 additions & 4 deletions src/main/java/mobi/boilr/libdynticker/exchanges/CCEXExchange.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -22,9 +23,13 @@ public CCEXExchange(long expiredPeriod) {

@Override
protected List<Pair> getPairsFromAPI() throws JsonProcessingException, MalformedURLException,
IOException {
IOException {
List<Pair> pairs = new ArrayList<Pair>();
JsonNode node = (new ObjectMapper()).readTree(new URL("https://c-cex.com/t/pairs.json"));
URL url = new URL("https://c-cex.com/t/pairs.json");
URLConnection uc = url.openConnection();
uc.addRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
uc.connect();
JsonNode node = (new ObjectMapper()).readTree(uc.getInputStream());
TypeReference<List<String>> typeRef = new TypeReference<List<String>>() {
};
List<String> symbols = (new ObjectMapper()).readValue(node.get("pairs"), typeRef);
Expand All @@ -40,8 +45,13 @@ protected List<Pair> getPairsFromAPI() throws JsonProcessingException, Malformed
protected String getTicker(Pair pair) throws JsonProcessingException, MalformedURLException,
IOException {
// https://c-cex.com/t/btc-usd.json
JsonNode node = (new ObjectMapper()).readTree(new URL("https://c-cex.com/t/"
+ pair.getCoin().toLowerCase() + "-" + pair.getExchange().toLowerCase() + ".json"));
URL url = new URL("https://c-cex.com/t/"
+ pair.getCoin().toLowerCase() + "-" + pair.getExchange().toLowerCase() + ".json");
URLConnection uc = url.openConnection();
uc.addRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
uc.connect();

JsonNode node = (new ObjectMapper()).readTree(uc.getInputStream());
return parseJSON(node, pair);
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

Expand All @@ -15,6 +16,17 @@

public final class KrakenExchange extends Exchange {

private static final List<String> fiat;

static{
List<String> tempFiat = new ArrayList<String>();
tempFiat.add("USD");
tempFiat.add("EUR");
tempFiat.add("GBP");
tempFiat.add("JPY");
fiat = Collections.unmodifiableList(tempFiat);
}

public KrakenExchange(long expiredPeriod) {
super("Kraken", expiredPeriod);
}
Expand Down Expand Up @@ -60,8 +72,8 @@ public String parseJSON(JsonNode node, Pair pair) throws IOException {
}

private String pairCode(Pair pair) {
String exchangeCode = pair.getExchange().equals("USD") || pair.getExchange().equals("EUR") ? "Z" : "X";
String coinCode = pair.getCoin().equals("USD") || pair.getCoin().equals("EUR") ? "Z" : "X";
String exchangeCode = fiat.contains(pair.getExchange()) ? "Z" : "X";
String coinCode = fiat.contains(pair.getCoin()) ? "Z" : "X";
return coinCode + pair.getCoin() + exchangeCode + pair.getExchange();
}
}
71 changes: 0 additions & 71 deletions src/main/java/mobi/boilr/libdynticker/exchanges/VoSExchange.java

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 26b326e

Please sign in to comment.