public static String adaptCurrencyPairToSymbol(CurrencyPair currencyPair) { return currencyPair == null ? null : currencyPair.base.getCurrencyCode() + currencyPair.counter.getCurrencyCode(); }
public static Currency fromLunoCurrency(String c) { String in; switch (c) { case "XBT": in = "BTC"; break; default: in = c; } return Currency.getInstance(in); }
public static String adaptXchangeCurrency(Currency xchangeSymbol) { if (xchangeSymbol == null) { return null; } return xchangeSymbol.toString().toLowerCase(); }
public static CurrencyPair convert(String symbol) { // Iterate by base currency priority at binance. for (Currency base : Arrays.asList(Currency.BTC, Currency.ETH, Currency.BNB, Currency.USDT)) { if (symbol.contains(base.toString())) { String counter = symbol.replace(base.toString(), ""); return new CurrencyPair(base, new Currency(counter)); } } throw new IllegalArgumentException("Could not parse currency pair from '" + symbol + "'"); }
@Override public String requestDepositAddress(Currency currency, String... args) throws IOException { KrakenDepositAddress[] depositAddresses; if (Currency.BTC.equals(currency)) { depositAddresses = getDepositAddresses(currency.toString(), "Bitcoin", false); } else if (Currency.LTC.equals(currency)) { depositAddresses = getDepositAddresses(currency.toString(), "Litecoin", false); } else { throw new RuntimeException("Not implemented yet, Kraken works only for BTC and LTC"); } return KrakenAdapters.adaptKrakenDepositAddress(depositAddresses); }
@Override public String requestDepositAddress(Currency currency, String... args) throws IOException { BitcoinAccount[] quoineCryptoAccountInfo = getQuoineCryptoAccountInfo(); for (BitcoinAccount bitcoinAccount : quoineCryptoAccountInfo) { Currency ccy = Currency.getInstance(bitcoinAccount.getCurrency()); if (ccy.equals(currency)) return bitcoinAccount.getAddress(); } return null; }
public BitfinexAccountFeesResponse( @JsonProperty("withdraw") final Map<String, BigDecimal> withdraw) { this.withdraw = withdraw .entrySet() .stream() // Sting needs to be adapted (i.e., DSH -> DASH) .collect( Collectors.toMap( entry -> new Currency(BitfinexAdapters.adaptBitfinexCurrency(entry.getKey())), entry -> entry.getValue())); }
private boolean isIn(Currency currency, Currency[] currencies) { for (Currency cur : currencies) if (cur.equals(currency)) return true; return false; } }
public static Wallet adaptBalances( Map<String, Bl3pAccountInfo.Bl3pAccountInfoWallet> bl3pBalances) { List<Balance> balances = new ArrayList<>(bl3pBalances.size()); for (Bl3pAccountInfo.Bl3pAccountInfoWallet bl3pWallet : bl3pBalances.values()) { balances.add( new Balance( new Currency(bl3pWallet.getAvailable().currency), bl3pWallet.getBalance().value, bl3pWallet.getAvailable().value)); } return new Wallet(balances); }
@Override public String toString() { return pair == null ? "" : String.format("%s%s", pair.base.getCurrencyCode(), pair.counter.getCurrencyCode()); } }
public static Currency adaptCurrencyIn(String currency) { /* BTC-E signals DASH as DSH. This is a different coin. Translate in correct DASH name */ if (currency.toLowerCase().equals("dsh")) { currency = "dash"; } return Currency.getInstance(currency); } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; CoinbasePrice other = (CoinbasePrice) obj; return amount.compareTo(other.amount) == 0 && currency.equals(other.currency); }
public static FundingRecord adaptFundingRecord( BitflyerDepositOrWithdrawal history, FundingRecord.Type type) { return new FundingRecord.Builder() .setDate(BitflyerUtils.parseDate(history.getEventDate())) .setCurrency(new Currency(history.getCurrencyCode())) .setAmount(history.getAmount()) .setInternalId(history.getID()) .setType(type) .setStatus(adaptStatus(history.getStatus())) .setBalance(history.getAmount()) .build(); }
public static String currencyPairToBitMarketCurrencyPair(CurrencyPair currencyPair) { if (currencyPair.base.getCurrencyCode().equals("LiteMineX") && currencyPair.counter.getCurrencyCode().equals("BTC")) { return "LiteMineXBTC"; } else { return currencyPair.base.getCurrencyCode() + currencyPair.counter.getCurrencyCode(); } }
@JsonCreator public CoinbasePrice( @JsonProperty("amount") BigDecimal amount, @JsonProperty("currency") String currency) { this(amount, Currency.getInstance(currency)); }