Easily Monitor Cryptocurrency Prices Using Python And REST Services

There are thousands of public APIs available to serve our everyday needs. They span every imaginable category from weather forecasting to finance.

As the need for financial services grows, firms are coming up with innovative strategies to improve their client’s experience of their web and mobile applications. Companies are turning to both private and public APIs to achieve their development goals.

Financial institutions today utilize applications and software for virtually everything. APIs are indispensable tools that allow financial firms to facilitate their connectivity while at the same time improving service delivery.

One of the APIs that is gaining traction in the financial industry with the rising interest in cryptocurrencies is coinlayer. Let’s take a look and see what makes it tick, and how you can easily implement it to meet your needs.

What is coinlayer, and What Makes it Powerful?

 

apilayer, an Austrian technology company aiming to build a variety of reliable programming interfaces (APIs) and make them affordable for developers and startups built and maintains the coinlayer API. You can browse all of their available products here.

This article outlines coinlayer’s diverse API endpoints, available options, and integration guides for Python. It also takes a look at its interactive web-based dashboard (Jupyter Notebook), and desktop applications (Delphi).

 

Why Should You Use coinlayer to Provide Cryptocurrency Data?

coinlayer is extremely feature-rich. Here are some of its most significant benefits.

Real-Time & Historical Data:

Retrieve accurate live data and historical crypto rates all the way back to Bitcoin rates of 2011.

Bank-Level Security:

All data sent from and to the coinlayer API is secured via industry-standard 256-bit HTTPS encryption.

Uptime Service-Level-Agreement:

The coinlayer API is powered by a rock-solid distributed infrastructure and backed by an uptime SLA.

Fair Pricing Plans:

Make 500 monthly API calls for free — need more? Premium subscriptions start at only $9.99 monthly.

What Crypto Data Endpoints are Available via the API?

In total, the coinlayer API offers 6 API endpoints, each with different powerful functionalities. Here is a brief descripion:

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

 

How can I Access the coinlayer API?

First, get your API Credentials here, and set up your subscription plan:

 

API Access Key & Authentication

Next, to check if everything is working properly. Just run this URL in your web browser:

You see this API response:

HTTP GET Request Parameters for Live Data

ParameterDescription
access_key[Required] Your API access key.
target[optional] Specify your preferred target currency. You can view all available symbols on the Target Currencies page.
symbols[optional] Specify one or multiple (comma-separated) cryptocurrency symbols to be included in your API result. You can view all available values on the Available Cryptocurrencies page.
expand[optional] Set to 1 to receive extended results. Learn more about Extended Results.
callback[optional] Specify a JSONP callback function name according to the JSONP Callbacks section.

Descriptions of each Response Object

ObjectDescription
successReturns true or false depending on whether or not the given API request was successful.
termsReturns a URL leading to the coinlayer Terms of Service.
privacyReturns a URL leading to the coinlayer Privacy Policy.
timestampReturns the exact time (UTC timestamp) the given crypto data was collected.
targetReturns the default or specified target currency.
ratesReturns a JSON array containing the requested cryptocurrency data.

Common API errors

CodeTypeInfo
404404_not_foundThe requested resource does not exist.
101invalid_access_keyNo API Key was specified or an invalid API Key was specified.
102inactive_userThe account this API request is coming from is inactive.
103invalid_api_functionThe requested API endpoint does not exist.
104usage_limit_reachedThe maximum allowed API amount of monthly API requests has been reached.
105function_access_restrictedThe current subscription plan does not support this API endpoint.
106no_rates_availableThe current request did not return any results.
201invalid_target_currencyAn invalid target currency has been entered.
202invalid_currency_symbolsOne or more invalid symbols have been specified.
302invalid_dateAn invalid date has been specified [historical, convert].
403invalid_conversion_amountNo or an invalid amount has been specified [convert].
501no_timeframe_suppliedNo or an invalid timeframe has been specified [timeframe].
502invalid_start_dateNo or an invalid “start_date” has been specified [timeframe, change].
503invalid_end_dateNo or an invalid “end_date” has been specified [timeframe, change].
504invalid_time_frameAn invalid timeframe has been specified [timeframe, change].
505time_frame_too_longThe specified timeframe is too long, exceeding 365 days [timeframe, change].

How can I Track and Monitor Live Cryptocoin Prices with Python and coinlayer?

To get the latest crypto rates for all available cryptocurrencies use the following code to make an API request in Python:

Here are the API responses inside the Python IDE:

 

Here is the API response inside your Python IDE:

How can I Develop a Web-Based Cryptocoin Price Tracking and Monitoring System with coinlayer and Jupyter Notebook? 

You can easily build an interactive web-based Cryptocoin Live Price Tracker dashboard using the Python scripts in the previous section. All you need to do is run them inside Jupyter Notebook. If you have never used Jupyter Notebook before, visit the installation guide on the official website of Project Jupyter.

Here is the result:

 

Bonus: API Request using other Platform

How can I Make an API Request to coinlayer using the Delphi REST Debugger?

Download the Delphi REST Debugger here:

Choose the GET method, and send the request to the following URL:

 

 

 

Are You Ready to Build Your Own Live Cryptocoin Price Tracking and Monitoring System?

As you can see, the coinlayer REST API endpoint provides rich cryptocurrency data. You can connect this to any platform using any programming language you work with. 

Here is a basic demo explaining how you can access live cryptocurrency prices using the coinlayer REST API for scripting, web, and desktop-based applications. 

You can take advantage of the coinlayer free tier, but we recommend you upgrade your subscription plan for access to more powerful features. These include Conversion to All Target Currencies, More Extended Results, SSL Encryption, Time-Frame Endpoint, and many more! If you need a custom solution, contact us.

We can’t wait to see what you build with our REST API!

 

Head over and sign up for free to start integrating real-time cryptocurrency exchange rates data into your apps today!