return new Trades(tradeList, lastTid, TradeSortType.SortByTimestamp);
}
public static AccountInfo adaptAccountInfo(OkCoinUserInfo userInfo) {
OkCoinFunds funds = userInfo.getInfo().getFunds();
// depending on china or international version
boolean is_cny = funds.getFree().containsKey("cny");
Wallet base = null;
Wallet baseLoan = null;
if (is_cny) {
base = new Wallet(CNY, funds.getFree().get("cny").add(funds.getFreezed().get("cny")).subtract(getOrZero("cny", funds.getBorrow())), "available");
baseLoan = new Wallet(CNY, getOrZero("cny", funds.getBorrow()), "loan");
}
else {
base = new Wallet(USD, funds.getFree().get("usd").add(funds.getFreezed().get("usd")).subtract(getOrZero("usd", funds.getBorrow())), "available");
baseLoan = new Wallet(USD, getOrZero("usd", funds.getBorrow()), "loan");
}
Wallet btc = new Wallet(BTC, funds.getFree().get("btc").add(funds.getFreezed().get("btc")).subtract(getOrZero("btc", funds.getBorrow())), "available");
Wallet ltc = new Wallet(LTC, funds.getFree().get("ltc").add(funds.getFreezed().get("ltc")).subtract(getOrZero("ltc", funds.getBorrow())), "available");
// loaned wallets
Wallet btcLoan = new Wallet(BTC, getOrZero("btc", funds.getBorrow()), "loan");
Wallet ltcLoan = new Wallet(LTC, getOrZero("ltc", funds.getBorrow()), "loan");
List<Wallet> wallets = Arrays.asList(base, btc, ltc, baseLoan, btcLoan, ltcLoan);
return new AccountInfo(null, wallets);
}