API
Coin Gecko API

💻 CoinGecko Integration API

The CoinGecko Integration API is interacted with through this REST endpoint: https://coingecko.rubicon.finance.

Endpoints

GoalEndpoint
GET Market Info for All Markets (24 Hours)https://coingecko.rubicon.finance/chainID/tickers
GET Current Order Book Depth for a Pairhttps://coingecko.rubicon.finance/chainID/orderbook?ticker_id=${tickerId}&depth=${depth}
GET Historical Trade Data for a Pairhttps://coingecko.rubicon.finance/chainID/historical_trades?ticker_id=${tickerId}&limit=${limit}&start_time=${startTime}&end_time=${endTime}&type=${type}

Endpoint 1 - /tickers

The /tickers endpoint provides 24-hour pricing and volume information on each market pair available and active in this time period on the specified chainId.

Request

GET chainID/tickers

Input Parameters

NameTypeStatusDescription
chainIDintegerMandatoryUnique chain ID of the target EVM chain.

Response

NameData TypeDescription
chainstringIdentifier for the blockchain this pair trades on.
ticker_idstringIdentifier of a ticker with delimiter to separate base/target, always using contract addresses, eg. 0x..._0x....
base_currencystringContract address of the base cryptoasset, eg. 0x....
target_currencystringContract address of the target cryptoasset, eg. 0x....
last_pricedecimalLast transacted price of the base currency based on the given target currency.
base_volumedecimal24 hour trading volume for the pair (unit in base).
target_volumedecimal24 hour trading volume for the pair (unit in target).
biddecimalCurrent highest bid price.
askdecimalCurrent lowest ask price.
highdecimalRolling 24-hours highest transaction price.
lowdecimalRolling 24-hours lowest transaction price.
pool_idstringPair unique ID.
liquidity_in_usddecimalTotal order book liquidity for the pair

Endpoint 2 - /orderbook

The /orderbook endpoint provides order book information with an optional depth specified returned for a given market pair/ticker and chainId.

Request

GET chainID/orderbook?ticker_id=${tickerId}&depth=${depth}

Input Parameters

NameTypeStatusDescription
chainIDintegerMandatoryUnique chain ID of the target EVM chain.
ticker_idstringMandatoryA pair such as 0x..._0x..., with delimiter between different cryptoassets (contract addresses).
depthintegerOptionalOrders depth quantity: [0, 100, 200, 500...]. 0 returns full depth. Depth = 100 means 50 for each bid/ask side.

Response

NameData TypeDescription
ticker_idstringA pair such as 0x..._0x..., with delimiter between different cryptoassets (contract addresses).
timestamptimestampUnix timestamp in milliseconds for when the last updated time occurred.
bidsarrayAn array containing 2 elements. The offer price and quantity for each bid order.
asksarrayAn array containing 2 elements. The ask price and quantity for each ask order.

Endpoint 3 - /historical_trades

The /historical_trades endpoint returns data on historical completed trades for a given market pair and chainId. All input parameters are optional except for chainId and ticker_id.

Request

GET chainID/historical_trades?ticker_id=${tickerId}&limit=${limit}&start_time=${startTime}&end_time=${endTime}&type=${type}

Input Parameters

NameTypeStatusDescription
chainIDintegerMandatoryUnique chain ID of the target EVM chain.
ticker_idstringMandatoryA pair such as 0x..._0x..., with delimiter between different cryptoassets (contract addresses).
limitintegerOptionalNumber of historical trades to retrieve from the time of query. [0, 200, 500...]. 0 or undefined defaults to 10.
start_timeintegerOptionalStart time from which to query historical trades from (in seconds).
end_timeintegerOptionalEnd time for historical trades query (in seconds).
typestringOptionalTo indicate the nature of trade - buy/sell.

Response

NameData TypeDescription
trade_idstringA unique ID associated with the trade for the currency pair transaction.
pricedecimalTransaction price of base asset in target currency.
base_volumedecimalTransaction amount in base pair volume.
target_volumedecimalTransaction amount in target pair volume.
trade_timestamptimestampUnix timestamp in milliseconds for when the transaction occurred.
typestringUsed to determine the type of the transaction that was completed (buy/sell).

Testing Example

For testing, you can use the following ticker_id for the WETH_USDC pair on Arbitrum:

const tickerId = '0x82af49447d8a07e3bd95bd0d56f35241523fbab1_0xaf88d065e77c8cc2239327c5edb3a432268e5831';

Curl Examples

  1. Get Market Information for All Pairs
curl -X GET "https://coingecko.rubicon.finance/42161/tickers"
  1. Get Order Book Depth for a Pair
curl -X GET "https://coingecko.rubicon.finance/42161/orderbook?ticker_id=0x82af49447d8a07e3bd95bd0d56f35241523fbab1_0xaf88d065e77c8cc2239327c5edb3a432268e5831&depth=100"
  1. Get Historical Trade Data for a Pair
curl -X GET "https://coingecko.rubicon.finance/42161/historical_trades?ticker_id=0x82af49447d8a07e3bd95bd0d56f35241523fbab1_0xaf88d065e77c8cc2239327c5edb3a432268e5831"