Skip to content

πŸ’²πŸ“ˆA Kotlin/Java library for cryptocurrency trading. Supporting REST Api and WebSockets non-blocking client base on Reactor Netty

License

Notifications You must be signed in to change notification settings

namjug-kim/reactive-crypto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

68ea885 Β· May 19, 2021
Jun 23, 2019
May 5, 2019
Jun 9, 2019
May 25, 2020
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
May 19, 2021
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
Jan 31, 2021
Jul 2, 2019
May 3, 2019
Jan 15, 2021
Apr 16, 2021
May 3, 2019
May 3, 2019
May 3, 2019
Jan 15, 2021

Repository files navigation



Reactive Crypto

Kotlin CircleCI codecov jitpack ktlint

A Kotlin library for cryptocurrency trading.

Supported Exchanges

Websocket

Support public market feature (tickData, orderBook)

logo name ExchangeVendor ver doc
binance Binance BINANCE * ws
upbit Upbit UPBIT v1.0.3 ws
huobi_global Huobi Global HUOBI_GLOBAL * ws
huobi korea Huobi Korea HUOBI_KOREA * ws
huobi_japan Huobi Japan HUOBI_JAPAN * ws
okex Okex OKEX v3 ws
okex_korea Okex Korea OKEX_KOREA v3 ws
unicornx UnicornX UNICORNX v3 ws
hubi Hubi HUBI * ws
bitmex Bitmex BITMEX * ws
kraken Kraken KRAKEN 0.1.1 ws
bitmax Bitmax BITMAX v1.2 ws
coineal Coineal COINEAL ⚠️ ⚠️
poloniex Poloniex POLONIEX * ws
bitstamp Bitstamp BITSTAMP v2 ws
korbotex Korbot EX KOTBOTEX v3 ws
coinall Coinall COINALL v3 ws
bhex Bhex BHEX v1 ws
bitz Bit-Z BITZ * ws
idax Idax IDAX closed ws
bithumb Bithumb BITHUMB deprecated ⚠️

⚠️ : Uses endpoints that are used by the official web. This is not an official api and should be used with care.

Api

Exchange ver doc

Install

Maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

Step 1. Add jitpack repository

<dependency>
    <groupId>com.github.namjug-kim.reactive-crypto</groupId>
    <artifactId>reactive-crypto-{exchange-name}</artifactId>
    <version>LATEST</version>
</dependency>

Step 2. Add the dependency

Gradle

repositories {
	...
	maven { url 'https://jitpack.io' }
}

Step 1. Add jitpack repository

dependencies {
    implementation 'com.github.namjug-kim.reactive-crypto:reactive-crypto-{exchange-name}:LATEST'
}

Step 2. Add the dependency

Usage

Kotlin

fun websocketTickDataExample() {
    // create websocketClient for each crypto currency exchange
    val websocketClient = ExchangeClientFactory.websocket(ExchangeVendor.BINANCE)
    
    websocketClient.createTradeWebsocket(listOf(CurrencyPair(BTC, USDT)))
                   .doOnNext { log.info { "new tick data $it" } }
                   .subscribe()
}

fun httpLimitOrderExample() {
    val orderPlaceResult = ExchangeClientFactory.http(ExchangeVendor.BINANCE)
                .privateApi("accessKey", "secretKey")
                .order()
                .limitOrder(
                    CurrencyPair(Currency.BTC, Currency.KRW),
                    TradeSideType.BUY,
                    BigDecimal.valueOf(10000000.0),
                    BigDecimal.valueOf(10.0)
                )
                .block()

    log.info { orderPlaceResult }
}

Java

class SampleClass {
    public void websocketTickDataExample() {
        // create websocketClient for each crypto currency exchange
        ExchangeWebsocketClient exchangeWebsocketClient = ExchangeClientFactory.websocket(ExchangeVendor.BINANCE);
         
        List<CurrencyPair> targetPairs = Collections.singletonList(CurrencyPair.parse("BTC", "USDT"));
        exchangeWebsocketClient.createTradeWebsocket(targetPairs)
                               .doOnNext(tickData -> log.info("new tick data {}", tickData))
                               .subscribe();
    }

    public void httpLimitOrderExample() {
        OrderPlaceResult orderPlaceResult = ExchangeClientFactory.http(ExchangeVendor.BINANCE)
                        .privateApi("accessKey", "secretKey")
                        .order()
                        .limitOrder(
                            CurrencyPair(Currency.BTC, Currency.KRW),
                            TradeSideType.BUY,
                            BigDecimal.valueOf(10000000.0),
                            BigDecimal.valueOf(10.0)
                        )
                        .block();

        log.info("{}", orderPlaceResult);
    }

}

πŸ’¬ Contributing

πŸ“œ License