@Override public IRateSource createRateSource(String sourceLogin) { if (sourceLogin != null && !sourceLogin.trim().isEmpty()) { StringTokenizer st = new StringTokenizer(sourceLogin, ":"); String exchangeType = st.nextToken(); if ("btce".equalsIgnoreCase(exchangeType)) { if (st.hasMoreTokens()) { return new BTCeRateSource(st.nextToken()); } return new BTCeRateSource(); } else if ("ltcfix".equalsIgnoreCase(exchangeType)) { BigDecimal rate = BigDecimal.ZERO; if (st.hasMoreTokens()) { try { rate = new BigDecimal(st.nextToken()); } catch (Throwable e) { } } String preferedFiatCurrency = ICurrencies.USD; if (st.hasMoreTokens()) { preferedFiatCurrency = st.nextToken(); } return new FixPriceRateSource(rate, preferedFiatCurrency); } } return null; }
@Override public IWallet createWallet(String walletLogin) { if (walletLogin != null && !walletLogin.trim().isEmpty()) { StringTokenizer st = new StringTokenizer(walletLogin, ":"); String walletType = st.nextToken(); if ("litecoind".equalsIgnoreCase(walletType)) { // "litecoind:protocol:user:password:ip:port:accountname" String protocol = st.nextToken(); String username = st.nextToken(); String password = st.nextToken(); String hostname = st.nextToken(); String port = st.nextToken(); String accountName = ""; if (st.hasMoreTokens()) { accountName = st.nextToken(); } if (protocol != null && username != null && password != null && hostname != null && port != null && accountName != null) { String rpcURL = protocol + "://" + username + ":" + password + "@" + hostname + ":" + port; return new LitecoindRPCWallet(rpcURL, accountName); } } else if ("coinkite".equalsIgnoreCase(walletType)) { String apikey = st.nextToken(); String apiSecret = st.nextToken(); String accountNumber = "0"; if (st.hasMoreTokens()) { accountNumber = st.nextToken(); } return new CoinkiteWallet(apikey, apiSecret, accountNumber); } } return null; }