Unparalleled suite of productivity-boosting Web APIs & cloud-based micro-service applications for developers and companies of any size.

APICurrency

A Complete Guide On Cryptocurrency Development

The spread of the Internet and the development of technology every second have opened new doors to people’s lives. Especially in terms of investment, there have been great developments. Today, standardized foreign exchange and gold investments have started to give way to cryptocurrencies, which are virtual currencies. Cryptocurrencies are created every minute around the world and they serve their investors on various exchanges.

Cryptocurrency trading applications are increasing day by day. These applications, where millions of people simultaneously trade high-volume cryptocurrencies, generally use services that provide Real-time Crypto Currency Exchange Rates API services.

What is Coinlayer API

Serving the Crypto Currency Exchange API, Coinlayer API provides accurate exchange rate data for more than 385 cryptocurrencies in real time. Crypto data is collected from some of the largest cryptocurrency exchanges, requested using HTTP GET and returned in simple JSON format. It has aimed to maximize the availability, consistency and reliability of the crypto data returned by the coin layer API, thanks to an improved fallback algorithm.

The main reason why it is one of the most popular services in the field of coins is that it instantly provides up-to-date crypto exchange rate data for more than 385 cryptocurrencies collected from more than 25 exchanges.

The Coinlayer API not only transmits the most up-to-date data of hundreds of cryptocurrencies to its users in milliseconds, but also provides historical data to its users with its historical data service, allowing them to make analysis and statistics.

The 6 services provided by Coinlayer API are as follows.

  • Live Data: Query the API for the latest available exchange rate data.
  • Historical Data: Look up crypto rates for a specific date.
  • Conversion Endpoint: Convert amounts between cryptocurrencies and target currencies.
  • Time Frame Data: Query the API for crypto data in a specific period.
  • Change Data: Retrieve data about rate fluctuation in a specific period.
  • List Endpoint: Retrieve a list of all available cryptocurrencies and target currencies.

Testing Coinlayer API services with  Python Programming Language

Before proceeding with the testing of the Coinlayer API, a suitable package must be selected and registered on the coinlayer API website and an API key must be obtained to use this service.

Live Data

The coinlayer API’s live endpoint is used to get the latest crypto rates for all available or a specific set of cryptocurrencies.

Request:

import http.client

if __name__ == ‘__main__’:
  conn = http.client.HTTPSConnection(“api.coinlayer.com”)
  payload =
  headers = {}
  conn.request(“GET”, “/api/live?access_key=106*****13”, payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode(“utf-8”))

Response:

{
  “success”: true,
  “terms”: “https://coinlayer.com/terms”,
  “privacy”: “https://coinlayer.com/privacy”,
  “timestamp”: 1529571067,
  “target”: “USD”,
  “rates”: {
    “611”: 0.389165,
    “ABC”: 59.99,
    “ACP”: 0.014931,
    “ACT”: 0.15927,
    “ACT*”: 0.14371,
    “ADA”: 0.160502,
    “ADCN”: 0.001406,
    “ADL”: 121.5,
    “ADX”: 0.427854,
    “ADZ”: 0.02908,
    “AE”: 2.551479,
    “AGI”: 0.12555,
    “AIB”: 0.005626,
    “AIDOC”: 0.02605,
    […]
  }
}

Historical Data

The Coinlayer API allows querying historical crypto data up to 2011.

Request:

import http.client

if __name__ == ‘__main__’:
  conn = http.client.HTTPSConnection(“api.coinlayer.com”)
  payload =
  headers = {}
  conn.request(“GET”, “/api/2018-04-30?access_key=106*****13”, payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode(“utf-8”))

Response:

{
  “success”: true,
  “terms”: “https://coinlayer.com/terms”,
  “privacy”: “https://coinlayer.com/privacy”,
  “timestamp”: 1525132744,
  “target”: “USD”,
  “historical”: true,
  “date”: “2018-04-30”,
  “rates”: {
    “611”: 0.389165,
    “ABC”: 59.99,
    “ACP”: 0.014931,
    “ACT”: 0.37332,
    “ACT*”: 0.352401,
    “ADA”: 0.340976,
    “ADCN”: 0.003209,
    “ADL”: 121.551125,
    “ADX”: 1.074753,
    “ADZ”: 0.02168,
    “AE”: 4.423674,
    “AGI”: 0.22478,
    “AIB”: 0.005626,
    […]
  }
}

Conversion Endpoint

The Coinlayer API provides the service of converting any cryptocurrency by taking the ‘from’, ‘to’, and ‘amount’ parameters from its users.

Request:

import http.client

if __name__ == ‘__main__’:
  conn = http.client.HTTPSConnection(“api.coinlayer.com”)
  payload =
  headers = {}
  conn.request(“GET”, “/api/convert?access_key=106*****13&from=BTC&to=ETH&amount=10”, payload, headers)
  res = conn.getresponse()
  data = res.read()

  print(data.decode(“utf-8”))

Response:

{
  “success”: true,
  “terms”: “https://coinlayer.com/terms”,
  “privacy”: “https://coinlayer.com/privacy”,
  “query”: {
    “from”: “BTC”,
    “to”: “ETH”,
    “amount”: 10
  },
  “info”: {
    “timestamp”: 1529790006,
    “rate”: 12.960872
  },
  “result”: 129.60872
}

Time Frame Data

Using the Coinlayer API ‘timeframe’ endpoint, you can get time series crypto data between two dates of your choice.

Request:

import http.client

if __name__ == ‘__main__’:
  conn = http.client.HTTPSConnection(“api.coinlayer.com”)
  payload =
  headers = {}
  conn.request(“GET”, “/api/timeframe?access_key=106*****13&&start_date=2018-04-01&end_date=2018-04-30 &symbols=BTC,ETH”, payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode(“utf-8”))

Response:

{
  “success”: true,
  “terms”: “https://coinlayer.com/terms”,
  “privacy”: “https://coinlayer.com/privacy”,
  “timeframe”: true,
  “start_date”: “2018-04-01”,
  “end_date”: “2018-04-30”,
  “target”: “USD”,
  “rates”: {
    “2018-04-01”: {
      “BTC”: 6903.113849,
      “ETH”: 383.02749
    },
    “2018-04-02”: {
      “BTC”: 7111.72678,
      “ETH”: 387.273437
    },
    “2018-04-03”: {
      “BTC”: 7490.777653,
      “ETH”: 421.655884
    },
    […]
  }
}

Change Data

Using the Coinlayer API, fluctuation data can also be queried for any number of cryptocurrencies in a given period of time.

Request:

import http.client

if __name__ == ‘__main__’:
  conn = http.client.HTTPSConnection(“api.coinlayer.com”)
  payload =
  headers = {}
  conn.request(“GET”, “/api/change?access_key=106*****13&&start_date=2018-04-01&end_date=2018-04-30&symbols=BTC,ETH,XRP”, payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode(“utf-8”))

Response:

{
  “success”: true,
  “terms”: “https://coinlayer.com/terms”,
  “privacy”: “https://coinlayer.com/privacy”,
  “change”: true,
  “start_date”: “2018-04-01”,
  “end_date”: “2018-04-30”,
  “target”: “USD”,
  “rates”: {
    “BTC”: {
      “start_rate”: 6903.113849,
      “end_rate”: 9245.982724,
      “change”: 2342.86887,
      “change_pct”: 1.33939305
    },
    “ETH”: {
      “start_rate”: 383.02749,
      “end_rate”: 670.440229,
      “change”: 287.412739,
      “change_pct”: 1.75037105
    },
    “XRP”:{
      “start_rate”: 0.482917,
      “end_rate”: 0.831833,
      “change”: 0.348916,
      “change_pct”: 1.72251753
    }
  }
}

List Endpoint

The Coinlayer API can be used to list all available crypto and standard currencies. Available cryptocurrencies will be returned as objects containing additional details.

Request:

import http.client

if __name__ == ‘__main__’:
  conn = http.client.HTTPSConnection(“api.coinlayer.com”)
  payload =
  headers = {}
  conn.request(“GET”, “/api/list?access_key=106*****13”, payload, headers)
  res = conn.getresponse()
  data = res.read()
  print(data.decode(“utf-8”))

Response:

{
  “success”: true,
  “crypto”: {
    “611”: {
      “symbol”: “611”,
      “name”: “SixEleven”,
      “name_full”: “SixEleven (611)”,
      “max_supply”: 611000,
      “icon_url”: “https://assets.coinlayer.com/icons/611.png”
    },
    “ABC”: {
      “symbol”: “ABC”,
      “name”: “AB-Chain”,
      “name_full”: “AB-Chain (ABC)”,
      “max_supply”: 210000000,
      “icon_url”: “https://assets.coinlayer.com/icons/ABC.png”
    },
    […]
  },
  “fiat”: {
    “AED”: “United Arab Emirates Dirham”,
    “AFN”: “Afghan Afghani”,
    “ALL”: “Albanian Lek”,
    “AMD”: “Armenian Dram”,
    “ANG”: “Netherlands Antillean Guilder”,
    “AOA”: “Angolan Kwanza”,
    […]
  }
}

Conclusion

Coinlayer API, which provides Crypto Currency Exchange API, provides instantaneous hundreds of cryptocurrency data in just milliseconds. You can maximize the transaction volume of your business with the Coinlayer API that you will use in your applications.

Related posts
API

How To Create A Weather App For Windows And Mobile Using An API

API

The 5 Types of API Marketplaces

API

Building Your Own Geolocation App with IP Geolocation API

APIIPLocation

What Is Geoblocking And How Does It Work?

Leave a Reply

Your email address will not be published. Required fields are marked *