Merge pull request #54 from vsobalski/master

Added support for Flashcoin in coinMarketCap
This commit is contained in:
GENERAL BYTES 2018-04-23 09:20:36 +02:00 committed by GitHub
commit d303cc5946
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 6 deletions

View File

@ -43,6 +43,8 @@ public class CoinmarketcapRateSource implements IRateSource {
result.add(ICurrencies.DASH);
result.add(ICurrencies.XMR);
result.add(ICurrencies.POT);
result.add(ICurrencies.FLASH);
return result;
}
@ -66,7 +68,12 @@ public class CoinmarketcapRateSource implements IRateSource {
if (!getFiatCurrencies().contains(fiatCurrency)) {
return null;
}
CMCTicker[] tickers = api.getTickers(fiatCurrency);
CMCTicker[] tickers;
if(ICurrencies.FLASH.equalsIgnoreCase(cryptoCurrency)){
tickers = api.getTickers(cryptoCurrency,fiatCurrency);
}else
tickers = api.getTickers(fiatCurrency);
for (int i = 0; i < tickers.length; i++) {
CMCTicker ticker = tickers[i];
if (cryptoCurrency.equalsIgnoreCase(ticker.getSymbol())) {

View File

@ -17,10 +17,7 @@
************************************************************************************/
package com.generalbytes.batm.server.extensions.extra.dash.sources.coinmarketcap;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
@Path("/v1/ticker")
@ -29,4 +26,8 @@ public interface ICoinmarketcapAPI {
@GET
@Path("/")
CMCTicker[] getTickers(@QueryParam("convert") String fiatCurrency);
@GET
@Path("/{cryptoToGet}/?convert={convert}")
CMCTicker[] getTickers(@PathParam("cryptoToGet") String cryptoToGet,@QueryParam("convert") String fiatCurrency);
}

View File

@ -404,7 +404,7 @@ public class Tester {
System.out.println(" " + fiatCurrency);
}
System.out.println("Crypto Currencies:");
String selectedCryptoCurrency = null;
String selectedCryptoCurrency = params;
for (String cryptoCurrency : cryptoCurrencies) {
if (selectedCryptoCurrency == null) {
selectedCryptoCurrency = cryptoCurrency;