org.knowm.xchange.currency.Currency.getCommonlyUsedCurrency()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.knowm.xchange.currency.Currency.getCommonlyUsedCurrency()方法的一些代码示例,展示了Currency.getCommonlyUsedCurrency()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Currency.getCommonlyUsedCurrency()方法的具体详情如下:
包路径:org.knowm.xchange.currency.Currency
类名称:Currency
方法名:getCommonlyUsedCurrency

Currency.getCommonlyUsedCurrency介绍

[英]Gets the equivalent object that was created with the "commonly used" code.
[中]获取使用“常用”代码创建的等效对象。

代码示例

代码示例来源:origin: knowm/XChange

  1. public static Currency translateHuobiCurrencyCode(String currencyIn) {
  2. Currency currencyOut = assetMap.get(currencyIn);
  3. if (currencyOut == null) {
  4. logger.error("Huobi does not support the currency code " + currencyIn);
  5. return null;
  6. }
  7. return currencyOut.getCommonlyUsedCurrency();
  8. }

代码示例来源:origin: knowm/XChange

  1. public static String toLunoCurrency(Currency c) {
  2. String in = c.getCommonlyUsedCurrency().getCurrencyCode();
  3. switch (in) {
  4. case "BTC":
  5. return "XBT";
  6. default:
  7. return in;
  8. }
  9. }

代码示例来源:origin: knowm/XChange

  1. public static Currency translateKrakenCurrencyCode(String currencyIn) {
  2. Currency currencyOut = assetsMap.get(currencyIn);
  3. if (currencyOut == null) {
  4. throw new ExchangeException("Kraken does not support the currency code " + currencyIn);
  5. }
  6. return currencyOut.getCommonlyUsedCurrency();
  7. }

代码示例来源:origin: knowm/XChange

  1. public static CurrencyPair translateHuobiCurrencyPair(String currencyPairIn) {
  2. CurrencyPair pair = assetPairMap.get(currencyPairIn);
  3. if (pair == null) {
  4. if (currencyPairIn.length() == 6) {
  5. Currency base = Currency.getInstance(currencyPairIn.substring(0, 3));
  6. if (base.getCommonlyUsedCurrency() != null) {
  7. base = base.getCommonlyUsedCurrency();
  8. }
  9. Currency counter = Currency.getInstance(currencyPairIn.substring(3, 6));
  10. if (counter.getCommonlyUsedCurrency() != null) {
  11. counter = counter.getCommonlyUsedCurrency();
  12. }
  13. pair = new CurrencyPair(base, counter);
  14. } else if (currencyPairIn.length() == 7) {
  15. Currency base = Currency.getInstance(currencyPairIn.substring(0, 4));
  16. if (base.getCommonlyUsedCurrency() != null) {
  17. base = base.getCommonlyUsedCurrency();
  18. }
  19. Currency counter = Currency.getInstance(currencyPairIn.substring(4, 7));
  20. if (counter.getCommonlyUsedCurrency() != null) {
  21. counter = counter.getCommonlyUsedCurrency();
  22. }
  23. pair = new CurrencyPair(base, counter);
  24. }
  25. }
  26. return pair;
  27. }
  28. }

代码示例来源:origin: knowm/XChange

  1. public static CurrencyPair translateKrakenCurrencyPair(String currencyPairIn) {
  2. CurrencyPair pair = assetPairMap.get(currencyPairIn);
  3. if (pair == null) {
  4. // kraken can give short pairs back from open orders ?
  5. if (currencyPairIn.length() == 6) {
  6. Currency base = Currency.getInstance(currencyPairIn.substring(0, 3));
  7. if (base.getCommonlyUsedCurrency() != null) {
  8. base = base.getCommonlyUsedCurrency();
  9. }
  10. Currency counter = Currency.getInstance(currencyPairIn.substring(3, 6));
  11. if (counter.getCommonlyUsedCurrency() != null) {
  12. counter = counter.getCommonlyUsedCurrency();
  13. }
  14. pair = new CurrencyPair(base, counter);
  15. } else if (currencyPairIn.length() == 7) {
  16. Currency base = Currency.getInstance(currencyPairIn.substring(0, 4));
  17. if (base.getCommonlyUsedCurrency() != null) {
  18. base = base.getCommonlyUsedCurrency();
  19. }
  20. Currency counter = Currency.getInstance(currencyPairIn.substring(4, 7));
  21. if (counter.getCommonlyUsedCurrency() != null) {
  22. counter = counter.getCommonlyUsedCurrency();
  23. }
  24. pair = new CurrencyPair(base, counter);
  25. }
  26. }
  27. return pair;
  28. }

代码示例来源:origin: knowm/XChange

  1. public static CurrencyPair translateBitmexCurrencyPair(String currencyPairIn) {
  2. CurrencyPair pair = assetPairMap.get(currencyPairIn);
  3. if (pair == null) {
  4. // bitmex can give short pairs back from open orders ?
  5. if (currencyPairIn.length() == 6) {
  6. Currency base = Currency.getInstance(currencyPairIn.substring(0, 3));
  7. if (base.getCommonlyUsedCurrency() != null) {
  8. base = base.getCommonlyUsedCurrency();
  9. }
  10. Currency counter = Currency.getInstance(currencyPairIn.substring(3, 6));
  11. if (counter.getCommonlyUsedCurrency() != null) {
  12. counter = counter.getCommonlyUsedCurrency();
  13. }
  14. pair = new CurrencyPair(base, counter);
  15. } else if (currencyPairIn.length() == 7) {
  16. Currency base = Currency.getInstance(currencyPairIn.substring(0, 4));
  17. if (base.getCommonlyUsedCurrency() != null) {
  18. base = base.getCommonlyUsedCurrency();
  19. }
  20. Currency counter = Currency.getInstance(currencyPairIn.substring(4, 7));
  21. if (counter.getCommonlyUsedCurrency() != null) {
  22. counter = counter.getCommonlyUsedCurrency();
  23. }
  24. pair = new CurrencyPair(base, counter);
  25. }
  26. }
  27. return pair;
  28. }

代码示例来源:origin: knowm/XChange

  1. public static Currency translateBitmexCurrencyCode(String currencyIn) {
  2. Currency currencyOut = assetsMap.get(currencyIn);
  3. if (currencyOut == null) {
  4. throw new ExchangeException("Bitmex does not support the currency code " + currencyIn);
  5. }
  6. return currencyOut.getCommonlyUsedCurrency();
  7. }

代码示例来源:origin: knowm/XChange

  1. public static Wallet adaptWallet(IndependentReserveBalance independentReserveBalance) {
  2. List<Balance> balances = new ArrayList<>();
  3. for (IndependentReserveAccount balanceAccount :
  4. independentReserveBalance.getIndependentReserveAccounts()) {
  5. Currency currency = Currency.getInstance(balanceAccount.getCurrencyCode().toUpperCase());
  6. balances.add(
  7. new Balance(
  8. currency.getCommonlyUsedCurrency(),
  9. balanceAccount.getTotalBalance(),
  10. balanceAccount.getAvailableBalance()));
  11. }
  12. return new Wallet(balances);
  13. }

代码示例来源:origin: org.knowm.xchange/xchange-kraken

  1. public static Currency translateKrakenCurrencyCode(String currencyIn) {
  2. Currency currencyOut = assetsMap.get(currencyIn);
  3. if (currencyOut == null) {
  4. throw new ExchangeException("Kraken does not support the currency code " + currencyIn);
  5. }
  6. return currencyOut.getCommonlyUsedCurrency();
  7. }

代码示例来源:origin: org.knowm.xchange/xchange-kraken

  1. public static CurrencyPair translateKrakenCurrencyPair(String currencyPairIn) {
  2. CurrencyPair pair = assetPairMap.get(currencyPairIn);
  3. if (pair == null) {
  4. // kraken can give short pairs back from open orders ?
  5. if (currencyPairIn.length() == 6) {
  6. Currency base = Currency.getInstance(currencyPairIn.substring(0, 3));
  7. if (base.getCommonlyUsedCurrency() != null) {
  8. base = base.getCommonlyUsedCurrency();
  9. }
  10. Currency counter = Currency.getInstance(currencyPairIn.substring(3, 6));
  11. if (counter.getCommonlyUsedCurrency() != null) {
  12. counter = counter.getCommonlyUsedCurrency();
  13. }
  14. pair = new CurrencyPair(base, counter);
  15. } else if (currencyPairIn.length() == 7) {
  16. Currency base = Currency.getInstance(currencyPairIn.substring(0, 4));
  17. if (base.getCommonlyUsedCurrency() != null) {
  18. base = base.getCommonlyUsedCurrency();
  19. }
  20. Currency counter = Currency.getInstance(currencyPairIn.substring(4, 7));
  21. if (counter.getCommonlyUsedCurrency() != null) {
  22. counter = counter.getCommonlyUsedCurrency();
  23. }
  24. pair = new CurrencyPair(base, counter);
  25. }
  26. }
  27. return pair;
  28. }

代码示例来源:origin: org.knowm.xchange/xchange-bitmex

  1. public static CurrencyPair translateBitmexCurrencyPair(String currencyPairIn) {
  2. CurrencyPair pair = assetPairMap.get(currencyPairIn);
  3. if (pair == null) {
  4. // bitmex can give short pairs back from open orders ?
  5. if (currencyPairIn.length() == 6) {
  6. Currency base = Currency.getInstance(currencyPairIn.substring(0, 3));
  7. if (base.getCommonlyUsedCurrency() != null) {
  8. base = base.getCommonlyUsedCurrency();
  9. }
  10. Currency counter = Currency.getInstance(currencyPairIn.substring(3, 6));
  11. if (counter.getCommonlyUsedCurrency() != null) {
  12. counter = counter.getCommonlyUsedCurrency();
  13. }
  14. pair = new CurrencyPair(base, counter);
  15. } else if (currencyPairIn.length() == 7) {
  16. Currency base = Currency.getInstance(currencyPairIn.substring(0, 4));
  17. if (base.getCommonlyUsedCurrency() != null) {
  18. base = base.getCommonlyUsedCurrency();
  19. }
  20. Currency counter = Currency.getInstance(currencyPairIn.substring(4, 7));
  21. if (counter.getCommonlyUsedCurrency() != null) {
  22. counter = counter.getCommonlyUsedCurrency();
  23. }
  24. pair = new CurrencyPair(base, counter);
  25. }
  26. }
  27. return pair;
  28. }

代码示例来源:origin: org.knowm.xchange/xchange-bitmex

  1. public static Currency translateBitmexCurrencyCode(String currencyIn) {
  2. Currency currencyOut = assetsMap.get(currencyIn);
  3. if (currencyOut == null) {
  4. throw new ExchangeException("Bitmex does not support the currency code " + currencyIn);
  5. }
  6. return currencyOut.getCommonlyUsedCurrency();
  7. }

相关文章