A TypeScript library for interacting with the GeckoTerminal API, providing easy access to DEX pools, tokens, and trading data on the Conflux Network and other chains.
npm install @cfxdevkit/geckoterminal
import { GeckoTerminal } from '@cfxdevkit/geckoterminal';
const client = new GeckoTerminal();
// Get all networks
const networks = await client.getNetworks();
// Get DEXes for Conflux network
const dexes = await client.getNetworkDexes('cfx');
// Get top pools for Swappi on Conflux
const pools = await client.getTopPools('cfx', 'swappi');
const client = new GeckoTerminal();
// Get all supported networks
const networks = await client.getNetworks();
// Get DEXes for a specific network
const dexes = await client.getNetworkDexes('cfx');
// Get top pools for a specific DEX
const topPools = await client.getTopPools('cfx', 'swappi');
// Get trending pools
const trendingPools = await client.getTrendingPools('cfx', '24h');
// Get new pools
const newPools = await client.getNewPools('cfx');
// Get specific pool information
const poolInfo = await client.getPoolInfo('cfx', 'pool_address');
// Get pool OHLCV data
const ohlcv = await client.getPoolOHLCV('cfx', 'pool_address', 'hour', {
limit: '3'
});
// Get token information
const tokenInfo = await client.getTokenInfo('cfx', 'token_address');
// Get pools for a specific token
const tokenPools = await client.getTokenPools('cfx', 'token_address');
// Get multiple token information
const multiTokenInfo = await client.getMultiTokenInfo('cfx', ['token1', 'token2']);
// Get simple token prices
const tokenPrices = await client.getSimpleTokenPrices('cfx', ['token1', 'token2'], true, true);
// Search for pools
const searchResults = await client.searchPools('WETH', 'cfx');
The library includes various formatting utilities for data presentation:
import { formatUtils } from '@cfxdevkit/geckoterminal';
// Format currency
formatUtils.currency(1234.5678); // "$1,234.57"
formatUtils.compactCurrency(1234567); // "$1.23M"
// Format percentages
formatUtils.percentage(12.345); // "12.35%"
formatUtils.changePercent(-12.345); // "-12.35%"
// Format dates
formatUtils.date(1612137600); // "2021-02-01 00:00:00"
formatUtils.monthYear(new Date("2024-02-15")); // "February 2024"
// Classify volatility
formatUtils.volatility(0.75); // "High"
const networks = await client.getNetworks();
const dexes = await client.getNetworkDexes('cfx');
const pools = await client.getTopPools('cfx', 'swappi');
const trending = await client.getTrendingPools('cfx', '24h');
const info = await client.getPoolInfo('cfx', 'pool_address');
const token = await client.getTokenInfo('cfx', 'token_address');
const prices = await client.getSimpleTokenPrices('cfx', ['token_address']);
git clone https://github.com/cfxdevkit/geckoterminal.git
cd geckoterminal
npm install
npm run build
- Build the librarynpm run test
- Run testsnpm run test:coverage
- Run tests with coveragenpm run lint
- Lint the codenpm run format
- Format the codenpm run example
- Run example usage scriptContributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/AmazingFeature
)git commit -m 'Add some AmazingFeature'
)git push origin feature/AmazingFeature
)This project is licensed under the MIT License - see the LICENSE file for details.