Mobula API enables the retrieval of historical balance data from EVM-compatible crypto wallets. This tutorial will guide you through the process of fetching and analyzing the historical balance of a wallet.

What you’ll need

  1. An EVM-compatible wallet address for querying.
  2. An API key from the Dashboard (only for production use, you can use the API without an API key in development mode).

Walkthrough

1

Prepare Your Query

Select the wallet address for which you want to query historical balance data. Optionally, decide if you want to filter the data by blockchain or specific time intervals.

2

Execute the API Call

Utilize cURL, Axios, or the Mobula SDK (Beta) to make the API request:

Using cURL:

curl --request GET \
--url 'https://api.mobula.io/api/1/wallet/history?wallet=0x77A89C51f106D6cD547542a3A83FE73cB4459135&from=1650788304000&to=1651940430000'

Using Axios:

import axios from "axios";
axios.get('https://api.mobula.io/api/1/wallet/history?wallet=0x77A89C51f106D6cD547542a3A83FE73cB4459135&from=1650788304000&to=1651940430000')
.then(response => console.log(response.data))
.catch(error => console.log(error));

Using Mobula SDK (Beta):

import { Mobula } from "mobula-sdk";
const mobula = new Mobula("YOUR_API_KEY_HERE");
mobula.fetchWalletHistoryBalance({
  wallet: "0x77A89C51f106D6cD547542a3A83FE73cB4459135",
  // Optional parameters:
  blockchains: "BLOCKCHAIN_NAMES",
  from: "1650788304000",
  to: "1651940430000"
})
.then(response => console.log(response))
.catch(error => console.log(error));
3

Review the Response

The API response will include detailed historical balance data, showing how the wallet’s value has changed over time:

{
  "data": {
    "wallet": [
      "0x77a89c51f106d6cd547542a3a83fe73cb4459135"
    ],
    "balance_usd": 241.16725574204617,
    "balance_history": [
      [1650788304000, 0],
      [1650788305000, 0],
      [1650874705000, 40.94737444508439],
      // ... other data points ...
      [1651940430000, 47.36438419453997]
    ]
  }
}

Extending Your Insights

With the historical balance data, you can:

  • Track Value Fluctuations: Observe how the wallet’s value has changed over specified periods.
  • Identify Trends: Spot patterns or significant events in the wallet’s history.
  • Incorporate Data into Applications: Use this historical data for financial analysis, trading strategies, or portfolio management tools.

Need Assistance?

Our support team is ready to help you with any queries or integration challenges.