Fix imports.

Add FuturocoinExtension to batm-extensions.xml
This commit is contained in:
Artur Kowalski 2018-05-16 08:42:06 +02:00
parent a4a11c2b0f
commit e4d5aa3c10
8 changed files with 43 additions and 24 deletions

View File

@ -28,9 +28,6 @@ import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;
//import com.generalbytes.batm.server.extensions.extra.dogecoin.sources.chainso.ChainSoRateSource;
//import com.generalbytes.batm.server.extensions.extra.dogecoin.wallets.blockio.BlockIOWallet;
public class FuturocoinExtension implements IExtension{
@Override
public String getName() {
@ -77,7 +74,7 @@ public class FuturocoinExtension implements IExtension{
@Override
public ICryptoAddressValidator createAddressValidator(String cryptoCurrency) {
if (ICurrencies.FTO.equalsIgnoreCase(cryptoCurrency)) {
if (Currencies.FTO.equalsIgnoreCase(cryptoCurrency)) {
return new FuturocoinAddressValidator();
}
return null;
@ -102,7 +99,7 @@ public class FuturocoinExtension implements IExtension{
} catch (Throwable e) {
}
}
String preferedFiatCurrency = ICurrencies.USD;
String preferedFiatCurrency = Currencies.USD;
if (st.hasMoreTokens()) {
preferedFiatCurrency = st.nextToken().toUpperCase();
}
@ -117,7 +114,7 @@ public class FuturocoinExtension implements IExtension{
@Override
public Set<String> getSupportedCryptoCurrencies() {
Set<String> result = new HashSet<String>();
result.add(ICurrencies.FTO);
result.add(Currencies.FTO);
return result;
}

View File

@ -1,6 +1,6 @@
package com.generalbytes.batm.server.extensions.extra.futurocoin.sources;
import com.generalbytes.batm.server.extensions.ICurrencies;
import com.generalbytes.batm.server.extensions.Currencies;
import com.generalbytes.batm.server.extensions.IRateSource;
import java.math.BigDecimal;
@ -13,25 +13,25 @@ import java.util.Set;
public class FixPriceRateSource implements IRateSource {
private BigDecimal rate = BigDecimal.ZERO;
private String preferedFiatCurrency = ICurrencies.USD;
private String preferedFiatCurrency = Currencies.USD;
public FixPriceRateSource(BigDecimal rate, String preferedFiatCurrency) {
this.rate = rate;
if (ICurrencies.USD.equalsIgnoreCase(preferedFiatCurrency)) {
this.preferedFiatCurrency = ICurrencies.USD;
if (Currencies.USD.equalsIgnoreCase(preferedFiatCurrency)) {
this.preferedFiatCurrency = Currencies.USD;
}
}
@Override
public Set<String> getCryptoCurrencies() {
Set<String> result = new HashSet<String>();
result.add(ICurrencies.FTO);
result.add(Currencies.FTO);
return result;
}
@Override
public BigDecimal getExchangeRateLast(String cryptoCurrency, String fiatCurrency) {
if (ICurrencies.FTO.equalsIgnoreCase(cryptoCurrency)) {
if (Currencies.FTO.equalsIgnoreCase(cryptoCurrency)) {
return rate;
}
return null;
@ -40,7 +40,7 @@ public class FixPriceRateSource implements IRateSource {
@Override
public Set<String> getFiatCurrencies() {
Set<String> result = new HashSet<String>();
result.add(ICurrencies.USD);
result.add(Currencies.USD);
return result;
}
@Override

View File

@ -1,6 +1,5 @@
package com.generalbytes.batm.server.extensions.extra.futurocoin.sources.yobit;
import com.generalbytes.batm.server.extensions.extra.futurocoin.sources.yobit.dto.Ticker;
import com.generalbytes.batm.server.extensions.extra.futurocoin.sources.yobit.dto.YobitResponse;
import javax.ws.rs.GET;

View File

@ -1,15 +1,16 @@
package com.generalbytes.batm.server.extensions.extra.futurocoin.sources.yobit;
import com.generalbytes.batm.server.extensions.ICurrencies;
import com.generalbytes.batm.server.extensions.Currencies;
import com.generalbytes.batm.server.extensions.IRateSource;
import com.generalbytes.batm.server.extensions.extra.bitcoin.sources.bity.IBity;
import com.generalbytes.batm.server.extensions.extra.futurocoin.sources.yobit.dto.Ticker;
import com.generalbytes.batm.server.extensions.extra.futurocoin.sources.yobit.dto.YobitResponse;
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;
import si.mazi.rescu.RestProxyFactory;
public class YobitRateSource implements IRateSource {
private IYobitAPI api;
@ -21,14 +22,14 @@ public class YobitRateSource implements IRateSource {
@Override
public Set<String> getCryptoCurrencies() {
Set<String> result = new HashSet<String>();
result.add(ICurrencies.FTO);
result.add(Currencies.FTO);
return result;
}
@Override
public Set<String> getFiatCurrencies() {
Set<String> result = new HashSet<String>();
result.add(ICurrencies.USD);
result.add(Currencies.USD);
return result;
}
@ -39,11 +40,11 @@ public class YobitRateSource implements IRateSource {
}
YobitResponse response = api.getTicker(cryptoCurrency.toLowerCase(), fiatCurrency.toLowerCase());
return response.getFot_usd().getLast();
return response.getFto_usd().getLast();
}
@Override
public String getPreferredFiatCurrency() {
return ICurrencies.USD;
return Currencies.USD;
}
}

View File

@ -3,7 +3,7 @@ package com.generalbytes.batm.server.extensions.extra.futurocoin.sources.yobit.d
public class YobitResponse {
private Ticker fot_usd;
public Ticker getFot_usd() {
public Ticker getFto_usd() {
return fot_usd;
}

View File

@ -2,8 +2,12 @@ package com.generalbytes.batm.server.extensions.extra.futurocoin.wallets.futuroc
import com.azazar.bitcoin.jsonrpcclient.BitcoinException;
import com.azazar.bitcoin.jsonrpcclient.BitcoinJSONRPCClient;
import com.generalbytes.batm.server.extensions.ICurrencies;
import com.generalbytes.batm.server.extensions.Currencies;
import com.generalbytes.batm.server.extensions.IWallet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.math.BigDecimal;
import java.net.MalformedURLException;
import java.util.HashSet;
@ -13,7 +17,7 @@ import java.util.Set;
public class FuturocoinRPCWallet implements IWallet {
private static final Logger log = LoggerFactory.getLogger(FuturocoinRPCWallet.class);
private static final String CRYPTO_CURRENCY = ICurrencies.FTO;
private static final String CRYPTO_CURRENCY = Currencies.FTO;
public FuturocoinRPCWallet(String rpcURL, String accountName) {
this.rpcURL = rpcURL;

View File

@ -17,7 +17,6 @@
************************************************************************************/
package com.generalbytes.batm.server.extensions.extra.maxcoin.sources;
import com.generalbytes.batm.server.extensions.Currencies;
import com.generalbytes.batm.server.extensions.Currencies;
import com.generalbytes.batm.server.extensions.IRateSource;
import org.slf4j.Logger;

View File

@ -434,4 +434,23 @@
<cryptologo cryptocurrency="BTX" file="btx.png"/>
</extension>
<extension class="com.generalbytes.batm.server.extensions.extra.watchlists.BasicWatchlistsExtension" />
<extension class="com.generalbytes.batm.server.extensions.extra.futurocoin.FuturocoinExtension" >
<wallet prefix="futurocoind" name="Futurocoind">
<param name="protocol" />
<param name="user" />
<param name="password" />
<param name="host" />
<param name="port" />
<param name="accountname" />
<cryptocurrency>FTO</cryptocurrency>
</wallet>
<ratesource prefix="yobit" name="Yobit" >
<cryptocurrency>FTO</cryptocurrency>
</ratesource>
<ratesource prefix="ftofix" name ="Fix Price" >
<param name="price" />
<cryptocurrency>FTO</cryptocurrency>
</ratesource>
<cryptologo cryptocurrency="FTO" file="fto.png"/>
</extension>
</extensions>