Skip to content

gjunqueira-sys/CoinGeckoAPI.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CoinGeckoAPI

Stable Dev Build Status Coverage Code Style: Blue ColPrac: Contributor's Guide on Collaborative Practices for Community Packages

Coin Gecko API V3

One of the most powerfull crypto API's out there. APIs are simple and easy to use, fully documented at the website.

("CoinGecko API" is a trademark of CoinGecko)

API Information:

CoinGecko API

Julia API

Implementation follows Python API Implementation as close as possible.

Return type is easy to use Dictionary format, ready for implementation and data analysis.

Installation

Pls clone this repository as this package is not yet published.

git clone, cd to the project directory, and run the following command:

pkg> activate .

pkg> instantiate

For an actual application example, pls see my blog post at:

https://gjunqueira-sys.github.io/J-J-Engineering-Blog/jupyter/julialang/crypto/2021/12/29/BasicAPIBlogPart1.html

Examples:

using CoinGeckoAPI

r = get_coin_by_id("bitcoin")
r = ping()

JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 1 entry:
  :gecko_says => "(V3) To the Moon!"
r = get_price("bitcoin", "usd") |>println

{
   "bitcoin": {
                 "usd": 49228
              }
}

API Documentation:

https://www.coingecko.com/api/docs/v3

ping

  • ping()

simple

  • get_price(ids, vs_currencies, kargs...)
r = get_price("bitcoin", "usd", "include_market_cap" => "true", "include_24hr_vol" => "true", "include_24hr_change" => "true")
  • get_token_price(id, contract_addresses, vs_currencies, kargs...)

  • get_supported_vs_currencies()

coins

  • get_coins_list(kargs...)

  • get_coins_markets(vs_currency, kargs...)

r = get_coins_markets("usd")
  • get_coin_by_id(id, kargs...)

  • get_coin_ticker_by_id(id, kargs...)

  • get_coin_history_by_id(id, date, kargs...)

  • get_coin_market_chart_by_id(id, vs_currency, days, kargs...)

  • get_coin_market_chart_range_by_id(id, vs_currency, from_timestamp, to_timestamp, kargs...)

r = get_coin_market_chart_range_by_id("bitcoin", "usd", "1392577232", "1422577232")
  • get_coin_status_updates_by_id(id, kargs...)

  • get_coin_ohlc_by_id(id, vs_currency, days)

r = get_coin_ohlc_by_id("bitcoin", "usd", "30")

81-element JSON3.Array{JSON3.Array, Base.CodeUnits{UInt8, String}, Vector{UInt64}}:
 Union{Float64, Int64}[1637683200000, 57418.05, 57418.05, 57418.05, 57418.05]
 Union{Float64, Int64}[1637697600000, 57070.97, 57588.34, 57070.97, 57542.39]
 Union{Float64, Int64}[1637712000000, 57653.91, 57851.38, 57526.34, 57526.34]
 
 Union{Float64, Int64}[1640260800000, 48316.72, 48630.74, 48316.72, 48630.74]
 Union{Float64, Int64}[1640275200000, 48644.62, 48871.58, 48644.62, 48770.99]

contract

  • get_coin_info_from_contract_address_by_id(id, contract_address)
get_coin_info_from_contract_address_by_id("ethereum", "0xc00e94cb662c3520282e6f5717214004a7f26888")

JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 33 entries:
  :id                    => "compound-governance-token"
  :symbol                => "comp"
  :name                  => "Compound"
  :asset_platform_id     => "ethereum"
  :platforms             => {
                        => 
  • get_coin_market_chart_from_contract_address_by_id(id, contract_address, vs_currency, days)
get_coin_market_chart_from_contract_address_by_id("ethereum","0xc00e94cb662c3520282e6f5717214004a7f26888" , "usd", "1")

JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 3 entries:
  :prices        => JSON3.Array[Union{Float64, Int64}[1640204661493, 207.12], Union{Float64, Int64}[1640205041467, 207.115], Union{Float64, Int64}[1640205250088, 207.082], U
  :market_caps   => JSON3.Array[Union{Float64, Int64}[1640204661493, 1.30058e9], Union{Float64, Int64}[1640205041467, 1.30139e9], Union{Float64, Int64}[1640205250088, 1.3011
  :total_volumes => JSON3.Array[Union{Float64, Int64}[1640204661493, 7.5837e7], Union{Float64, Int64}[1640205041467, 7.5491e7], Union{Float64, Int64}[1640205250088, 7.54445e
  • get_coin_market_chart_range_from_contract_address_by_id(id, contract_address, vs_currency, from_timestamp, to_timestamp)

asset_platforms

  • get_asset_platforms()

categories

  • get_coins_categories_list()
get_coins_categories_list()

127-element JSON3.Array{JSON3.Object, Base.CodeUnits{UInt8, String}, Vector{UInt64}}:
 {
   "category_id": "aave-tokens",
          "name": "Aave Tokens"
}
 {
   "category_id": "analytics",
          "name": "Analytics"
}
 {
   "category_id": "arbitrum-ecosystem",
          "name": "Arbitrum Ecosystem"
}
 
 {
   "category_id": "yield-farming",
          "name": "Yield Farming"
}
 {
   "category_id": "zilliqa-ecosystem",
          "name": "Zilliqa Ecosystem"
}
  • get_coins_categories(kargs...)
get_coins_categories()
get_coins_categories("market_cap_desc" => "true")

exchanges

  • get_exchanges_list(kargs...)
get_exchanges_list()
  • get_exchanges_id_name_list()

  • get_exchanges_by_id(id)

get_exchanges_by_id("binance")

JSON3.Object{Base.CodeUnits{UInt8, String}, Vector{UInt64}} with 23 entries:
  :name             => "Binance"
  :year_established => 2017
  :country          => "Cayman Islands"
  :description      => ""
  :url              => "https://www.binance.com/"
                   => 
  • get_exchanges_tickers_by_id(id, kargs... )

  • get_exchanges_status_updates_by_id(id, kargs...)

get_exchanges_status_updates_by_id("binance")

get_exchanges_status_updates_by_id("binance", "per_page"=>"10")
  • get_exchanges_volume_chart_by_id(id, days)
get_exchanges_volume_chart_by_id("binance", "30")

30-element JSON3.Array{JSON3.Array, Base.CodeUnits{UInt8, String}, Vector{UInt64}}:
 Any[1638022800000, "529680.87749353202570498616853533833"]
 Any[1638109200000, "444347.83566551594321406818580463667"]
 Any[1638195600000, "478727.98568245357883372214792819939"]
 
 Any[1640442000000, "331762.75766868006140462738118385402"]
 Any[1640528400000, "312634.85245232699015407131767806725"]

Finance

  • get_finance_platforms(kargs...)

  • get_finance_products(kargs...)

get_finance_products("page" => "1", "per_page" => "2")

2-element JSON3.Array{JSON3.Object, Base.CodeUnits{UInt8, String}, Vector{UInt64}}:
 {
                 "platform": "Staked US",
               "identifier": "Keep",
   "supply_rate_percentage": "3.4",
   "borrow_rate_percentage": nothing,
          "number_duration": nothing,
          "length_duration": nothing,
                 "start_at": 0,
                   "end_at": 0,
                 "value_at": 0,
                "redeem_at": 0
}
 {
                 "platform": "Celsius Network",
               "identifier": "XTZ",
   "supply_rate_percentage": "4.16",
   "borrow_rate_percentage": nothing,
          "number_duration": nothing,
          "length_duration": nothing,
                 "start_at": 0,
                   "end_at": 0,
                 "value_at": 0,
                "redeem_at": 0
}