Skip to content

REST API Java wrapper for bitforex.com cryptocurrency exchange

License

Notifications You must be signed in to change notification settings

mpawlucz/bitforex-java-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bitforex Java API

bitforex-java-api is a lightweight Java library for interacting with the Bitforex API

Features

  • getBalance
  • createOrder
  • getOpenOrders
  • cancelOrder

Installation

  1. Install library into your Maven's local repository by running mvn install
  2. Add the following Maven dependency to your project's pom.xml:
<dependency>
    <groupId>com.github.mpawlucz.bitforex</groupId>
    <artifactId>bitforex-java-api</artifactId>
    <version>1.0-SNAPSHOT</version>
</dependency>

Example

getBalance

BitforexRestApi api = new BitforexRestApi(ApiKey.builder()
    .key("<YOUR-API-KEY>")
    .secret("<YOUR-API-SECRET>")
.build());

final BalanceResponse balance = api.getBalance();
if (balance.getSuccess()){
    for (BalanceEntry balanceEntry : balance.getData()) {
        if (balanceEntry.getTotal().compareTo(BigDecimal.ZERO) > 0){
            System.out.println(balanceEntry.getCurrency() + ": " + balanceEntry.getTotal());
        }
    }
} else {
    System.out.println("error: " + balance.getMessage());
}

createOrder

final TradeResponse trade = api.trade(TradeRequest.builder()
    .base("ETH")
    .quote("BTC")
    .volume(new BigDecimal("0.001"))
    .price(new BigDecimal("0.01"))
    .isBuy(true)
.build());
if (!trade.isSuccess()){
    throw new RuntimeException("Create order failed: " + trade.getMessage());
}
System.out.println(trade.getData().getOrderId());

About

REST API Java wrapper for bitforex.com cryptocurrency exchange

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages