This library is written in Kotlin and provides the way to retrieve data from Coinpaprika.com API with ease.
- 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"/>
- Edit module's build.gradle file to attach the library by adding this line into it's dependencies
implementation 'com.coinpaprika:apiclient:$library_version'
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() })
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 */ }
CoinpaprikaAPI is available under the MIT license. See the LICENSE file for more info.