Skip to content

This library provides convenient way to use Coinpaprika.com API in Android applications.

Notifications You must be signed in to change notification settings

kayth21/coinpaprika-api-kotlin-client

 
 

Repository files navigation

Coinpaprika API Kotlin Client

Version Travis-ci License Platform Kotlin 1.3.41

This library is written in Kotlin and provides the way to retrieve data from Coinpaprika.com API with ease.

Installation

  1. Add the following lines in your AndroidManifest.xml file
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
  1. Edit module's build.gradle file to attach the library by adding this line into it's dependencies
implementation 'com.coinpaprika:apiclient:$library_version'

Usage

Coinpaprika delivers full market data to the world of crypto: coin prices, volumes, market caps, ATHs, return rates and more.

Instantiate client and proceed with the call:

CoinpaprikaAPI(context)
            .tickers()
            .subscribeOn(Schedulers.newThread())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(
                { next -> for (ticker in next) {
                    i("ExampleActivity", "Ticker name is ${ticker.name} ")
                }},
                { error -> error.printStackTrace() })

Tickers

CoinpaprikaAPI(context).tickers()
    .doOnNext {
        for (ticker in it) {
            // ticker.id - Coin identifier, to use in ticker(id:) method
            // ticker.name - Coin name, for example Bitcoin
            // ticker.symbol - Coin symbol, for example BTC
            // ticker.rank - Position in Coinpaprika ranking (by MarketCap)
            // ticker.priceUsd - Price in USD
            // ticker.priceBtc - Price in BTC
            // ticker.dailyVolumeUsd - Volume from last 24h in USD
            // ticker.marketCapUsd - Market Capitalization in USD
            // ticker.circulatingSupply - Circulating Supply
            // ticker.totalSupply - Total Supply
            // ticker.maxSupply - Maximum Supply
            // ticker.percentChange1h - Percentage price change in last 1 hour
            // ticker.percentChange24h - Percentage price change in last 24 hours
            // ticker.percentChange7d - Percentage price change in last 7 days
        }
    }
    .doOnError { error -> /* handle an error */ }

License

CoinpaprikaAPI is available under the MIT license. See the LICENSE file for more info.

About

This library provides convenient way to use Coinpaprika.com API in Android applications.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Kotlin 100.0%