Codenix Sv Coingecko Api Save

CoinGecko PHP API client for coingecko.com (V3)

Project README

PHP API client for coingecko.com

Build Status Scrutinizer Code Quality Test Coverage Maintainability License: MIT

image info

A simple API client, written with PHP for coingecko.com.

CoinGecko provides a fundamental analysis of the crypto market. In addition to tracking price, volume and market capitalization, CoinGecko tracks community growth, open-source code development, major events and on-chain metrics.

For additional information about API visit coingecko.com/api

CoinGecko API Terms of Service

Requirements

  • PHP >= 7.2
  • ext-json

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require codenix-sv/coingecko-api

or add

"codenix-sv/coingecko-api": "^1.0"

Basic usage

Example

use Codenixsv\CoinGeckoApi\CoinGeckoClient;

$client = new CoinGeckoClient();
$data = $client->ping();

You can get last response (ResponseInterface::class) uses getLastResponse method:

use Codenixsv\CoinGeckoApi\CoinGeckoClient;

$client = new CoinGeckoClient();
$data = $client->derivatives()->getExchanges();
$response = $client->getLastResponse();
$headers = $response->getHeaders();

Available methods

Ping

ping

Check API server status

$data = $client->ping();

Simple

getPrice

Get the current price of any cryptocurrencies in any other supported currencies that you need.

$data = $client->simple()->getPrice('0x,bitcoin', 'usd,rub');

getTokenPrice

Get current price of tokens (using contract addresses) for a given platform in any other currency that you need.

$data = $client->simple()->getTokenPrice('ethereum','0xE41d2489571d322189246DaFA5ebDe1F4699F498', 'usd,rub');

getSupportedVsCurrencies

Get list of supported_vs_currencies.

$data = $client->simple()->getSupportedVsCurrencies();

Coins

getList

List all supported coins id, name and symbol (no pagination required)

$data = $client->coins()->getList();

getMarkets

List all supported coins price, market cap, volume, and market related data

$data = $result = $client->coins()->getMarkets('usd');

getCoin

Get current data (name, price, market, ... including exchange tickers) for a coin

$result = $client->coins()->getCoin('bitcoin', ['tickers' => 'false', 'market_data' => 'false']);

getTickers

Get coin tickers (paginated to 100 items)

$result = $client->coins()->getTickers('bitcoin');

getHistory

Get historical data (name, price, market, stats) at a given date for a coin

$result = $client->coins()->getHistory('bitcoin', '30-12-2017');

getMarketChart

Get historical market data include price, market cap, and 24h volume (granularity auto)

$result = $client->coins()->getMarketChart('bitcoin', 'usd', 'max');

getMarketChartRange

Get historical market data include price, market cap, and 24h volume within a range of timestamp (granularity auto)

$result = $client->coins()->getMarketChartRange('bitcoin', 'usd', '1392577232', '1422577232');

getMarketChartRange [BETA]

Get status updates for a given coin

$result = $client->coins()->getStatusUpdates('0x');

Contract

getContract

Get coin info from contract address

$data = $client->contract()->getContract('ethereum', '0xE41d2489571d322189246DaFA5ebDe1F4699F498');

getMarketChart

Get historical market data include price, market cap, and 24h volume (granularity auto) from a contract address

$result = $client->contract()->getMarketChart('ethereum', '0xE41d2489571d322189246DaFA5ebDe1F4699F498', 'usd', '1');

getMarketChartRange

Get historical market data include price, market cap, and 24h volume within a range of timestamp (granularity auto) from a contract address

$result = $result = $client->contract()->getMarketChartRange('ethereum', '0xE41d2489571d322189246DaFA5ebDe1F4699F498', 'usd', '11392577232', ' 1422577232');

Exchange [BETA]

getExchanges

List all exchanges

$data = $client->exchanges()->getExchanges();

getList

List all supported markets id and name (no pagination required)

$data = $client->exchanges()->getList();

getExchange

Get exchange volume in BTC and top 100 tickers only

$data = $client->exchanges()->getExchange('binance');

getTickers

Get exchange tickers (paginated)

$data = $client->exchanges()->getTickers('binance', ['coin_ids' => '0x,bitcoin']);

getStatusUpdates

Get status updates for a given exchange (beta)

$data = $client->exchanges()->getStatusUpdates('binance');

getVolumeChart

Get volume_chart data for a given exchange (beta)

$data = $client->exchanges()->getVolumeChart('binance', '1');

Finance [BETA]

getPlatforms

List all finance platforms

$data = $client->finance()->getPlatforms();

getProducts

List all finance products

$data = $client->finance()->getProducts();

Indexes [BETA]

getIndexes

List all market indexes

$data = $client->indexes()->getIndexes();

getIndex

Get market index by id

$data = $client->indexes()->getIndex('BAT');

getList

List market indexes id and name

$data = $client->indexes()->getList();

Derivatives [BETA]

getDerivatives

List all derivative tickers

$data = $client->derivatives()->getDerivatives();

getExchanges

List all derivative exchanges

$data = $client->derivatives()->getExchanges();

getExchange

Show derivative exchange data

$data = $client->derivatives()->getExchange('binance_futures');

getExchangeList

List all derivative exchanges name and identifier

$data = $client->derivatives()->getExchangeList();

Status updates [BETA]

getStatusUpdates

List all status_updates with data (description, category, created_at, user, user_title and pin)

$data = $client->statusUpdates()->getStatusUpdates();

Events [BETA]

getEvents

Get events, paginated by 100

$data = $client->events()->getEvents();

getCountries

Get list of event countries

$data = $client->events()->getCountries();

getTypes

Get list of events types

$data = $client->events()->getTypes();

Exchange rates [BETA]

getExchangeRates

Get BTC-to-Currency exchange rates

$data = $client->exchangeRates()->getExchangeRates();

Global [BETA]

getGlobal

Get cryptocurrency global data

$data = $client->globals()->getGlobal();

License

codenix-sv/coingecko-api is released under the MIT License. See the bundled LICENSE for details.

Open Source Agenda is not affiliated with "Codenix Sv Coingecko Api" Project. README Source: codenix-sv/coingecko-api
Stars
128
Open Issues
11
Last Commit
1 year ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating