Java library for bitbank.cc, Bitcoin exchange.
API document: https://docs.bitbank.cc/
Add the following dependency to your project's pom.xml
<repositories>
<repository>
<id>java-bitbankcc</id>
<url>https://github.com/bitbankinc/java-bitbankcc/tree/mvn-repo/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>cc.bitbank</groupId>
<artifactId>java-bitbankcc</artifactId>
<version>2.2.0</version>
</dependency>
</dependencies>
Or you can use .jar file here https://github.com/bitbankinc/java-bitbankcc/releases
Add the following dependency to your project's build.sbt
resolvers += "bitbankinc" at "https://raw.githubusercontent.com/bitbankinc/java-bitbankcc/mvn-repo/"
libraryDependencies ++= Seq(
"cc.bitbank" % "java-bitbankcc" % "2.2.0"
)
import cc.bitbank.Bitbankcc;
import cc.bitbank.entity.*;
import cc.bitbank.entity.enums.*;
Bitbankcc bb = new Bitbankcc();
Ticker ticker = bb.getTicker(CurrencyPair.BTC_JPY);
Depth depth = bb.getDepth(CurrencyPair.BTC_JPY);
Transaction[] ts = bb.getTransaction(CurrencyPair.BTC_JPY).transactions;
Transaction[] ts2 = bb.getTransaction(CurrencyPair.BTC_JPY, "20170410").transactions;
List<Ohlcv> ohlcvs = bb.getCandlestick(CurrencyPair.BTC_JPY, CandleType._1DAY, "2017").candlestick[0].getOhlcvList();
CircuitBreakInfo cbi = bb.getCircuitBreakInfo(CurrencyPair.BTC_JPY);
Private api requires API_KEY and API_SECRET. https://bitbank.cc/account/api
Bitbankcc bb = new Bitbankcc();
bb.setKey("YOUR_API_KEY", "YOUR_API_SECRET");
// use requestTime method(default)
bb.setAuthMethod("requestTime");
bb.setTimeWindow(5000); // optional
// use nonce method
bb.setAuthMethod("nonce");
Assets as = bb.getAsset();
Order order = bb.getOrder(CurrencyPair.BTC_JPY, 90956209);
long[] ids = {90956209, 90951996};
Orders orders = bb.getOrders(CurrencyPair.BTC_JPY, ids);
System.out.println(orders.orders[0]);
System.out.println(orders.orders[1]);
Order order = bb.sendOrder(CurrencyPair.BTC_JPY, 130000, BigDecimal.valueOf(0.01), OrderSide.BUY, OrderType.LIMIT);
Order order = bb.cancelOrder(CurrencyPair.BTC_JPY, 129781978);
long[] ids = {129830841, 129830734};
Orders orders = bb.cancelOrders(CurrencyPair.BTC_JPY, ids);
System.out.println(orders.orders[0]);
Option's parameter can be seen in document page
Map<String, Long> option = new HashMap<String, Long>();
option.put("count", 1L);
option.put("since", 1490348550380L);
Orders orders = bb.getActiveOrders(CurrencyPair.BTC_JPY, option);
for(Order o : orders.orders) {
System.out.println(o);
}
Option's parameter can be seen in document page
Map<String, String> option = new HashMap<String, String>();
option.put("count", "1");
option.put("since", "1490348550380");
DepositHistory history = bb.getDepositHistory("btc", option);
for(Deposit d : history.deposits) {
System.out.println(d);
}
Accounts accounts = bb.getWithdrawalAccounts("btc");
for(Accounts.Account a : accounts.accounts) {
System.out.println(a);
}
You should set "otpToken" or "smsToken".
Withdraw w = bb.requestWithdraw("btc", "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX", BigDecimal.valueOf(0.005), "867005", "");
Option's parameter can be seen in document page
Map<String, String> option = new HashMap<String, String>();
option.put("count", "1");
option.put("since", "1490348550380");
WithdrawalHistory history = bb.getWithdrawalHistory("btc", option);
for(Withdraw w : history.withdrawals) {
System.out.println(w);
}
Bitbankcc bb = new Bitbankcc();
try {
bb.getTicker(CurrencyPair.BTC_JPY);
} catch (BitbankException e) {
// bitbank API error. https://docs.bitbank.cc/error_code
System.out.println(e.code);
} catch (Exception e) {
// other error
}