Giter Site home page Giter Site logo

namjug-kim / reactive-crypto Goto Github PK

View Code? Open in Web Editor NEW
99.0 10.0 28.0 749 KB

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

License: Apache License 2.0

Kotlin 84.81% Java 15.19%
altcoin api bitcoin cryptocurrency binance bithumb upbit huobi okex kraken

reactive-crypto's Introduction



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

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.