Coder Social home page Coder Social logo

cex-api-client's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.