本文整理了Java中org.knowm.xchange.currency.Currency
类的一些代码示例,展示了Currency
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Currency
类的具体详情如下:
包路径:org.knowm.xchange.currency.Currency
类名称:Currency
[英]A Currency class roughly modeled after java.util.Currency. Each object retains the code it was acquired with -- so #getInstance("BTC"). #getCurrencyCode() will always be "BTC", even though the proposed ISO 4217 code is "XBT"
[中]大致模仿java的货币类。util。通货每个对象都保留了用--so#getInstance(“BTC”)获取的代码#getCurrencyCode()将始终为“BTC”,即使建议的ISO 4217代码为“XBT”
代码示例来源:origin: knowm/XChange
public static String adaptCurrencyPairToSymbol(CurrencyPair currencyPair) {
return currencyPair == null
? null
: currencyPair.base.getCurrencyCode() + currencyPair.counter.getCurrencyCode();
}
代码示例来源:origin: knowm/XChange
public static Currency fromLunoCurrency(String c) {
String in;
switch (c) {
case "XBT":
in = "BTC";
break;
default:
in = c;
}
return Currency.getInstance(in);
}
代码示例来源:origin: knowm/XChange
public static String adaptXchangeCurrency(Currency xchangeSymbol) {
if (xchangeSymbol == null) {
return null;
}
return xchangeSymbol.toString().toLowerCase();
}
代码示例来源:origin: knowm/XChange
/**
* @param currency
* @return
*/
public static String toSymbol(Currency currency) {
if (Currency.IOT.equals(currency)) {
return "IOTA";
}
return currency.getSymbol();
}
代码示例来源:origin: knowm/XChange
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 + "'");
}
代码示例来源:origin: knowm/XChange
@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);
}
代码示例来源:origin: knowm/XChange
@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;
}
代码示例来源:origin: knowm/XChange
public static int getMaxPriceScale(CurrencyPair currencyPair) {
if (currencyPair.base.equals(Currency.BTC) || currencyPair.base.equals(Currency.LTC)) {
return 5;
} else {
return 8;
}
}
代码示例来源:origin: knowm/XChange
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()));
}
代码示例来源:origin: knowm/XChange
public static String toSymbol(Currency currency) {
if (Currency.IOT.equals(currency)) {
return "IOTA";
}
return currency.getSymbol();
}
代码示例来源:origin: knowm/XChange
private boolean isIn(Currency currency, Currency[] currencies) {
for (Currency cur : currencies) if (cur.equals(currency)) return true;
return false;
}
}
代码示例来源:origin: knowm/XChange
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);
}
代码示例来源:origin: knowm/XChange
@Override
public String toString() {
return pair == null
? ""
: String.format("%s%s", pair.base.getCurrencyCode(), pair.counter.getCurrencyCode());
}
}
代码示例来源:origin: knowm/XChange
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);
}
}
代码示例来源:origin: knowm/XChange
public static String toPairString(CurrencyPair currencyPair) {
return currencyPair.base.toString().toLowerCase()
+ currencyPair.counter.toString().toLowerCase();
}
代码示例来源:origin: knowm/XChange
/**
* @param currency
* @return
*/
public static String toSymbol(Currency currency) {
if (Currency.IOT.equals(currency)) {
return "IOTA";
}
return currency.getSymbol();
}
代码示例来源:origin: knowm/XChange
@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);
}
代码示例来源:origin: knowm/XChange
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();
}
代码示例来源:origin: knowm/XChange
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();
}
}
代码示例来源:origin: knowm/XChange
@JsonCreator
public CoinbasePrice(
@JsonProperty("amount") BigDecimal amount, @JsonProperty("currency") String currency) {
this(amount, Currency.getInstance(currency));
}
内容来源于网络,如有侵权,请联系作者删除!