pangzlab / coingecko-api
CoinGecko API Client for PHP
Fund package maintenance!
Buymeacoffee
Verusid
Veruscoin(Vrsc)
Bitcoin(Btc)
Ethereum(Eth)
Requires
- guzzlehttp/guzzle: ^7.5
Requires (Dev)
- phpunit/phpunit: ^9
README
coingecko-api
Coingecko API client for PHP
A simple, intuitive and composable API Client for the CoinGecko REST API Service.
API Version Support
- ✔️ API v3
- ✔️ Community Endpoint
- ✔️ Pro Endpoint
Requirements
- ✔️ php: 8.x
- ✔️ guzzlehttp/guzzle: ^7.5
Installation
The best and the easiest way to use this library is thru composer.
You can also download the source directly and require it to your project.
Just take note of the requirements.
[ Composer ]
composer require pangzlab/coingecko-api
OR
[ Direct Download ]
📥 Get it from the release
Library
[ Classes ]
This library provides 2 main classes which you can use depending on the type of endpoints you are accessing.
📦 CoinGeckoApiClient
This is the main class that allows building the API endpoints and sending the request.
This is always required.
<?php use PangzLab\CoinGecko\Client\CoinGeckoApiClient; $client = new CoinGeckoApiClient();
📦 CoinGeckoUrlBuilder
CoinGecko API endpoints require a URL query which is a set of key value pairs encoded in the URL.
This class enables to dynamically create them with ease without worrying the position
or the casing of the keys.
Although by design can be achieved by using the CoinGeckoApiClient class alone,
using the CoinGeckoUrlBuilder gives you a finer control over the parameters you set and more flexibility in managing the endpoints you're building.
This class is optional depending on the endpoint you need.
<?php use PangzLab\CoinGecko\Client\CoinGeckoUrlBuilder; $query = new CoinGeckoUrlBuilder();
Usage
Accessing the API endpoints are fairly straightforward. If not for convenience, you don't really need a set of manuals to start using this library.
You can just go directly to the CoinGecko REST API Official Documenation, find the endpoint you need and start building your request.
Let's use some examples.
🔹 Endpoint request "without"🚫 URL query
🌐 endpoint: /ping
<?php use PangzLab\CoinGecko\Client\CoinGeckoApiClient; $client = new CoinGeckoApiClient(); try { $response = $client->set()->ping()->send(); print_r($response); // do something here.. } catch (Exception $e) { print($e->getMessage()); }
🔹 Endpoint request "with"✔️ URL query
🌐 endpoint: /coins/categoreis
<?php use PangzLab\CoinGecko\Client\CoinGeckoApiClient; use PangzLab\CoinGecko\Client\CoinGeckoApiClient; $q = new CoinGeckoUrlBuilder(); $client = new CoinGeckoApiClient(); try { $response = $apiClient->set() ->coins() ->categories() ->send($q->withOrder("name_desc")); print_r($response); // do something here ... } catch (Exception $e) { print($e->getMessage()); }
🔹 Endpoint request with path parameter(id)
🌐 endpoint: /exchanges/{id}/volume_chart
<?php use PangzLab\CoinGecko\Client\CoinGeckoApiClient; use PangzLab\CoinGecko\Client\CoinGeckoUrlBuilder; $q = new CoinGeckoUrlBuilder(); $client = new CoinGeckoApiClient(); try { $response = $apiClient->set() ->exchanges("safe_trade") ->volumeChart() ->send($q->withDays(1)); print_r($response); // do something here ... } catch (Exception $e) { print($e->getMessage()); }
🔹 Endpoint request with path parameter(id) and URL Query
🌐 endpoint: /coins/{id}
<?php use PangzLab\CoinGecko\Client\CoinGeckoApiClient; use PangzLab\CoinGecko\Client\CoinGeckoUrlBuilder; $q = new CoinGeckoUrlBuilder(); $client = new CoinGeckoApiClient(); try { $response = $apiClient->set() ->coins("verus-coin") ->send( $q->withLocalization("false") ->withDeveloperData("true") ->withSparkline("true") ->withCommunityData("true") ->withMarketData("true") ->withTickers("true") ); print_r($response); // do something here ... } catch (Exception $e) { print($e->getMessage()); }
Features
Set Method
- Before forming the endpoint, always start calling the set() method to make a clean object before building a request.
Parameter Positioning
- The parameter position is not important. It can be set anywhere as long as it is required by the endpoint.
Send Methods ( Community vs Pro )
-
There are 2 methods provided to send a request. The send() and the sendPro()
-
send ⇨ used to send a request to Community API endpoints.
-
sendPro ⇨ used to send a request to the exclusive Pro API endpoints. This method requires the x_cg_pro_api_key parameter key encoded in the URL for the request to be accepted.
-
Both optionally accepts instance of CoinGeckoUrlBuilder() class.
-
Aside from the x_cg_pro_api_key parameter key, there is no major difference between these 2 methods. Both are used the same way.
CoinGeckoUrlBuilder() Method Call with Prefix
-
Method name for building a query string using CoinGeckoUrlBuilder() always have a prefix with.
-
(i.e. withId() for id, withVsCurrency() for vs_currency)
Bonus Quirks
There are some benefits of using this CoinGecko client libray.
Aside from it's not required to learn any methods to use
and the parameter positioning of each methods,
there are other features which might not be essential but are available and ready to be used
to provide manageability and flexibility to your coding.
1. Use of reset() instead of set()
⚠️ Calling set() is always the preferred way but you can also build request using the reset() method to cleanup resource. Just make sure to separate the call to send() method to avoid ParseError.
<?php use PangzLab\CoinGecko\Client\CoinGeckoApiClient; use PangzLab\CoinGecko\Client\CoinGeckoUrlBuilder; $q = new CoinGeckoUrlBuilder(); $client = new CoinGeckoApiClient(); try { //No set() method and no send() call $apiClient = $apiClient->coins("verus-coin"); //Separate the call to send $response = $apiClient->send( $q->withLocalization("false") ->withDeveloperData("true") ->withSparkline("true") ->withCommunityData("true") ->withMarketData("true") ->withTickers("true") ); print_r($response); //Call reset() method to form another request $apiClient->reset(); $apiClient = $apiClient->exchanges("safe_trade") ->volumeChart(); $response = $apiClient->send($q->withDays(1)); //Call reset() for the next calls $apiClient->reset(); print_r($response); } catch (Exception $e) { print($e->getMessage()); }
2. Case-insensitive method names
Endpoint name and URL parameter key name are case-insensitive. This means calling ping(), PING() and Ping() are treated the same thing. Additionally you can also use underscore(_) as a separator for names like VS_CURRENCY or vs_Currency. They will be handled properly.
<?php use PangzLab\CoinGecko\Client\CoinGeckoApiClient; use PangzLab\CoinGecko\Client\CoinGeckoUrlBuilder; $q = new CoinGeckoUrlBuilder(); $client = new CoinGeckoApiClient(); try { //All caps $response = $apiClient->set() ->PING() ->send(); print_r($response); //All lowercase $response = $apiClient->set() ->ping() ->send(); print_r($response); //UC First $response = $apiClient->set() ->Ping() ->send(); print_r($response); //With underscore - only underscore is allowed $response = $apiClient->set() ->_PING_() ->send(); print_r($response); //With insensitive parameter case $response = $apiClient ->coins("verus-coin") ->send( $q->with_LOCALIZATION("false") ->withDeveloperData_("true") ->withSparkline("true") ->withCommunity_DATA("true") ->with_Market_Data("true") ->withTiCKers("true") ); print_r($response); } catch (Exception $e) { print($e->getMessage()); }
3. Request reusability
<?php use PangzLab\CoinGecko\Client\CoinGeckoApiClient; use PangzLab\CoinGecko\Client\CoinGeckoUrlBuilder; $q = new CoinGeckoUrlBuilder(); $client = new CoinGeckoApiClient(); try { $request = $apiClient->set()->ping(); for($x = 0; $x <= 10; $x++) { $response = $request->send(); sleep(3); print_r($response); } } catch (Exception $e) { print($e->getMessage()); }
API Usage
📋Endpoint List
- ping
- simple
- coins
- contract
- coins
- asset_platforms
- categories
- exchanges
- indexes
- derivatives
- exchanges
- nfts (beta)
- exchange_rates
- search
- trending
- global
- companies (beta)
🌐 ping
1. 📋 endpoint : /ping
Check API server status
[ method ] : ping()
💡 sample usage
$result = $apiClient->set()->ping()->send();
🌐 simple
1. 📋 endpoint : /simple/price
Get the current price of any cryptocurrencies in any other supported currencies that you need.
[ method ] : simple()->price()
🔑
URL Keys : 7
✔️ withIds('string')
❗️
✔️ withVsCurrencies('string')
❗️
✔️ withIncludeMarketCap('string')
✔️ withInclude24hrVol('string')
✔️ withInclude24hrChange('string')
✔️ withIncludeLastUpdatedAt('string')
✔️ withPrecision('string')
url parameters
ids
➞ string (required)◽️ id of coins, comma-separated if querying more than 1 coinrefers to
coins/list
vs_currencies
➞ string (required)◽️ vs_currency of coins, comma-separated if querying more than 1 vs_currencyrefers to
simple/supported_vs_currencies
include_market_cap
➞ string◽️ true/false to include market_cap, default: false
include_24hr_vol
➞ string◽️ true/false to include 24hr_vol, default: false
include_24hr_change
➞ string◽️ true/false to include 24hr_change, default: false
include_last_updated_at
➞ string◽️ true/false to include last_updated_at of price, default: false
precision
➞ string◽️ full or any value between 0 - 18 to specify decimal place for currency price value, default: 2
💡 sample usage
$result = $apiClient->set()->simple()->price() ->send( $q->withIds('string') ->withVsCurrencies('string') ->withIncludeMarketCap('string') ->withInclude24hrVol('string') ->withInclude24hrChange('string') ->withIncludeLastUpdatedAt('string') ->withPrecision('string') );
2. 📋 endpoint : /simple/token_price/{id}
Get current price of tokens (using contract addresses) for a given platform in any other currency that you need.
endpoint parameters
id
➞ The id of the platform issuing tokens (See asset_platforms endpoint for list of options)
[ method ] : simple()->tokenPrice('{id}')
🔑
URL Keys : 7
✔️ withContractAddresses('string')
❗️
✔️ withVsCurrencies('string')
❗️
✔️ withIncludeMarketCap('string')
✔️ withInclude24hrVol('string')
✔️ withInclude24hrChange('string')
✔️ withIncludeLastUpdatedAt('string')
✔️ withPrecision('string')
url parameters
contract_addresses
➞ string (required)◽️ The contract address of tokens, comma separated
vs_currencies
➞ string (required)◽️ vs_currency of coins, comma-separated if querying more than 1 vs_currency*refers to
simple/supported_vs_currencies
include_market_cap
➞ string◽️ true/false to include market_cap, default: false
include_24hr_vol
➞ string◽️ true/false to include 24hr_vol, default: false
include_24hr_change
➞ string◽️ true/false to include 24hr_change, default: false
include_last_updated_at
➞ string◽️ true/false to include last_updated_at of price, default: false
precision
➞ string◽️ full or any Integer to specify decimal place for currency price value, default: 2
💡 sample usage
$result = $apiClient->set()->simple()->tokenPrice('{id}') ->send( $q->withContractAddresses('string') ->withVsCurrencies('string') ->withIncludeMarketCap('string') ->withInclude24hrVol('string') ->withInclude24hrChange('string') ->withIncludeLastUpdatedAt('string') ->withPrecision('string') );
3. 📋 endpoint : /simple/supported_vs_currencies
Get list of supported_vs_currencies.
[ method ] : simple()->supportedVsCurrencies()
💡 sample usage
$result = $apiClient->set()->simple()->supportedVsCurrencies()->send();
🌐 coins
1. 📋 endpoint : /coins/list
List all supported coins id, name and symbol (no pagination required)
[ method ] : coins()->list()
🔑
URL Keys : 1
✔️ withIncludePlatform('boolean')
url parameters
include_platform
➞ boolean◽️ flag to include platform contract addresses (eg. 0x.... for Ethereum based tokens). valid values: true, false
💡 sample usage
$result = $apiClient->set()->coins()->list() ->send( $q->withIncludePlatform('boolean') );
2. 📋 endpoint : /coins/markets
List all supported coins price, market cap, volume, and market related data
[ method ] : coins()->markets()
🔑
URL Keys : 8
✔️ withVsCurrency('string')
❗️
✔️ withIds('string')
✔️ withCategory('string')
✔️ withOrder('string')
✔️ withPerPage('integer')
✔️ withPage('integer')
✔️ withSparkline('boolean')
✔️ withPriceChangePercentage('string')
url parameters
vs_currency
➞ string (required)◽️ The target currency of market data (usd, eur, jpy, etc.)
ids
➞ string◽️ The ids of the coin, comma separated crytocurrency symbols (base). refers to
/coins/list
.category
➞ string◽️ filter by coin category. Refer to /coin/categories/list
order
➞ string◽️ valid values: market_cap_desc, gecko_desc, gecko_asc, market_cap_asc, market_cap_desc, volume_asc, volume_desc, id_asc, id_descsort results by field.
per_page
➞ integer◽️ valid values: 1..250 Total results per page
page
➞ integer◽️ Page through results
sparkline
➞ boolean◽️ Include sparkline 7 days data (eg. true, false)
price_change_percentage
➞ string◽️ Include price change percentage in 1h, 24h, 7d, 14d, 30d, 200d, 1y (eg. '
1h,24h,7d
' comma-separated, invalid values will be discarded)
💡 sample usage
$result = $apiClient->set()->coins()->markets() ->send( $q->withVsCurrency('string') ->withIds('string') ->withCategory('string') ->withOrder('string') ->withPerPage('integer') ->withPage('integer') ->withSparkline('boolean') ->withPriceChangePercentage('string') );
3. 📋 endpoint : /coins/{id}
Get current data (name, price, market, ... including exchange tickers) for a coin
endpoint parameters
id
➞ pass the coin id (can be obtained from /coins) eg. bitcoin
[ method ] : coins('{id}')
🔑
URL Keys : 6
✔️ withLocalization('string')
✔️ withTickers('boolean')
✔️ withMarketData('boolean')
✔️ withCommunityData('boolean')
✔️ withDeveloperData('boolean')
✔️ withSparkline('boolean')
url parameters
localization
➞ string◽️ Include all localized languages in response (true/false) [default: true]
tickers
➞ boolean◽️ Include tickers data (true/false) [default: true]
market_data
➞ boolean◽️ Include market_data (true/false) [default: true]
community_data
➞ boolean◽️ Include community_data data (true/false) [default: true]
developer_data
➞ boolean◽️ Include developer_data data (true/false) [default: true]
sparkline
➞ boolean◽️ Include sparkline 7 days data (eg. true, false) [default: false]
💡 sample usage
$result = $apiClient->set()->coins('{id}') ->send( $q->withLocalization('string') ->withTickers('boolean') ->withMarketData('boolean') ->withCommunityData('boolean') ->withDeveloperData('boolean') ->withSparkline('boolean') );
4. 📋 endpoint : /coins/{id}/tickers
Get coin tickers (paginated to 100 items)
endpoint parameters
id
➞ pass the coin id (can be obtained from /coins/list) eg. bitcoin
[ method ] : coins('{id}')->tickers()
🔑
URL Keys : 5
✔️ withExchangeIds('string')
✔️ withIncludeExchangeLogo('string')
✔️ withPage('integer')
✔️ withOrder('string')
✔️ withDepth('string')
url parameters
exchange_ids
➞ string◽️ filter results by exchange_ids (ref: v3/exchanges/list)
include_exchange_logo
➞ string◽️ flag to show exchange_logo
page
➞ integer◽️ Page through results
order
➞ string◽️ valid values: trust_score_desc (default), trust_score_asc and volume_desc
depth
➞ string◽️ flag to show 2% orderbook depth. valid values: true, false
💡 sample usage
$result = $apiClient->set()->coins('{id}')->tickers() ->send( $q->withExchangeIds('string') ->withIncludeExchangeLogo('string') ->withPage('integer') ->withOrder('string') ->withDepth('string') );
5. 📋 endpoint : /coins/{id}/history
Get historical data (name, price, market, stats) at a given date for a coin
endpoint parameters
id
➞ pass the coin id (can be obtained from /coins) eg. bitcoin
[ method ] : coins('{id}')->history()
🔑
URL Keys : 2
✔️ withDate('string')
❗️
✔️ withLocalization('string')
url parameters
date
➞ string (required)◽️ The date of data snapshot in dd-mm-yyyy eg. 30-12-2017
localization
➞ string◽️ Set to false to exclude localized languages in response
💡 sample usage
$result = $apiClient->set()->coins('{id}')->history() ->send( $q->withDate('string') ->withLocalization('string') );
6. 📋 endpoint : /coins/{id}/market_chart
Get historical market data include price, market cap, and 24h volume (granularity auto)
endpoint parameters
id
➞ pass the coin id (can be obtained from /coins) eg. bitcoin
[ method ] : coins('{id}')->marketChart()
🔑
URL Keys : 3
✔️ withVsCurrency('string')
❗️
✔️ withDays('string')
❗️
✔️ withInterval('string')
url parameters
vs_currency
➞ string (required)◽️ The target currency of market data (usd, eur, jpy, etc.)
days
➞ string (required)◽️ Data up to number of days ago (eg. 1,14,30,max)
interval
➞ string◽️ Data interval. Possible value: daily
💡 sample usage
$result = $apiClient->set()->coins('{id}')->marketChart() ->send( $q->withVsCurrency('string') ->withDays('string') ->withInterval('string') );
7. 📋 endpoint : /coins/{id}/market_chart/range
Get historical market data include price, market cap, and 24h volume within a range of timestamp (granularity auto)
endpoint parameters
id
➞ pass the coin id (can be obtained from /coins) eg. bitcoin
[ method ] : coins('{id}')->marketChart()->range()
🔑
URL Keys : 3
✔️ withVsCurrency('string')
❗️
✔️ withFrom('string')
❗️
✔️ withTo('string')
❗️
url parameters
vs_currency
➞ string (required)◽️ The target currency of market data (usd, eur, jpy, etc.)
from
➞ string (required)◽️ From date in UNIX Timestamp (eg. 1392577232)
to
➞ string (required)◽️ To date in UNIX Timestamp (eg. 1422577232)
💡 sample usage
$result = $apiClient->set()->coins('{id}')->marketChart()->range() ->send( $q->withVsCurrency('string') ->withFrom('string') ->withTo('string') );
🌐 contract
1. 📋 endpoint : /coins/{id}/contract/{contract_address}
Get coin info from contract address
endpoint parameters
id
➞ Asset platform (See asset_platforms endpoint for list of options)
contract_address
➞ Token's contract address
[ method ] : coins('{id}')->contract('{contract_address}')
💡 sample usage
$result = $apiClient->set()->coins('{id}')->contract('{contract_address}')->send();
2. 📋 endpoint : /coins/{id}/contract/{contract_address}/market_chart/
Get historical market data include price, market cap, and 24h volume (granularity auto) from a contract address
endpoint parameters
id
➞ The id of the platform issuing tokens (See asset_platforms endpoint for list of options)
contract_address
➞ Token's contract address
[ method ] : coins('{id}')->contract('{contract_address}')->marketChart()
🔑
URL Keys : 2
✔️ withVsCurrency('string')
❗️
✔️ withDays('string')
❗️
url parameters
vs_currency
➞ string (required)◽️ The target currency of market data (usd, eur, jpy, etc.)
days
➞ string (required)◽️ Data up to number of days ago (eg. 1,14,30,max)
💡 sample usage
$result = $apiClient->set()->coins('{id}')->contract('{contract_address}')->marketChart() ->send( $q->withVsCurrency('string') ->withDays('string') );
3. 📋 endpoint : /coins/{id}/contract/{contract_address}/market_chart/range
Get historical market data include price, market cap, and 24h volume within a range of timestamp (granularity auto) from a contract address
endpoint parameters
id
➞ The id of the platform issuing tokens (See asset_platforms endpoint for list of options)
contract_address
➞ Token's contract address
[ method ] : coins('{id}')->contract('{contract_address}')->marketChart()->range()
🔑
URL Keys : 3
✔️ withVsCurrency('string')
❗️
✔️ withFrom('string')
❗️
✔️ withTo('string')
❗️
url parameters
vs_currency
➞ string (required)◽️ The target currency of market data (usd, eur, jpy, etc.)
from
➞ string (required)◽️ From date in UNIX Timestamp (eg. 1392577232)
to
➞ string (required)◽️ To date in UNIX Timestamp (eg. 1422577232)
💡 sample usage
$result = $apiClient->set()->coins('{id}')->contract('{contract_address}')->marketChart()->range() ->send( $q->withVsCurrency('string') ->withFrom('string') ->withTo('string') );
🌐 coins
1. 📋 endpoint : /coins/{id}/ohlc
Get coin's OHLC
endpoint parameters
id
➞ pass the coin id (can be obtained from /coins/list) eg. bitcoin
[ method ] : coins('{id}')->ohlc()
🔑
URL Keys : 2
✔️ withVsCurrency('string')
❗️
✔️ withDays('string')
❗️
url parameters
vs_currency
➞ string (required)◽️ The target currency of market data (usd, eur, jpy, etc.)
days
➞ string (required)◽️ Data up to number of days ago (1/7/14/30/90/180/365/max)
💡 sample usage
$result = $apiClient->set()->coins('{id}')->ohlc() ->send( $q->withVsCurrency('string') ->withDays('string') );
🌐 asset_platforms
1. 📋 endpoint : /asset_platforms
List all asset platforms (Blockchain networks)
[ method ] : assetPlatforms()
🔑
URL Keys : 1
✔️ withFilter('string')
url parameters
filter
➞ string◽️ apply relevant filters to results valid values: "nft" (asset_platform nft-support)
💡 sample usage
$result = $apiClient->set()->assetPlatforms() ->send( $q->withFilter('string') );
🌐 categories
1. 📋 endpoint : /coins/categories/list
List all categories
[ method ] : coins()->categories()->list()
💡 sample usage
$result = $apiClient->set()->coins()->categories()->list()->send();
2. 📋 endpoint : /coins/categories
List all categories with market data
[ method ] : coins()->categories()
🔑
URL Keys : 1
✔️ withOrder('string')
url parameters
order
➞ string◽️ valid values: market_cap_desc (default), market_cap_asc, name_desc, name_asc, market_cap_change_24h_desc and market_cap_change_24h_asc
💡 sample usage
$result = $apiClient->set()->coins()->categories() ->send( $q->withOrder('string') );
🌐 exchanges
1. 📋 endpoint : /exchanges
List all exchanges (Active with trading volumes)
[ method ] : exchanges()
🔑
URL Keys : 2
✔️ withPerPage('integer')
✔️ withPage('string')
url parameters
per_page
➞ integer◽️ Valid values: 1...250Total results per pageDefault value:: 100
page
➞ string◽️ page through results
💡 sample usage
$result = $apiClient->set()->exchanges() ->send( $q->withPerPage('integer') ->withPage('string') );
2. 📋 endpoint : /exchanges/list
List all supported markets id and name (no pagination required)
[ method ] : exchanges()->list()
💡 sample usage
$result = $apiClient->set()->exchanges()->list()->send();
3. 📋 endpoint : /exchanges/{id}
Get exchange volume in BTC and top 100 tickers only
endpoint parameters
id
➞ pass the exchange id (can be obtained from /exchanges/list) eg. binance
[ method ] : exchanges('{id}')
💡 sample usage
$result = $apiClient->set()->exchanges('{id}')->send();
4. 📋 endpoint : /exchanges/{id}/tickers
Get exchange tickers (paginated, 100 tickers per page)
endpoint parameters
id
➞ pass the exchange id (can be obtained from /exchanges/list) eg. binance
[ method ] : exchanges('{id}')->tickers()
🔑
URL Keys : 5
✔️ withCoinIds('string')
✔️ withIncludeExchangeLogo('string')
✔️ withPage('integer')
✔️ withDepth('string')
✔️ withOrder('string')
url parameters
coin_ids
➞ string◽️ filter tickers by coin_ids (ref: v3/coins/list)
include_exchange_logo
➞ string◽️ flag to show exchange_logo
page
➞ integer◽️ Page through results
depth
➞ string◽️ flag to show 2% orderbook depth i.e., cost_to_move_up_usd and cost_to_move_down_usd
order
➞ string◽️ valid values: trust_score_desc (default), trust_score_asc and volume_desc
💡 sample usage
$result = $apiClient->set()->exchanges('{id}')->tickers() ->send( $q->withCoinIds('string') ->withIncludeExchangeLogo('string') ->withPage('integer') ->withDepth('string') ->withOrder('string') );
🌐 indexes
1. 📋 endpoint : /indexes
List all market indexes
[ method ] : indexes()
🔑
URL Keys : 2
✔️ withPerPage('integer')
✔️ withPage('integer')
url parameters
per_page
➞ integer◽️ Total results per page
page
➞ integer◽️ Page through results
💡 sample usage
$result = $apiClient->set()->indexes() ->send( $q->withPerPage('integer') ->withPage('integer') );
2. 📋 endpoint : /indexes/{market_id}/{id}
get market index by market id and index id
endpoint parameters
market_id
➞ pass the market id (can be obtained from /exchanges/list)
id
➞ pass the index id (can be obtained from /indexes/list)
[ method ] : indexes('{market_id}','{id}')
💡 sample usage
$result = $apiClient->set()->indexes('{market_id}','{id}')->send();
3. 📋 endpoint : /indexes/list
list market indexes id and name
[ method ] : indexes()->list()
💡 sample usage
$result = $apiClient->set()->indexes()->list()->send();
🌐 derivatives
1. 📋 endpoint : /derivatives
List all derivative tickers
[ method ] : derivatives()
🔑
URL Keys : 1
✔️ withIncludeTickers('string')
url parameters
include_tickers
➞ string◽️ ['all', 'unexpired'] - expired to show unexpired tickers, all to list all tickers, defaults to unexpired
💡 sample usage
$result = $apiClient->set()->derivatives() ->send( $q->withIncludeTickers('string') );
2. 📋 endpoint : /derivatives/exchanges
List all derivative exchanges
[ method ] : derivatives()->exchanges()
🔑
URL Keys : 3
✔️ withOrder('string')
✔️ withPerPage('integer')
✔️ withPage('integer')
url parameters
order
➞ string◽️ order results using following params name_asc,name_desc,open_interest_btc_asc,open_interest_btc_desc,trade_volume_24h_btc_asc,trade_volume_24h_btc_desc
per_page
➞ integer◽️ Total results per page
page
➞ integer◽️ Page through results
💡 sample usage
$result = $apiClient->set()->derivatives()->exchanges() ->send( $q->withOrder('string') ->withPerPage('integer') ->withPage('integer') );
3. 📋 endpoint : /derivatives/exchanges/{id}
show derivative exchange data
endpoint parameters
id
➞ pass the exchange id (can be obtained from derivatives/exchanges/list) eg. bitmex
[ method ] : derivatives()->exchanges('{id}')
🔑
URL Keys : 1
✔️ withIncludeTickers('string')
url parameters
include_tickers
➞ string◽️ ['all', 'unexpired'] - expired to show unexpired tickers, all to list all tickers, leave blank to omit tickers data in response
💡 sample usage
$result = $apiClient->set()->derivatives()->exchanges('{id}') ->send( $q->withIncludeTickers('string') );
4. 📋 endpoint : /derivatives/exchanges/list
List all derivative exchanges name and identifier
[ method ] : derivatives()->exchanges()->list()
💡 sample usage
$result = $apiClient->set()->derivatives()->exchanges()->list()->send();
🌐 exchanges
1. 📋 endpoint : /exchanges/{id}/volume_chart
Get volume_chart data for a given exchange
endpoint parameters
id
➞ pass the exchange id (can be obtained from /exchanges/list) eg. binance
[ method ] : exchanges('{id}')->volumeChart()
🔑
URL Keys : 1
✔️ withDays('integer')
❗️
url parameters
days
➞ integer (required)◽️ Data up to number of days ago (eg. 1,14,30)
💡 sample usage
$result = $apiClient->set()->exchanges('{id}')->volumeChart() ->send( $q->withDays('integer') );
🌐 nfts (beta)
1. 📋 endpoint : /nfts/list
List all supported NFT ids, paginated by 100 items per page, paginated to 100 items
[ method ] : nfts()->list()
🔑
URL Keys : 4
✔️ withOrder('string')
✔️ withAssetPlatformId('string')
✔️ withPerPage('integer')
✔️ withPage('integer')
url parameters
order
➞ string◽️ valid values: h24_volume_native_asc, h24_volume_native_desc, floor_price_native_asc, floor_price_native_desc, market_cap_native_asc, market_cap_native_desc, market_cap_usd_asc, market_cap_usd_desc
asset_platform_id
➞ string◽️ The id of the platform issuing tokens (See asset_platforms endpoint for list of options)
per_page
➞ integer◽️ Total results per page
page
➞ integer◽️ Page through results
💡 sample usage
$result = $apiClient->set()->nfts()->list() ->send( $q->withOrder('string') ->withAssetPlatformId('string') ->withPerPage('integer') ->withPage('integer') );
2. 📋 endpoint : /nfts/{id}
Get current data (name, price_floor, volume_24h ...) for an NFT collection
endpoint parameters
id
➞ id of nft collection (can be obtained from /nfts/list)
[ method ] : nfts('{id}')
💡 sample usage
$result = $apiClient->set()->nfts('{id}')->send();
3. 📋 endpoint : /nfts/{asset_platform_id}/contract/{contract_address}
Get current data (name, price_floor, volume_24h ...) for an NFT collection
endpoint parameters
asset_platform_id
➞ The id of the platform issuing tokens (See asset_platforms endpoint for list of options, use filter=nft param)
contract_address
➞ The contract_address of the nft collection (/nfts/list for list of nft collection with metadata)
[ method ] : nfts('{asset_platform_id}')->contract('{contract_address}')
💡 sample usage
$result = $apiClient->set()->nfts('{asset_platform_id}')->contract('{contract_address}')->send();
🌐 exchange_rates
1. 📋 endpoint : /exchange_rates
Get BTC-to-Currency exchange rates
[ method ] : exchangeRates()
💡 sample usage
$result = $apiClient->set()->exchangeRates()->send();
🌐 search
1. 📋 endpoint : /search
Search for coins, categories and markets on CoinGecko
[ method ] : search()
🔑
URL Keys : 1
✔️ withQuery('string')
❗️
url parameters
query
➞ string (required)◽️ Search string
💡 sample usage
$result = $apiClient->set()->search() ->send( $q->withQuery('string') );
🌐 trending
1. 📋 endpoint : /search/trending
Get trending search coins (Top-7) on CoinGecko in the last 24 hours
[ method ] : search()->trending()
💡 sample usage
$result = $apiClient->set()->search()->trending()->send();
🌐 global
1. 📋 endpoint : /global
Get cryptocurrency global data
[ method ] : global()
💡 sample usage
$result = $apiClient->set()->global()->send();
2. 📋 endpoint : /global/decentralized_finance_defi
Get cryptocurrency global decentralized finance(defi) data
[ method ] : global()->decentralizedFinanceDefi()
💡 sample usage
$result = $apiClient->set()->global()->decentralizedFinanceDefi()->send();
🌐 companies (beta)
1. 📋 endpoint : /companies/public_treasury/{coin_id}
Get public companies data
endpoint parameters
coin_id
➞ bitcoin or ethereum
[ method ] : companies()->publicTreasury('{coin_id}')
💡 sample usage
$result = $apiClient->set()->companies()->publicTreasury('{coin_id}')->send();