Package to fetch cryptocurrency price, market value, assets etc. using coincap API endpoints

Overview

cryptocap-pkg

Package to fetch cryptocurrency price, market value, assets etc. using coincap API endpoints. This package was developed to work with coincap api which has useful tool for real-time pricing and market activity for over 1,000 cryptocurrencies. By collecting exchange data from thousands of markets, it also offer transparent and accurate data on asset price and availability.

For all endpoints, a single page offers 100 responses by default and supports up to 2,000 responses per page upon requests.

With this package, you don't have to bother about connecting to the endpoints, it has already be taken care of by the package facades class. To get response from the enpoints, you have to just use the related facade class which will output the response in json format.

Installation

Run this composer command to install the package

composer require wisdom-diala/cryptocap-pkg

After installing add the provider and the aliase on config/app.php

// Provider 
WisdomDiala\Cryptocap\Providers\CryptocapServiceProvider::class,
// Aliase
'Cryptocap' => WisdomDiala\Cryptocap\Facades\Cryptocap::class,

Below are the facades you can use to fetch the coresponding data you may need from the coincap api.

Assets

The asset price is a volume-weighted average calculated by collecting ticker data from exchanges. Each exchange contributes to this price in relation to their volume, meaning higher volume exchanges have more affect on this global price. All values are translated into USD (United States Dollar) and can be translated into other units of measurement through the /rates endpoint.

Cryptocap::getAssets();

Response

{
  "data": [
    {
      "id": "bitcoin",
      "rank": "1",
      "symbol": "BTC",
      "name": "Bitcoin",
      "supply": "17193925.0000000000000000",
      "maxSupply": "21000000.0000000000000000",
      "marketCapUsd": "119150835874.4699281625807300",
      "volumeUsd24Hr": "2927959461.1750323310959460",
      "priceUsd": "6929.8217756835584756",
      "changePercent24Hr": "-0.8101417214350335",
      "vwap24Hr": "7175.0663247679233209"
    },
    {
      "id": "ethereum",
      "rank": "2",
      "symbol": "ETH",
      "name": "Ethereum",
      "supply": "101160540.0000000000000000",
      "maxSupply": null,
      "marketCapUsd": "40967739219.6612727047843840",
      "volumeUsd24Hr": "1026669440.6451482672850841",
      "priceUsd": "404.9774667045200896",
      "changePercent24Hr": "-0.0999626159535347",
      "vwap24Hr": "415.3288028454417241"
    },
   ]
 }

Response Data

Key Description
id unique identifier for asset
rank rank is in ascending order - this number is directly associated with the marketcap whereas the highest marketcap receives rank 1
symbol most common symbol used to identify this asset on an exchange
name proper name for asset
supply available supply for trading
maxSupply total quantity of asset issued
marketCapUsd supply x price
volumeUsd24Hr quantity of trading volume represented in USD over the last 24 hours
priceUsd volume-weighted price based on real-time market data, translated to USD
changePercent24Hr the direction and value change in the last 24 hours
vwap24Hr Volume Weighted Average Price in the last 24 hours

Coincap doc link for assets: https://docs.coincap.io/#89deffa0-ab03-4e0a-8d92-637a857d2c91

Limit Assets

This allows you to limit the number of result you get per request.

Cryptocap::getAssetsWithLimit(5);

Single Asset

This allows you to fetch a single asset using the asset ID

Cryptocap::getSingleAsset('ethereum');

Asset History

Cryptocap::getAssetHistory('ethereum', 'h2');

The first parameter is the id of the cryptocurrency and the second parameter is point-in-time interval. minute and hour intervals represent price at that time, the day interval represents average of 24 hour periods (timezone: UTC) Coincap asset history link: https://docs.coincap.io/#61e708a8-8876-4fb2-a418-86f12f308978

Asset Markets

Cryptocap::getAssetMarket($id = 'ethereum', $limit = 5);

Rates

Cryptocap::getRates();

Coincap rates doc link: https://docs.coincap.io/#2a87f3d4-f61f-42d3-97e0-3a9afa41c73b

Single Rate

Cryptocap::getSingleRate('bulgarian-lev');

Exchanges

Cryptocap::getExchanges();

Coincap exchanges doc link: https://docs.coincap.io/#e1c56fd0-d57a-40dd-8a24-4b0883b58cfb

Single Exchange

Cryptocap::getSingleExchanges('binance');

Markets

Cryptocap::getMarkets();

Coincap markets doc link: https://docs.coincap.io/#d8fd6001-e127-448d-aadd-bfbfe2c89dbe

Market by exchange ID

Cryptocap::getMarketByExchangeId($exchangeId = 'poloniex');

Market by quote symbol

Cryptocap::getMarketByQuoteSymbol($quoteSymbol = 'ETH');

Market by base ID

Cryptocap::getMarketByBaseId($baseId = 'bitcoin', $limit = 5);

Market by quote ID

Cryptocap::getMarketByQuoteId($quoteId = 'bitcoin', $limit = 5);

Market by asset symbol

Cryptocap::getMarketByAssetSymbol($assetSymbol = 'BTC', $limit = 5);

Market by asset ID

Cryptocap::getMarketByAssetId($assetId = 'bitcoin', $limit = 5);

Candles

Cryptocap::getCandles($exchange='poloniex', $interval='m1', $baseId='ethereum', $quoteId='bitcoin', $start=1528410925604, $end=1528411045607);

Coincap candles doc link: https://docs.coincap.io/#51da64d7-b83b-4fac-824f-3f06b6c8d944

You can get the full documentation and well detailed explanation of the parameters used on the facade on the link below. https://docs.coincap.io/#ee30bea9-bb6b-469d-958a-d3e35d442d7a

Video on how to use the package: https://youtu.be/a7odUpGSia8

If you really find this useful please give us a star.

You might also like...
This package generates API resources with keys preset to their respective table's columns
This package generates API resources with keys preset to their respective table's columns

Ever thought it was a bit tedious to define an API resource for a large table? This package makes life a bit simpler by presetting all columns in a Resource, so you can simply remove the ones you don't need, instead of adding the ones you need.

Laravel 8.x package wrapper library for Metatrader 5 Web API

Laravel 8.x package wrapper library for Metatrader 5 Web API

This package help you build your REST API documentation.

Laravel API Doc This package help you build your REST API documentation. Installation You can install the package via composer: composer require axeld

DigitalOcean API v2 client for Symfony and API Platform

DigitalOcean Bundle for Symfony and API Platform DunglasDigitalOceanBundle allows using the DigitalOcean API from your Symfony and API Platform projec

API SDK for OpenTrade Commerce API: Taobao, Alibaba, JD, 1688, Aliexpress, Ebay.

OtapiPhpClient Create Client $client = new OtClient($key, $secret, $lang); key (Access Key) secret (Secret for access key) language (2 symbol lang id

Nexmo REST API client for PHP. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.

Client Library for PHP Support Notice This library and it's associated packages, nexmo/client and nexmo/client-core have transitioned into a "Maintena

API client for ThePay - payment gate API
API client for ThePay - payment gate API

This is the official highly compatible public package of The Pay SDK which interacts with The Pay's REST API. To get started see examples below.

Code Quiz MonoRepo (API, API Client, App)

Code Quiz Welcome to the Code Quiz Open Source project from How To Code Well. This is an Open Source project that includes an API and an App for the d

OpenAI API Client is a component-oriented, extensible client library for the OpenAI API. It's designed to be faster and more memory efficient than traditional PHP libraries.

OpenAI API Client in PHP (community-maintained) This library is a component-oriented, extensible client library for the OpenAI API. It's designed to b

Owner
Wisdom Diala
I'm Wisdom Diala, A tech enthusiast, backend developer with 4 years experience with grounded knowledge in OOP PHP, Laravel Framework.
Wisdom Diala
The Universal Device Detection library will parse any User Agent and detect the browser, operating system, device used (desktop, tablet, mobile, tv, cars, console, etc.), brand and model.

DeviceDetector Code Status Description The Universal Device Detection library that parses User Agents and detects devices (desktop, tablet, mobile, tv

Matomo Analytics 2.4k Jan 9, 2023
A simple API documentation package for Laravel using OpenAPI and Redoc

Laravel Redoc Easily publish your API documentation using your OpenAPI document in your Laravel Application. Installation You can install this package

Steve McDougall 15 Dec 27, 2022
Fanmade project using Twitter API and Marvel API.

Project Marvel Memories A fanmade project in PHP using API Twitter V2, Marvel API and Github action scheduler. What about? Posts a random cover with d

Julien SCHMITT 15 Dec 17, 2022
This package is a simple API laravel wrapper for Pokemontcg with a sleek Model design for API routes and authentication.

This package is a simple API laravel wrapper for Pokemontcg with a sleek Model design for API routes and authentication.

Daniel Henze 3 Aug 29, 2022
Generate pretty release changelogs using the commit log and Github API.

zenstruck/changelog Generate pretty release changelogs using the commit log and Github API. Changelog entries are in the following format: {short hash

Kevin Bond 3 Jun 20, 2022
PHP package to manage google-api interactions

Google-api-client PHP package to manage google-api interactions Supports: Google Drive API Google Spreadsheet API Installation composer require obrio-

OBRIO 3 Apr 28, 2022
PHP package for the Limg.app website - allowing to upload images via the API of the website.

Limg PHP Client Package. Installation You can install the package via composer: composer require havenstd06/limg-php-client Usage use Havenstd06\Limg\

Thomas 3 Jul 27, 2021
🌐 Free Google Translate API PHP Package. Translates totally free of charge.

Google Translate PHP Free Google Translate API PHP Package. Translates totally free of charge. Installation Basic Usage Advanced Usage Language Detect

Levan Velijanashvili 1.5k Dec 31, 2022
PHP GitHub Sponsors is a package that integrates directly with the GitHub Sponsors GraphQL API.

PHP GitHub Sponsors PHP GitHub Sponsors is a package that integrates directly with the GitHub Sponsors GraphQL API. Using it, you can easily check if

GitHub PHP 101 Nov 2, 2022
PHP package providing easy and fast access to Twitter API V2.

Twitter API V2 is a PHP package that provides an easy and fast access to Twitter REST API for Version 2 endpoints.

Julien SCHMITT 38 Dec 12, 2022