coineal-java-api is a lightweight Java library for interacting with the Coineal API
- getBalance
- createOrder
- getOpenOrders
- cancelOrder
- Install library into your Maven's local repository by running
mvn install - Add the following Maven dependency to your project's
pom.xml:
<dependency>
<groupId>com.github.mpawlucz.coineal</groupId>
<artifactId>coineal-java-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
CoinealApi api = new CoinealApi(ApiKey.builder()
.key("<YOUR-API-KEY>")
.secret("<YOUR-API-SECRET>")
.build()
);
BalanceResponse balance = api.getBalance();
BigDecimal summaryBtc = balance.getData().getSummaryBtc();
final TradeResponse trade = api.trade(TradeRequest.builder()
.base("ETH")
.quote("BTC")
.volume(new BigDecimal("0.01"))
.price(new BigDecimal("0.01"))
.isBuy(true)
.build()
);
if (!trade.isSuccess()){
throw new RuntimeException("Create order failed: " + trade.getMsg());
}
System.out.println(trade.getData().getOrderId());