패키지, 저장소 및 앱 카테고리 검색

패키지 상세v2.0.2

coingecko_api

CoinGecko API(버전 3)에 대한 간편한 접근을 제공하는 Dart 패키지

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
1.4천
좋아요
27
Pub 점수
145

패키지 설치

flutter pub add coingecko_api

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

coingecko_api 패키지는 Dart 및 Flutter 애플리케이션에서 CoinGecko API(버전 3)와 상호작용하는 간단한 방법을 제공합니다. 실시간 암호화폐 데이터, 가격, 시장 정보, 환율 등을 가져올 수 있게 해줍니다. 단순성과 신뢰성을 고려해 설계되었으며, Android, iOS, Web, macOS, Windows, Linux 등 모든 주요 플랫폼을 지원합니다. 최신 암호화폐 시장 인사이트가 필요한 앱에 적합하며, 복잡한 HTTP 요청을 사용하기 쉬운 메서드로 추상화합니다. 이 패키지는 GitHub에서 유지 관리되며, Flutter의 pub 패키지 매니저를 통해 원활하게 통합됩니다.

사용 사례

  • 실시간 암호화폐 가격 가져오기
  • 대시보드에서 시장 동향 표시
  • 암호화 자산 포트폴리오 트래커 만들기
  • 실시간 환율 데이터 통합
  • 시간이 지남에 따라 토큰 성능 모니터링

주요 기능

  • 간단하고 깔끔한 API 인터페이스
  • 모든 주요 플랫폼을 지원합니다
  • 실시간 데이터 접근
  • 포괄적인 엔드포인트 커버리지
  • Flutter와의 간편한 통합

적합한 대상

  • 암호화폐 추적 앱
  • 블록체인 분석 도구
  • 포트폴리오 관리 인터페이스
  • 웹3 애플리케이션 백엔드
  • 암호화폐에 관한 교육 프로젝트

고려 사항

  • 데이터 검색을 위해 인터넷 연결이 필요합니다
  • CoinGecko 이용 약관에 따라 분당 레이트 제한이 적용됩니다
  • 네트워크 실패에 대한 오류 처리가 필요할 수 있습니다
  • 외부 API의 안정성에 의존
  • 오프라인 전용 애플리케이션에는 적합하지 않습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Simple Dart wrapper for the CoinGecko API

Pub Points Pub Popularity Pub Likes

Table of contents

Installation

Add the dependency to your Dart / Flutter project:

dependencies:
  coingecko_api: ^2.0.0

Usage

  1. Create an instance of the API wrapper:
    CoinGeckoApi api = CoinGeckoApi();
    
  2. Use any methods provided by wrapper. The methods are divided into sections, just as the CoinGecko does.
    final marketChart = await api.coins.getCoinMarketChart(
      id: 'bitcoin',
      vsCurrency: 'usd',
      days: 7,
    );
    
  3. Work with the result as you see fit:
    if (!marketChart.isError) {
      marketChart.data.forEach((item) {
        print('Price: ${item.price}, Market Cap: ${item.marketCap}');
      });
    }
    

Documentation

All methods are asynchronous and use Future, so you need to use await to get the result.

Query results

The result of each method is a special object of type CoinGeckoResult. This is a kind of wrapper that allows you to first find out how successful the request was using its isError property. If isError is false, then we can use the data property of this object to get the processed data itself. Otherwise, we can view the error code and error message using properties errorCode and errorMessage.

Sections

All methods are divided into sections for easier understanding of the purpose of each method. To call any method, we first need to specify a section.

General scheme:

final result = await api./*section name*/./*method name*/(/*parameters*/);

All sections fully correspond to those in the CoinGecko API documentation itself: https://www.coingecko.com/api/documentation

Let's take a closer look at each of the sections and a set of methods in them. Each section will contain a table indicating the method, a short description of the method and the corresponding query string from the official CoinGecko website.

ping

Method name Description Query string
ping Check API server status. /ping

simple

Method name Description Query string
listPrices Get the current price of any cryptocurrencies in any other supported currencies that you need. /simple/price
listTokenPrices Get current price of tokens (using contract addresses) for a given platform in any other currency that you need. /simple/token_price/{id}
listSupportedVsCurrencies Get list of supported vs currencies. /simple/supported_vs_currencies

coins

Method name Description Query string
listCoins List all supported coins id, name and symbol. /coins/list
listCoinMarkets List all supported coins price, market cap, volume, and market related data. /coins/markets
getCoinData Get current data (name, price, market, ... including exchange tickers) for a coin. /coins/{id}
listCoinTickers Get coin tickers (paginated to 100 items). /coins/{id}/tickers
getCoinHistory Get historical data (name, price, market, stats) at a given date for a coin. /coins/{id}/history
getCoinMarketChart Get historical market data include price, market cap, and 24h volume (granularity auto). /coins/{id}/market_chart
getCoinMarketChartRanged Get historical market data include price, market cap, and 24h volume within a range of timestamp (granularity auto). /coins/{id}/market_chart/range
listCoinStatusUpdates Get status updates for a given coin. /coins/{id}/status_updates
getCoinOHLC Get coin's OHLC. /coins/{id}/ohlc

contract

Method name Description Query string
getContractTokenData Get coin info from contract address. /coins/{id}/contract/{contract_address}
getContractMarketChart Get historical market data include price, market cap, and 24h volume (granularity auto) from a contract address. /coins/{id}/contract/{contract_address}/market_chart
getContractMarketChartRanged Get historical market data include price, market cap, and 24h volume within a range of timestamp (granularity auto) from a contract address. /coins/{id}/contract/{contract_address}/market_chart/range

categories

Method name Description Query string
listCategoriesShort List all categories. /coins/categories/list
listCategories List all categories with market data. /coins/categories

nfts

Method name Description Query string
listNfts Get all supported NFTs with id, contract address, name, asset platform id and symbol. /nfts/list
getDataById Get all the NFT data (name, floor price, 24 hr volume...) based on the NFT collection id /nfts/{id}
getDataByContractAddress Get all the NFT data (name, floor price, 24 hr volume...) based on the NFT collection contract address and respective asset platform /nfts/{asset_platform_id}/contract/{contract_address}

exchanges

Method name Description Query string
listExchanges List all exchanges. /exchanges
listExchangesShort List all supported exchanges: id and name. /exchanges/list
getExchangeData Get exchange volume in BTC and top 100 tickers only. /exchanges/{id}
getExchangeTickers Get exchange tickers (paginated, 100 tickers per page). /exchanges/{id}/tickers
getExchangeVolumeChartData Get volume_chart data for a given exchange. /exchanges/{id}/volume_chart

derivatives

Method name Description Query string
listDerivatives List all derivative tickers. /derivatives
listDerivativeExchanges List all derivative exchanges. /derivatives/exchanges
getDerivativeExchange Show derivative exchange data. /derivatives/exchanges/{id}
listDerivativeExchangesShort List all derivative exchanges name and identifier. /derivatives/exchanges/list

asset_platforms

Method name Description Query string
listAssetPlatforms List all asset platforms (Blockchain networks). /asset_platforms

exchange_rates

Method name Description Query string
getBtcExchangeRates Get BTC-to-Currency exchange rates. /exchange_rates

search

Method name Description Query string
searchFor Search for coins, categories and markets listed on CoinGecko ordered by largest Market Cap first. /search

trending

Method name Description Query string
getSearchTrending Get trending search coins (Top-7) on CoinGecko in the last 24 hours. /search/trending

global

Method name Description Query string
getGlobalData Get cryptocurrency global data. /global
getGlobalDefiData Get cryptocurrency global decentralized finance(defi) data. /global/decentralized_finance_defi

companies

Method name Description Query string
getCompaniesData Get public companies data. /companies/public_treasury/{coin_id}

indexes

Method name Description Query string
listMarketIndexes List all market indexes. /indexes
getMarketIndex Get market index by market id and index id. /indexes/{market_id}/{id}
listMarketIndexesShort List market indexes id and name. /indexes/list

Full Example

final result = await api.coins.getCoinOHLC(
    id: 'bitcoin',
    vsCurrency: 'usd',
    days: 7,
);
if (!result.isError) {
    print('getCoinOHLC method returned result');
    result.data.forEach(
        (item) => print(
            '${item.timestamp}: open = ${item.open}, high = ${item.high}, low = ${item.low}, close = ${item.close}',
        ),
    );
} else {
    print('getCoinOHLC method returned error ${result.errorCode}: ${result.errorMessage}');
}

Tests

Each method is covered by a separate test using native dart testing platform dart test.

Roadmap

See the open issues for a list of proposed features and known issues.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Yegor Pelykh

E-mail: [yegor.dev@gmail.com](mailto:yegor.dev@gmail.com)

Project Link: github.com/yegor-pelykh/coingecko_api

카테고리

의존성

의존성 목록 3 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.