๐Ÿ“ˆStats

This documentation provides details on the API endpoints available for Whirlprivacy.io, focusing on stats-related operations.

GET /stats/global - Global Statistics

Description:

This endpoint retrieves comprehensive global statistics related to the Whirl token.

Parameters:

No parameters are needed for this request.

Response:

{
  "activeUsers": "number",
  "totalTransactions": "number",
  "whirlToken": {
    "price": "number",
    "change": "number"
  }
}

Error Handling:

Example Code:

const fetch = require('node-fetch');

const BASE_URL = 'https://api.whirlprivacy.io/';

const getGlobalStats = async () => {
  try {
    const response = await fetch(`${BASE_URL}stats/global`);

    const data = await response.json();
    console.log('Global Stats:', data);
  } catch (error) {
    console.error('Error retrieving global stats:', error);
  }
};

getGlobalStats();

GET /stats/tvl - Total Value Locked (TVL)

Description:

This endpoint retrieves the Total Value Locked (TVL) statistics, aggregated by a specified granularity.

Parameters:

Response:

{
  "tvl": [
    {
      "date": "string",
      "value": "number"
    }
  ]
}

Error Handling:

Example Code:

const fetch = require('node-fetch');

const BASE_URL = 'https://api.whirlprivacy.io/';

const getTVL = async (granularity) => {
  try {
    const url = new URL(`${BASE_URL}stats/tvl`);
    url.search = new URLSearchParams({ granularity }).toString();

    const response = await fetch(url);
    const data = await response.json();
    console.log('Total Value Locked:', data);
  } catch (error) {
    console.error('Error retrieving TVL:', error);
  }
};

getTVL(1); // Example granularity value

GET /stats/vol - Trading Volume

Description:

This endpoint retrieves trading volume statistics, broken down by the same granularity as specified in the request.

Parameters:

Response:

{
  "volume": [
    {
      "date": "string",
      "value": "number"
    }
  ]
}

Error Handling:

Example Code:

const fetch = require('node-fetch');

const BASE_URL = 'https://api.whirlprivacy.io/';

const getVolume = async (granularity) => {
  try {
    const url = new URL(`${BASE_URL}stats/vol`);
    url.search = new URLSearchParams({ granularity }).toString();

    const response = await fetch(url);
    const data = await response.json();
    console.log('Trading Volume:', data);
  } catch (error) {
    console.error('Error retrieving volume:', error);
  }
};

getVolume(1); // Example granularity value

GET /stats/tokens - Token Data

Description:

This endpoint retrieves detailed data about the Whirl token and other currencies.

Parameters:

No parameters are needed for this request.

Response:

{
  "whirl": {
    "price": "number",
    "change": "number"
  },
  "currencies": [
    {
      "currency": "string",
      "price": "number",
      "change": "number"
    }
  ]
}

Error Handling:

Example Code:

const fetch = require('node-fetch');

const BASE_URL = 'https://api.whirlprivacy.io/';

const getTokensData = async () => {
  try {
    const response = await fetch(`${BASE_URL}stats/tokens`);

    const data = await response.json();
    console.log('Token Data:', data);
  } catch (error) {
    console.error('Error retrieving token data:', error);
  }
};

getTokensData();

Last updated