Giter VIP home page Giter VIP logo

coinpaprika-api-kotlin-client's Introduction

Coinpaprika API Kotlin Client

Version Travis-ci License Platform Kotlin 1.2.71

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(this)
            .tickers()
            .subscribeOn(Schedulers.newThread())
            .observeOn(AndroidSchedulers.mainThread())
            .doOnError { error -> error.printStackTrace() }
            .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 */ }

Graph API

In order to request the cryptocurrency graph (.svg) instantiate graph client and proceed with the call:

GraphsAPI(this)
            .chartSvg("unique_cryptocurrency_id", GraphPeriods.DAILY.period)
            .subscribeOn(Schedulers.newThread())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(
                { next -> Log.i("ExampleActivity", "Example SVG file: $next") },
                { error -> error.printStackTrace() })

License

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

coinpaprika-api-kotlin-client's People

Contributors

piotrkst avatar

Watchers

 avatar  avatar  avatar

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.