A simple, intuitive and composable API Client for the CoinGecko REST API Service.
- βοΈ API v3
- βοΈ Community Endpoint
- βοΈ Pro Endpoint
- βοΈ php: 8.x
- βοΈ guzzlehttp/guzzle: ^7.5
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 require pangzlab/coingecko-api
OR
This library provides 2 main classes which you can use depending on the type of endpoints you are accessing.
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();
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();
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: /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: /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: /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: /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());
}
- Before forming the endpoint, always start calling the set() method to make a clean object before building a request.
- The parameter position is not important. It can be set anywhere as long as it is required by the endpoint.
-
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.
-
Method name for building a query string using CoinGeckoUrlBuilder() always have a prefix with.
-
(i.e. withId() for id, withVsCurrency() for vs_currency)
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.
β οΈ 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());
}
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());
}
<?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());
}
- ping
- simple
- coins
- contract
- coins
- asset_platforms
- categories
- exchanges
- indexes
- derivatives
- exchanges
- nfts (beta)
- exchange_rates
- search
- trending
- global
- companies (beta)
1. π endpoint : /ping
Check API server status
[ method ] : ping()
π‘ sample usage
$result = $apiClient->set()->ping()->send();
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();
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')
);
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')
);
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')
);
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')
);
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')
);
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')
);
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();
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();
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')
);
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();
1. π endpoint : /exchange_rates
Get BTC-to-Currency exchange rates
[ method ] : exchangeRates()
π‘ sample usage
$result = $apiClient->set()->exchangeRates()->send();
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')
);
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();
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();
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();