Skip to main content

Installation

1

Clone the Repository

git clone https://github.com/metaDAOproject/futarchy-coingecko-api.git
cd futarchy-coingecko-api
2

Install Dependencies

This project uses Bun for superior performance:
bun install
3

Configure Environment

Create a .env file based on the example:
cp example.env .env
Edit .env with your configuration:
SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
SOLANA_WS_URL=wss://api.mainnet-beta.solana.com
PORT=3000
DEX_FORK_TYPE=Custom
FACTORY_ADDRESS=YOUR_FACTORY_PROGRAM_ID
ROUTER_ADDRESS=YOUR_ROUTER_PROGRAM_ID
PROTOCOL_FEE_RATE=0.0025
4

Build and Start

bun run build
bun start
For development with hot reload:
bun run dev

Make Your First Request

Once the server is running, test the API:

Check API Information

First, verify the API is running and get information about available endpoints:
curl http://localhost:3000/
This returns API information including version, available endpoints, and DEX configuration.

Get Ticker Data

Retrieve all DAO tickers with pricing and volume information:
curl http://localhost:3000/api/tickers

Example Response

[
  {
    "ticker_id": "ZKFHiLAfAFMTcDAuCtjNW54VzpERvoe7PBF9mYgmeta_EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "base_currency": "ZKFHiLAfAFMTcDAuCtjNW54VzpERvoe7PBF9mYgmeta",
    "target_currency": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "base_symbol": "ZKFG",
    "base_name": "ZKFG",
    "target_symbol": "USDC",
    "target_name": "USD Coin",
    "pool_id": "5FPGRzY9ArJFwY2Hp2y2eqMzVewyWCBox7esmpuZfCvE",
    "last_price": "0.081340728222",
    "base_volume": "30024.81040000",
    "target_volume": "2441.23456789",
    "liquidity_in_usd": "180138.45",
    "bid": "0.080934024581",
    "ask": "0.081747431863"
  }
]

Health Check

Verify the API is running properly:
curl http://localhost:3000/health
Response:
{
  "status": "healthy",
  "timestamp": "2024-01-01T00:00:00.000Z",
  "uptime": 3600.5
}
Success! Your API is now running and ready to serve data.

Next Steps