Skip to content

cmorgner/cex-api-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

cex-api-client

A simple API client for CEX.IO written in Java.

Author

Christian Morgner
[email protected]

JAR releases

Download the JAR file of the latest release below and register it as a library in your own project:

Alternative: clone & build
git clone https://github.com/cmorgner/cex-api-client.git
mvn clean install

Example code

import com.morgner.cex.api.Amount;
import com.morgner.cex.api.Balance;
import com.morgner.cex.api.Order;
import com.morgner.cex.api.OrderType;
import com.morgner.cex.api.Pair;
import java.io.IOException;

/**
 *
 * @author Christian Morgner
 */
public class Example {

	public static void main(final String[] args) {
		
		final String username  = "";	// your username here
		final String apiKey    = "";	// your API key here
		final String apiSecret = "";	// your API secret here
		
		final CexClient client = new CexClient(username, apiKey, apiSecret);

		try {
			
			
			// fetch balance
			final Balance myBalance = client.getBalance();
			final Amount btc        = myBalance.getBTC();
			
			System.out.println("My BTC balance: " + (btc.getAvailable() + btc.getOrders()));
			System.out.println("BTC available:  " + btc.getAvailable());
			System.out.println("BTC in orders:  " + btc.getOrders());

			
			
			// place order
			final Order order = client.placeOrder(Pair.GHS_BTC, OrderType.Buy, 1.0, 0.0001);
			System.out.println("Placed order: " + order);
			
			
			// cancel order
			client.cancelOrder(order);
			
			
			
		} catch (IOException ioex) {
			ioex.printStackTrace();
		}
	}
}

Donations

If you like this API client and want to show your support, feel free to send your BTC donations to
1694QjV4mYJZfNX6pm6t2QtDT3srjHCtjE

About

A Java API client for CEX.IO

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages