本文整理了Java中org.knowm.xchange.currency.Currency.getCommonlyUsedCurrency()
方法的一些代码示例,展示了Currency.getCommonlyUsedCurrency()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Currency.getCommonlyUsedCurrency()
方法的具体详情如下:
包路径:org.knowm.xchange.currency.Currency
类名称:Currency
方法名:getCommonlyUsedCurrency
[英]Gets the equivalent object that was created with the "commonly used" code.
[中]获取使用“常用”代码创建的等效对象。
代码示例来源:origin: knowm/XChange
public static Currency translateHuobiCurrencyCode(String currencyIn) {
Currency currencyOut = assetMap.get(currencyIn);
if (currencyOut == null) {
logger.error("Huobi does not support the currency code " + currencyIn);
return null;
}
return currencyOut.getCommonlyUsedCurrency();
}
代码示例来源:origin: knowm/XChange
public static String toLunoCurrency(Currency c) {
String in = c.getCommonlyUsedCurrency().getCurrencyCode();
switch (in) {
case "BTC":
return "XBT";
default:
return in;
}
}
代码示例来源:origin: knowm/XChange
public static Currency translateKrakenCurrencyCode(String currencyIn) {
Currency currencyOut = assetsMap.get(currencyIn);
if (currencyOut == null) {
throw new ExchangeException("Kraken does not support the currency code " + currencyIn);
}
return currencyOut.getCommonlyUsedCurrency();
}
代码示例来源:origin: knowm/XChange
public static CurrencyPair translateHuobiCurrencyPair(String currencyPairIn) {
CurrencyPair pair = assetPairMap.get(currencyPairIn);
if (pair == null) {
if (currencyPairIn.length() == 6) {
Currency base = Currency.getInstance(currencyPairIn.substring(0, 3));
if (base.getCommonlyUsedCurrency() != null) {
base = base.getCommonlyUsedCurrency();
}
Currency counter = Currency.getInstance(currencyPairIn.substring(3, 6));
if (counter.getCommonlyUsedCurrency() != null) {
counter = counter.getCommonlyUsedCurrency();
}
pair = new CurrencyPair(base, counter);
} else if (currencyPairIn.length() == 7) {
Currency base = Currency.getInstance(currencyPairIn.substring(0, 4));
if (base.getCommonlyUsedCurrency() != null) {
base = base.getCommonlyUsedCurrency();
}
Currency counter = Currency.getInstance(currencyPairIn.substring(4, 7));
if (counter.getCommonlyUsedCurrency() != null) {
counter = counter.getCommonlyUsedCurrency();
}
pair = new CurrencyPair(base, counter);
}
}
return pair;
}
}
代码示例来源:origin: knowm/XChange
public static CurrencyPair translateKrakenCurrencyPair(String currencyPairIn) {
CurrencyPair pair = assetPairMap.get(currencyPairIn);
if (pair == null) {
// kraken can give short pairs back from open orders ?
if (currencyPairIn.length() == 6) {
Currency base = Currency.getInstance(currencyPairIn.substring(0, 3));
if (base.getCommonlyUsedCurrency() != null) {
base = base.getCommonlyUsedCurrency();
}
Currency counter = Currency.getInstance(currencyPairIn.substring(3, 6));
if (counter.getCommonlyUsedCurrency() != null) {
counter = counter.getCommonlyUsedCurrency();
}
pair = new CurrencyPair(base, counter);
} else if (currencyPairIn.length() == 7) {
Currency base = Currency.getInstance(currencyPairIn.substring(0, 4));
if (base.getCommonlyUsedCurrency() != null) {
base = base.getCommonlyUsedCurrency();
}
Currency counter = Currency.getInstance(currencyPairIn.substring(4, 7));
if (counter.getCommonlyUsedCurrency() != null) {
counter = counter.getCommonlyUsedCurrency();
}
pair = new CurrencyPair(base, counter);
}
}
return pair;
}
代码示例来源:origin: knowm/XChange
public static CurrencyPair translateBitmexCurrencyPair(String currencyPairIn) {
CurrencyPair pair = assetPairMap.get(currencyPairIn);
if (pair == null) {
// bitmex can give short pairs back from open orders ?
if (currencyPairIn.length() == 6) {
Currency base = Currency.getInstance(currencyPairIn.substring(0, 3));
if (base.getCommonlyUsedCurrency() != null) {
base = base.getCommonlyUsedCurrency();
}
Currency counter = Currency.getInstance(currencyPairIn.substring(3, 6));
if (counter.getCommonlyUsedCurrency() != null) {
counter = counter.getCommonlyUsedCurrency();
}
pair = new CurrencyPair(base, counter);
} else if (currencyPairIn.length() == 7) {
Currency base = Currency.getInstance(currencyPairIn.substring(0, 4));
if (base.getCommonlyUsedCurrency() != null) {
base = base.getCommonlyUsedCurrency();
}
Currency counter = Currency.getInstance(currencyPairIn.substring(4, 7));
if (counter.getCommonlyUsedCurrency() != null) {
counter = counter.getCommonlyUsedCurrency();
}
pair = new CurrencyPair(base, counter);
}
}
return pair;
}
代码示例来源:origin: knowm/XChange
public static Currency translateBitmexCurrencyCode(String currencyIn) {
Currency currencyOut = assetsMap.get(currencyIn);
if (currencyOut == null) {
throw new ExchangeException("Bitmex does not support the currency code " + currencyIn);
}
return currencyOut.getCommonlyUsedCurrency();
}
代码示例来源:origin: knowm/XChange
public static Wallet adaptWallet(IndependentReserveBalance independentReserveBalance) {
List<Balance> balances = new ArrayList<>();
for (IndependentReserveAccount balanceAccount :
independentReserveBalance.getIndependentReserveAccounts()) {
Currency currency = Currency.getInstance(balanceAccount.getCurrencyCode().toUpperCase());
balances.add(
new Balance(
currency.getCommonlyUsedCurrency(),
balanceAccount.getTotalBalance(),
balanceAccount.getAvailableBalance()));
}
return new Wallet(balances);
}
代码示例来源:origin: org.knowm.xchange/xchange-kraken
public static Currency translateKrakenCurrencyCode(String currencyIn) {
Currency currencyOut = assetsMap.get(currencyIn);
if (currencyOut == null) {
throw new ExchangeException("Kraken does not support the currency code " + currencyIn);
}
return currencyOut.getCommonlyUsedCurrency();
}
代码示例来源:origin: org.knowm.xchange/xchange-kraken
public static CurrencyPair translateKrakenCurrencyPair(String currencyPairIn) {
CurrencyPair pair = assetPairMap.get(currencyPairIn);
if (pair == null) {
// kraken can give short pairs back from open orders ?
if (currencyPairIn.length() == 6) {
Currency base = Currency.getInstance(currencyPairIn.substring(0, 3));
if (base.getCommonlyUsedCurrency() != null) {
base = base.getCommonlyUsedCurrency();
}
Currency counter = Currency.getInstance(currencyPairIn.substring(3, 6));
if (counter.getCommonlyUsedCurrency() != null) {
counter = counter.getCommonlyUsedCurrency();
}
pair = new CurrencyPair(base, counter);
} else if (currencyPairIn.length() == 7) {
Currency base = Currency.getInstance(currencyPairIn.substring(0, 4));
if (base.getCommonlyUsedCurrency() != null) {
base = base.getCommonlyUsedCurrency();
}
Currency counter = Currency.getInstance(currencyPairIn.substring(4, 7));
if (counter.getCommonlyUsedCurrency() != null) {
counter = counter.getCommonlyUsedCurrency();
}
pair = new CurrencyPair(base, counter);
}
}
return pair;
}
代码示例来源:origin: org.knowm.xchange/xchange-bitmex
public static CurrencyPair translateBitmexCurrencyPair(String currencyPairIn) {
CurrencyPair pair = assetPairMap.get(currencyPairIn);
if (pair == null) {
// bitmex can give short pairs back from open orders ?
if (currencyPairIn.length() == 6) {
Currency base = Currency.getInstance(currencyPairIn.substring(0, 3));
if (base.getCommonlyUsedCurrency() != null) {
base = base.getCommonlyUsedCurrency();
}
Currency counter = Currency.getInstance(currencyPairIn.substring(3, 6));
if (counter.getCommonlyUsedCurrency() != null) {
counter = counter.getCommonlyUsedCurrency();
}
pair = new CurrencyPair(base, counter);
} else if (currencyPairIn.length() == 7) {
Currency base = Currency.getInstance(currencyPairIn.substring(0, 4));
if (base.getCommonlyUsedCurrency() != null) {
base = base.getCommonlyUsedCurrency();
}
Currency counter = Currency.getInstance(currencyPairIn.substring(4, 7));
if (counter.getCommonlyUsedCurrency() != null) {
counter = counter.getCommonlyUsedCurrency();
}
pair = new CurrencyPair(base, counter);
}
}
return pair;
}
代码示例来源:origin: org.knowm.xchange/xchange-bitmex
public static Currency translateBitmexCurrencyCode(String currencyIn) {
Currency currencyOut = assetsMap.get(currencyIn);
if (currencyOut == null) {
throw new ExchangeException("Bitmex does not support the currency code " + currencyIn);
}
return currencyOut.getCommonlyUsedCurrency();
}
内容来源于网络,如有侵权,请联系作者删除!