1 Star 0 Fork 0

wenlin42 / coingecko-api

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

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.

MIT License Copyright (c) 2020 Volodymyr Svyryd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/wenlin423/coingecko-api.git
git@gitee.com:wenlin423/coingecko-api.git
wenlin423
coingecko-api
coingecko-api
master

搜索帮助